diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-05-15 17:42:27 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-05-15 17:42:27 +0000 |
commit | 9bced107535bc581c2d8d34f158e99c7e9eeb0c0 (patch) | |
tree | 66682dfa5ed282f8f0e5cc74df1a1030bd4ddebf /testsuites/psxtests/psxitimer/init.c | |
parent | 2009-05-15 Joel Sherrill <joel.sherrill@OARcorp.com> (diff) | |
download | rtems-9bced107535bc581c2d8d34f158e99c7e9eeb0c0.tar.bz2 |
2009-05-15 Joel Sherrill <joel.sherrill@OARcorp.com>
* Makefile.am, configure.ac: Add new test to provide coverage analysis
of the current implementation of getitimer() and setitimer().
* psxitimer/.cvsignore, psxitimer/Makefile.am, psxitimer/init.c,
psxitimer/psxitimer.scn: New files.
Diffstat (limited to 'testsuites/psxtests/psxitimer/init.c')
-rw-r--r-- | testsuites/psxtests/psxitimer/init.c | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/testsuites/psxtests/psxitimer/init.c b/testsuites/psxtests/psxitimer/init.c new file mode 100644 index 0000000000..317a182e36 --- /dev/null +++ b/testsuites/psxtests/psxitimer/init.c @@ -0,0 +1,86 @@ +/* + * COPYRIGHT (c) 1989-2009. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#include <pmacros.h> +#include <sys/time.h> +#include <errno.h> + +void *POSIX_Init( + void *argument +) +{ + int status; + struct itimerval itimer; + struct itimerval otimer; + + puts( "\n\n*** POSIX TEST ITIMER ***" ); + + /* test getitimer stub */ + puts( "getitimer -- bad which - EINVAL " ); + status = getitimer( 1234, &itimer ); + assert( status == -1 && errno == EINVAL ); + + puts( "getitimer -- NULL pointer - EFAULT " ); + status = getitimer( ITIMER_REAL, NULL ); + assert( status == -1 && errno == EFAULT ); + + puts( "getitimer -- ITIMER_REAL - ENOSYS " ); + status = getitimer( ITIMER_REAL, &itimer ); + assert( status == -1 && errno == ENOSYS ); + + puts( "getitimer -- ITIMER_VIRTUAL - ENOSYS " ); + status = getitimer( ITIMER_VIRTUAL, &itimer ); + assert( status == -1 && errno == ENOSYS ); + + puts( "getitimer -- ITIMER_PROF - ENOSYS " ); + status = getitimer( ITIMER_PROF, &itimer ); + assert( status == -1 && errno == ENOSYS ); + + /* test setitimer stub */ + puts( "setitimer -- bad which - EINVAL " ); + status = setitimer( 1234, &itimer, &otimer ); + assert( status == -1 && errno == EINVAL ); + + puts( "setitimer -- NULL value pointer - EFAULT " ); + status = setitimer( ITIMER_REAL, NULL, &otimer ); + assert( status == -1 && errno == EFAULT ); + + puts( "setitimer -- NULL value pointer - EFAULT " ); + status = setitimer( ITIMER_REAL, &itimer, NULL ); + assert( status == -1 && errno == EFAULT ); + + puts( "setitimer -- ITIMER_REAL - ENOSYS " ); + status = setitimer( ITIMER_REAL, &itimer, &otimer ); + assert( status == -1 && errno == ENOSYS ); + + puts( "setitimer -- ITIMER_VIRTUAL - ENOSYS " ); + status = setitimer( ITIMER_VIRTUAL, &itimer, &otimer ); + assert( status == -1 && errno == ENOSYS ); + + puts( "setitimer -- ITIMER_PROF - ENOSYS " ); + status = setitimer( ITIMER_PROF, &itimer, &otimer ); + assert( status == -1 && errno == ENOSYS ); + + puts( "*** END OF POSIX TEST ITIMER ***" ); + rtems_test_exit(0); +} + +/* configuration information */ + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_POSIX_THREADS 1 + +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_INIT +#include <rtems/confdefs.h> |