• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Test liburing nolibc functionality.
4  *
5  * Currently, supported architectures are:
6  *   1) x86
7  *   2) x86-64
8  *   3) aarch64
9  *   4) riscv64
10  *
11  */
12 #include "helpers.h"
13 
14 #if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) && (!defined(__riscv) && __riscv_xlen != 64)
15 
16 
17 /*
18  * This arch doesn't support nolibc.
19  */
main(void)20 int main(void)
21 {
22 	return T_EXIT_SKIP;
23 }
24 
25 #else /* #if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) && (!defined(__riscv) && __riscv_xlen != 64) */
26 
27 #ifndef CONFIG_NOLIBC
28 #define CONFIG_NOLIBC
29 #endif
30 
31 #include <stdio.h>
32 #include <unistd.h>
33 #include "../src/lib.h"
34 
test_get_page_size(void)35 static int test_get_page_size(void)
36 {
37 	long a, b;
38 
39 	a = sysconf(_SC_PAGESIZE);
40 	b = get_page_size();
41 	if (a != b) {
42 		fprintf(stderr, "get_page_size() fails, %ld != %ld", a, b);
43 		return -1;
44 	}
45 	return 0;
46 }
47 
main(int argc,char * argv[])48 int main(int argc, char *argv[])
49 {
50 	int ret;
51 
52 	if (argc > 1)
53 		return T_EXIT_SKIP;
54 
55 	ret = test_get_page_size();
56 	if (ret)
57 		return T_EXIT_FAIL;
58 
59 	return T_EXIT_PASS;
60 }
61 
62 #endif /* #if !defined(__x86_64__) && !defined(__i386__) && !defined(__aarch64__) && (!defined(__riscv) && __riscv_xlen != 64) */
63