1 | /* |
---|
2 | * COPYRIGHT (c) 1989-2012. |
---|
3 | * On-Line Applications Research Corporation (OAR). |
---|
4 | * |
---|
5 | * The license and distribution terms for this file may be |
---|
6 | * found in the file LICENSE in this distribution or at |
---|
7 | * http://www.rtems.com/license/LICENSE. |
---|
8 | */ |
---|
9 | |
---|
10 | #ifdef HAVE_CONFIG_H |
---|
11 | #include "config.h" |
---|
12 | #endif |
---|
13 | |
---|
14 | #include <pmacros.h> |
---|
15 | #include <sys/time.h> |
---|
16 | #include <errno.h> |
---|
17 | |
---|
18 | /* forward declarations to avoid warnings */ |
---|
19 | void *POSIX_Init(void *argument); |
---|
20 | |
---|
21 | void *POSIX_Init( |
---|
22 | void *argument |
---|
23 | ) |
---|
24 | { |
---|
25 | int status; |
---|
26 | struct itimerval itimer; |
---|
27 | struct itimerval otimer; |
---|
28 | |
---|
29 | puts( "\n\n*** POSIX TEST ITIMER ***" ); |
---|
30 | |
---|
31 | /* test getitimer stub */ |
---|
32 | puts( "getitimer -- bad which - EINVAL " ); |
---|
33 | status = getitimer( 1234, &itimer ); |
---|
34 | rtems_test_assert( status == -1 && errno == EINVAL ); |
---|
35 | |
---|
36 | puts( "getitimer -- NULL pointer - EFAULT " ); |
---|
37 | status = getitimer( ITIMER_REAL, NULL ); |
---|
38 | rtems_test_assert( status == -1 && errno == EFAULT ); |
---|
39 | |
---|
40 | puts( "getitimer -- ITIMER_REAL - ENOSYS " ); |
---|
41 | status = getitimer( ITIMER_REAL, &itimer ); |
---|
42 | rtems_test_assert( status == -1 && errno == ENOSYS ); |
---|
43 | |
---|
44 | puts( "getitimer -- ITIMER_VIRTUAL - ENOSYS " ); |
---|
45 | status = getitimer( ITIMER_VIRTUAL, &itimer ); |
---|
46 | rtems_test_assert( status == -1 && errno == ENOSYS ); |
---|
47 | |
---|
48 | puts( "getitimer -- ITIMER_PROF - ENOSYS " ); |
---|
49 | status = getitimer( ITIMER_PROF, &itimer ); |
---|
50 | rtems_test_assert( status == -1 && errno == ENOSYS ); |
---|
51 | |
---|
52 | /* test setitimer stub */ |
---|
53 | puts( "setitimer -- bad which - EINVAL " ); |
---|
54 | status = setitimer( 1234, &itimer, &otimer ); |
---|
55 | rtems_test_assert( status == -1 && errno == EINVAL ); |
---|
56 | |
---|
57 | puts( "setitimer -- NULL value pointer - EFAULT " ); |
---|
58 | status = setitimer( ITIMER_REAL, NULL, &otimer ); |
---|
59 | rtems_test_assert( status == -1 && errno == EFAULT ); |
---|
60 | |
---|
61 | puts( "setitimer -- NULL value pointer - EFAULT " ); |
---|
62 | status = setitimer( ITIMER_REAL, &itimer, NULL ); |
---|
63 | rtems_test_assert( status == -1 && errno == EFAULT ); |
---|
64 | |
---|
65 | puts( "setitimer -- ITIMER_REAL - ENOSYS " ); |
---|
66 | status = setitimer( ITIMER_REAL, &itimer, &otimer ); |
---|
67 | rtems_test_assert( status == -1 && errno == ENOSYS ); |
---|
68 | |
---|
69 | puts( "setitimer -- ITIMER_VIRTUAL - ENOSYS " ); |
---|
70 | status = setitimer( ITIMER_VIRTUAL, &itimer, &otimer ); |
---|
71 | rtems_test_assert( status == -1 && errno == ENOSYS ); |
---|
72 | |
---|
73 | puts( "setitimer -- ITIMER_PROF - ENOSYS " ); |
---|
74 | status = setitimer( ITIMER_PROF, &itimer, &otimer ); |
---|
75 | rtems_test_assert( status == -1 && errno == ENOSYS ); |
---|
76 | |
---|
77 | puts( "*** END OF POSIX TEST ITIMER ***" ); |
---|
78 | rtems_test_exit(0); |
---|
79 | } |
---|
80 | |
---|
81 | /* configuration information */ |
---|
82 | |
---|
83 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
84 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
---|
85 | |
---|
86 | #define CONFIGURE_MAXIMUM_POSIX_THREADS 1 |
---|
87 | |
---|
88 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE |
---|
89 | |
---|
90 | #define CONFIGURE_INIT |
---|
91 | #include <rtems/confdefs.h> |
---|