summaryrefslogtreecommitdiffstats
path: root/testsuites
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
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')
-rw-r--r--testsuites/psxtests/ChangeLog7
-rw-r--r--testsuites/psxtests/Makefile.am2
-rw-r--r--testsuites/psxtests/configure.ac1
-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
7 files changed, 138 insertions, 1 deletions
diff --git a/testsuites/psxtests/ChangeLog b/testsuites/psxtests/ChangeLog
index 7a2b4265fc..ed46cb2064 100644
--- a/testsuites/psxtests/ChangeLog
+++ b/testsuites/psxtests/ChangeLog
@@ -1,5 +1,12 @@
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.
+
+2009-05-15 Joel Sherrill <joel.sherrill@OARcorp.com>
+
* psxsysconf/init.c, psxsysconf/psxsysconf.scn: Add missing error test
case to improve coverage analysis.
diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index bfcc089328..bd7a874410 100644
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -8,7 +8,7 @@ SUBDIRS = psxhdrs psx01 psx02 psx03 psx04 psx05 psx06 psx07 psx08 psx09 \
psx10 psx11 psx12 psx13 psx14 psxcleanup psxtime psxtimer01 psxtimer02 \
psxcancel psxbarrier01 psxmsgq01 psxmsgq02 psxrwlock01 psxsem01 \
psxspin01 psxenosys psxsignal01 psxsysconf psxualarm psxkey01 \
- psxfatal01 psxfatal02
+ psxfatal01 psxfatal02 psxitimer
## File IO tests
SUBDIRS += psxfile01 psxreaddir psxstat psxmount psx13 psxchroot01
diff --git a/testsuites/psxtests/configure.ac b/testsuites/psxtests/configure.ac
index 35dc04e7bb..0d9ab144eb 100644
--- a/testsuites/psxtests/configure.ac
+++ b/testsuites/psxtests/configure.ac
@@ -50,6 +50,7 @@ psxfatal01/Makefile
psxfatal02/Makefile
psxfile01/Makefile
psxhdrs/Makefile
+psxitimer/Makefile
psxkey01/Makefile
psxmount/Makefile
psxmsgq01/Makefile
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 ***