1 /* Test for sys_padconf() */
2 #include <errno.h>
3 #include <stdio.h>
4 #include <minix/com.h>
5 #include <minix/syslib.h>
6 #include <minix/padconf.h>
7 #include <minix/drivers.h>
8 #include <assert.h>
9
10 static unsigned int failures = 0;
11
12 /*
13 * padconf is only supported on ARM. On other systems sys_padconf() should
14 * return -EBADREQUEST.
15 */
test_badrequest(void)16 static void test_badrequest(void)
17 {
18 #if !defined(__arm__)
19 int r;
20
21 r = sys_padconf(0xffffffff, 0xffffffff, 0xffffffff);
22 if (r != -EBADREQUEST) {
23 printf("Expected r=%d | Got r=%d\n", -EBADREQUEST, r);
24 failures++;
25 }
26 #endif
27 return;
28 }
29
do_tests(void)30 static void do_tests(void)
31 {
32 test_badrequest();
33 }
34
sef_cb_init_fresh(int UNUSED (type),sef_init_info_t * UNUSED (info))35 static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
36 {
37 do_tests();
38
39 /* The returned code will determine the outcome of the RS call, and
40 * thus the entire test. The actual error code does not matter.
41 */
42 return (failures) ? EINVAL : 0;
43 }
44
sef_local_startup(void)45 static void sef_local_startup(void)
46 {
47 sef_setcb_init_fresh(sef_cb_init_fresh);
48
49 sef_startup();
50 }
51
main(int argc,char ** argv)52 int main(int argc, char **argv)
53 {
54 env_setargs(argc, argv);
55
56 sef_local_startup();
57
58 return 0;
59 }
60