source: rtems/testsuites/psxtests/psxitimer/init.c @ 698c2e50

4.115
Last change on this file since 698c2e50 was 698c2e50, checked in by Sebastian Huber <sebastian.huber@…>, on 03/25/14 at 07:06:16

tests/psxtests: Use <rtems/test.h>

  • Property mode set to 100644
File size: 2.7 KB
Line 
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.org/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
18const char rtems_test_name[] = "PSXITIMER";
19
20/* forward declarations to avoid warnings */
21void *POSIX_Init(void *argument);
22
23void *POSIX_Init(
24  void *argument
25)
26{
27  int              status;
28  struct itimerval itimer;
29  struct itimerval otimer;
30
31  TEST_BEGIN();
32
33  /* test getitimer stub */
34  puts( "getitimer -- bad which - EINVAL " );
35  status = getitimer( 1234, &itimer );
36  rtems_test_assert( status == -1 && errno == EINVAL );
37
38  puts( "getitimer -- NULL pointer - EFAULT " );
39  status = getitimer( ITIMER_REAL, NULL );
40  rtems_test_assert( status == -1 && errno == EFAULT );
41
42  puts( "getitimer -- ITIMER_REAL - ENOSYS " );
43  status = getitimer( ITIMER_REAL, &itimer );
44  rtems_test_assert( status == -1 && errno == ENOSYS );
45
46  puts( "getitimer -- ITIMER_VIRTUAL - ENOSYS " );
47  status = getitimer( ITIMER_VIRTUAL, &itimer );
48  rtems_test_assert( status == -1 && errno == ENOSYS );
49
50  puts( "getitimer -- ITIMER_PROF - ENOSYS " );
51  status = getitimer( ITIMER_PROF, &itimer );
52  rtems_test_assert( status == -1 && errno == ENOSYS );
53
54  /* test setitimer stub */
55  puts( "setitimer -- bad which - EINVAL " );
56  status = setitimer( 1234, &itimer, &otimer );
57  rtems_test_assert( status == -1 && errno == EINVAL );
58
59  puts( "setitimer -- NULL value pointer - EFAULT " );
60  status = setitimer( ITIMER_REAL, NULL, &otimer );
61  rtems_test_assert( status == -1 && errno == EFAULT );
62
63  puts( "setitimer -- NULL value pointer - EFAULT " );
64  status = setitimer( ITIMER_REAL, &itimer, NULL );
65  rtems_test_assert( status == -1 && errno == EFAULT );
66
67  puts( "setitimer -- ITIMER_REAL - ENOSYS " );
68  status = setitimer( ITIMER_REAL, &itimer, &otimer );
69  rtems_test_assert( status == -1 && errno == ENOSYS );
70
71  puts( "setitimer -- ITIMER_VIRTUAL - ENOSYS " );
72  status = setitimer( ITIMER_VIRTUAL, &itimer, &otimer );
73  rtems_test_assert( status == -1 && errno == ENOSYS );
74
75  puts( "setitimer -- ITIMER_PROF - ENOSYS " );
76  status = setitimer( ITIMER_PROF, &itimer, &otimer );
77  rtems_test_assert( status == -1 && errno == ENOSYS );
78
79  TEST_END();
80  rtems_test_exit(0);
81}
82
83/* configuration information */
84
85#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
86#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
87
88#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
89
90#define CONFIGURE_MAXIMUM_POSIX_THREADS     1
91
92#define CONFIGURE_POSIX_INIT_THREAD_TABLE
93
94#define CONFIGURE_INIT
95#include <rtems/confdefs.h>
Note: See TracBrowser for help on using the repository browser.