1 | /* |
---|
2 | * COPYRIGHT (c) 1989-2009. |
---|
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 | void *POSIX_Init( |
---|
19 | void *argument |
---|
20 | ) |
---|
21 | { |
---|
22 | int status; |
---|
23 | struct itimerval itimer; |
---|
24 | struct itimerval otimer; |
---|
25 | |
---|
26 | puts( "\n\n*** POSIX TEST ITIMER ***" ); |
---|
27 | |
---|
28 | /* test getitimer stub */ |
---|
29 | puts( "getitimer -- bad which - EINVAL " ); |
---|
30 | status = getitimer( 1234, &itimer ); |
---|
31 | rtems_test_assert( status == -1 && errno == EINVAL ); |
---|
32 | |
---|
33 | puts( "getitimer -- NULL pointer - EFAULT " ); |
---|
34 | status = getitimer( ITIMER_REAL, NULL ); |
---|
35 | rtems_test_assert( status == -1 && errno == EFAULT ); |
---|
36 | |
---|
37 | puts( "getitimer -- ITIMER_REAL - ENOSYS " ); |
---|
38 | status = getitimer( ITIMER_REAL, &itimer ); |
---|
39 | rtems_test_assert( status == -1 && errno == ENOSYS ); |
---|
40 | |
---|
41 | puts( "getitimer -- ITIMER_VIRTUAL - ENOSYS " ); |
---|
42 | status = getitimer( ITIMER_VIRTUAL, &itimer ); |
---|
43 | rtems_test_assert( status == -1 && errno == ENOSYS ); |
---|
44 | |
---|
45 | puts( "getitimer -- ITIMER_PROF - ENOSYS " ); |
---|
46 | status = getitimer( ITIMER_PROF, &itimer ); |
---|
47 | rtems_test_assert( status == -1 && errno == ENOSYS ); |
---|
48 | |
---|
49 | /* test setitimer stub */ |
---|
50 | puts( "setitimer -- bad which - EINVAL " ); |
---|
51 | status = setitimer( 1234, &itimer, &otimer ); |
---|
52 | rtems_test_assert( status == -1 && errno == EINVAL ); |
---|
53 | |
---|
54 | puts( "setitimer -- NULL value pointer - EFAULT " ); |
---|
55 | status = setitimer( ITIMER_REAL, NULL, &otimer ); |
---|
56 | rtems_test_assert( status == -1 && errno == EFAULT ); |
---|
57 | |
---|
58 | puts( "setitimer -- NULL value pointer - EFAULT " ); |
---|
59 | status = setitimer( ITIMER_REAL, &itimer, NULL ); |
---|
60 | rtems_test_assert( status == -1 && errno == EFAULT ); |
---|
61 | |
---|
62 | puts( "setitimer -- ITIMER_REAL - ENOSYS " ); |
---|
63 | status = setitimer( ITIMER_REAL, &itimer, &otimer ); |
---|
64 | rtems_test_assert( status == -1 && errno == ENOSYS ); |
---|
65 | |
---|
66 | puts( "setitimer -- ITIMER_VIRTUAL - ENOSYS " ); |
---|
67 | status = setitimer( ITIMER_VIRTUAL, &itimer, &otimer ); |
---|
68 | rtems_test_assert( status == -1 && errno == ENOSYS ); |
---|
69 | |
---|
70 | puts( "setitimer -- ITIMER_PROF - ENOSYS " ); |
---|
71 | status = setitimer( ITIMER_PROF, &itimer, &otimer ); |
---|
72 | rtems_test_assert( status == -1 && errno == ENOSYS ); |
---|
73 | |
---|
74 | puts( "*** END OF POSIX TEST ITIMER ***" ); |
---|
75 | rtems_test_exit(0); |
---|
76 | } |
---|
77 | |
---|
78 | /* configuration information */ |
---|
79 | |
---|
80 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
---|
81 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
---|
82 | |
---|
83 | #define CONFIGURE_MAXIMUM_POSIX_THREADS 1 |
---|
84 | |
---|
85 | #define CONFIGURE_POSIX_INIT_THREAD_TABLE |
---|
86 | |
---|
87 | #define CONFIGURE_INIT |
---|
88 | #include <rtems/confdefs.h> |
---|