summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests/psxitimer
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-05-15 17:42:27 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-05-15 17:42:27 +0000
commit9bced107535bc581c2d8d34f158e99c7e9eeb0c0 (patch)
tree66682dfa5ed282f8f0e5cc74df1a1030bd4ddebf /testsuites/psxtests/psxitimer
parent2009-05-15 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-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')
-rw-r--r--testsuites/psxtests/psxitimer/.cvsignore2
-rw-r--r--testsuites/psxtests/psxitimer/Makefile.am28
-rw-r--r--testsuites/psxtests/psxitimer/init.c86
-rw-r--r--testsuites/psxtests/psxitimer/psxitimer.scn13
4 files changed, 129 insertions, 0 deletions
diff --git a/testsuites/psxtests/psxitimer/.cvsignore b/testsuites/psxtests/psxitimer/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/testsuites/psxtests/psxitimer/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/testsuites/psxtests/psxitimer/Makefile.am b/testsuites/psxtests/psxitimer/Makefile.am
new file mode 100644
index 0000000000..0fc74d7738
--- /dev/null
+++ b/testsuites/psxtests/psxitimer/Makefile.am
@@ -0,0 +1,28 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = psxitimer
+psxitimer_SOURCES = init.c ../include/pmacros.h
+
+dist_rtems_tests_DATA = psxitimer.scn
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+psxitimer_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
+
+AM_CPPFLAGS += -I$(top_srcdir)/include
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(psxitimer_OBJECTS) $(psxitimer_LDADD)
+LINK_LIBS = $(psxitimer_LDLIBS)
+
+psxitimer$(EXEEXT): $(psxitimer_OBJECTS) $(psxitimer_DEPENDENCIES)
+ @rm -f psxitimer$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
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>
diff --git a/testsuites/psxtests/psxitimer/psxitimer.scn b/testsuites/psxtests/psxitimer/psxitimer.scn
new file mode 100644
index 0000000000..1c80877e1b
--- /dev/null
+++ b/testsuites/psxtests/psxitimer/psxitimer.scn
@@ -0,0 +1,13 @@
+*** POSIX TEST ITIMER ***
+getitimer -- bad which - EINVAL
+getitimer -- NULL pointer - EFAULT
+getitimer -- ITIMER_REAL - ENOSYS
+getitimer -- ITIMER_VIRTUAL - ENOSYS
+getitimer -- ITIMER_PROF - ENOSYS
+setitimer -- bad which - EINVAL
+setitimer -- NULL value pointer - EFAULT
+setitimer -- NULL value pointer - EFAULT
+setitimer -- ITIMER_REAL - ENOSYS
+setitimer -- ITIMER_VIRTUAL - ENOSYS
+setitimer -- ITIMER_PROF - ENOSYS
+*** END OF POSIX TEST ITIMER ***