diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-12-17 16:04:40 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-12-17 16:04:40 +0000 |
commit | eed0b96d206fcf7e20781120ff7509d8dd85fe9a (patch) | |
tree | 00051b7427d3c58377204e364b464c9d2889ba0b | |
parent | 2007-12-17 Joel Sherrill <joel.sherrill@OARcorp.com> (diff) | |
download | rtems-eed0b96d206fcf7e20781120ff7509d8dd85fe9a.tar.bz2 |
2007-12-17 Joel Sherrill <joel.sherrill@OARcorp.com>
* Makefile.am, configure.ac: Rename psxtimer to psxtimer01 to indicate
addition of second POSIX Timer test. Add initial version of
psxtimer02 to cover some conditions missed in psxtimer01. More cases
left to add.
* psxtimer01/.cvsignore, psxtimer01/Makefile.am, psxtimer01/psxtimer.c,
psxtimer01/psxtimer01.scn, psxtimer01/system.h,
psxtimer02/.cvsignore, psxtimer02/Makefile.am, psxtimer02/psxtimer.c,
psxtimer02/psxtimer02.scn, psxtimer02/system.h: New files.
* psxtimer/.cvsignore, psxtimer/Makefile.am, psxtimer/psxtimer.c,
psxtimer/psxtimer.scn, psxtimer/system.h: Removed.
-rw-r--r-- | testsuites/psxtests/ChangeLog | 13 | ||||
-rw-r--r-- | testsuites/psxtests/Makefile.am | 4 | ||||
-rw-r--r-- | testsuites/psxtests/configure.ac | 3 | ||||
-rw-r--r-- | testsuites/psxtests/psxtimer/Makefile.am | 28 | ||||
-rw-r--r-- | testsuites/psxtests/psxtimer01/.cvsignore (renamed from testsuites/psxtests/psxtimer/.cvsignore) | 0 | ||||
-rw-r--r-- | testsuites/psxtests/psxtimer01/Makefile.am | 28 | ||||
-rw-r--r-- | testsuites/psxtests/psxtimer01/psxtimer.c (renamed from testsuites/psxtests/psxtimer/psxtimer.c) | 4 | ||||
-rw-r--r-- | testsuites/psxtests/psxtimer01/psxtimer01.scn (renamed from testsuites/psxtests/psxtimer/psxtimer.scn) | 4 | ||||
-rw-r--r-- | testsuites/psxtests/psxtimer01/system.h (renamed from testsuites/psxtests/psxtimer/system.h) | 2 | ||||
-rw-r--r-- | testsuites/psxtests/psxtimer02/.cvsignore | 2 | ||||
-rw-r--r-- | testsuites/psxtests/psxtimer02/Makefile.am | 28 | ||||
-rw-r--r-- | testsuites/psxtests/psxtimer02/psxtimer.c | 110 | ||||
-rw-r--r-- | testsuites/psxtests/psxtimer02/psxtimer02.scn | 16 | ||||
-rw-r--r-- | testsuites/psxtests/psxtimer02/system.h | 37 |
14 files changed, 243 insertions, 36 deletions
diff --git a/testsuites/psxtests/ChangeLog b/testsuites/psxtests/ChangeLog index bda976ede6..8ed25c2d90 100644 --- a/testsuites/psxtests/ChangeLog +++ b/testsuites/psxtests/ChangeLog @@ -1,3 +1,16 @@ +2007-12-17 Joel Sherrill <joel.sherrill@OARcorp.com> + + * Makefile.am, configure.ac: Rename psxtimer to psxtimer01 to indicate + addition of second POSIX Timer test. Add initial version of + psxtimer02 to cover some conditions missed in psxtimer01. More cases + left to add. + * psxtimer01/.cvsignore, psxtimer01/Makefile.am, psxtimer01/psxtimer.c, + psxtimer01/psxtimer01.scn, psxtimer01/system.h, + psxtimer02/.cvsignore, psxtimer02/Makefile.am, psxtimer02/psxtimer.c, + psxtimer02/psxtimer02.scn, psxtimer02/system.h: New files. + * psxtimer/.cvsignore, psxtimer/Makefile.am, psxtimer/psxtimer.c, + psxtimer/psxtimer.scn, psxtimer/system.h: Removed. + 2007-12-13 Joel Sherrill <joel.sherrill@OARcorp.com> * psx01/init.c, psx01/psx01.scn: Add usleep() test. diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am index 5ac6e0907d..df42842fb0 100644 --- a/testsuites/psxtests/Makefile.am +++ b/testsuites/psxtests/Makefile.am @@ -5,8 +5,8 @@ ACLOCAL_AMFLAGS = -I ../aclocal SUBDIRS = psxhdrs psx01 psx02 psx03 psx04 psx05 psx06 psx07 psx08 psx09 \ - psx10 psx11 psx12 psxtime psxtimer psxcancel psxbarrier01 psxmsgq01 \ - psxrwlock01 psxsem01 psxspin01 psxenosys + psx10 psx11 psx12 psxtime psxtimer01 psxtimer02 psxcancel psxbarrier01 \ + psxmsgq01 psxrwlock01 psxsem01 psxspin01 psxenosys ## File IO tests SUBDIRS += psxfile01 psxreaddir psxstat psxmount psx13 psxchroot01 diff --git a/testsuites/psxtests/configure.ac b/testsuites/psxtests/configure.ac index ed52aeee7b..2c57875f01 100644 --- a/testsuites/psxtests/configure.ac +++ b/testsuites/psxtests/configure.ac @@ -55,6 +55,7 @@ psxsem01/Makefile psxspin01/Makefile psxstat/Makefile psxtime/Makefile -psxtimer/Makefile +psxtimer01/Makefile +psxtimer02/Makefile ]) AC_OUTPUT diff --git a/testsuites/psxtests/psxtimer/Makefile.am b/testsuites/psxtests/psxtimer/Makefile.am deleted file mode 100644 index c0defa10ad..0000000000 --- a/testsuites/psxtests/psxtimer/Makefile.am +++ /dev/null @@ -1,28 +0,0 @@ -## -## $Id$ -## - -MANAGERS = all - -rtems_tests_PROGRAMS = psxtimer.exe -psxtimer_exe_SOURCES = psxtimer.c system.h ../include/pmacros.h - -dist_rtems_tests_DATA = psxtimer.scn - -include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg -include $(top_srcdir)/../automake/compile.am -include $(top_srcdir)/../automake/leaf.am - -psxtimer_exe_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel) - -AM_CPPFLAGS += -I$(top_srcdir)/include -AM_CPPFLAGS += -I$(top_srcdir)/../support/include - -LINK_OBJS = $(psxtimer_exe_OBJECTS) $(psxtimer_exe_LDADD) -LINK_LIBS = $(psxtimer_exe_LDLIBS) - -psxtimer.exe$(EXEEXT): $(psxtimer_exe_OBJECTS) $(psxtimer_exe_DEPENDENCIES) - @rm -f psxtimer.exe$(EXEEXT) - $(make-exe) - -include $(top_srcdir)/../automake/local.am diff --git a/testsuites/psxtests/psxtimer/.cvsignore b/testsuites/psxtests/psxtimer01/.cvsignore index 282522db03..282522db03 100644 --- a/testsuites/psxtests/psxtimer/.cvsignore +++ b/testsuites/psxtests/psxtimer01/.cvsignore diff --git a/testsuites/psxtests/psxtimer01/Makefile.am b/testsuites/psxtests/psxtimer01/Makefile.am new file mode 100644 index 0000000000..8e3000588d --- /dev/null +++ b/testsuites/psxtests/psxtimer01/Makefile.am @@ -0,0 +1,28 @@ +## +## $Id$ +## + +MANAGERS = all + +rtems_tests_PROGRAMS = psxtimer01.exe +psxtimer01_exe_SOURCES = psxtimer.c system.h ../include/pmacros.h + +dist_rtems_tests_DATA = psxtimer01.scn + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +psxtimer01_exe_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel) + +AM_CPPFLAGS += -I$(top_srcdir)/include +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(psxtimer01_exe_OBJECTS) $(psxtimer01_exe_LDADD) +LINK_LIBS = $(psxtimer01_exe_LDLIBS) + +psxtimer01.exe$(EXEEXT): $(psxtimer01_exe_OBJECTS) $(psxtimer01_exe_DEPENDENCIES) + @rm -f psxtimer01.exe$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/psxtests/psxtimer/psxtimer.c b/testsuites/psxtests/psxtimer01/psxtimer.c index ba79b8b266..f4d58a2d40 100644 --- a/testsuites/psxtests/psxtimer/psxtimer.c +++ b/testsuites/psxtests/psxtimer01/psxtimer.c @@ -231,7 +231,7 @@ void *POSIX_Init ( struct sched_param sch_param; /* schedule parameters */ struct periodic_params params_a, params_b, params_c; - puts( "\n\n*** POSIX Timers Test ***" ); + puts( "\n\n*** POSIX Timers Test 01 ***" ); data.updated = FALSE; data.x = 0; @@ -334,6 +334,6 @@ void *POSIX_Init ( /* execute 20 seconds and finish */ sleep (20); - puts( "\n\n*** END OF POSIX Timers Test ***" ); + puts( "*** END OF POSIX Timers Test 01 ***" ); rtems_test_exit (0); } diff --git a/testsuites/psxtests/psxtimer/psxtimer.scn b/testsuites/psxtests/psxtimer01/psxtimer01.scn index 5d9ce6ab89..75e36852fa 100644 --- a/testsuites/psxtests/psxtimer/psxtimer.scn +++ b/testsuites/psxtests/psxtimer01/psxtimer01.scn @@ -1,4 +1,4 @@ -*** POSIX Timers Test *** +*** POSIX Timers Test 01 *** Executing task A Fri Jan 1 00:00:01 1988 Executing task B with x = 1 Fri Jan 1 00:00:02 1988 Executing task A Fri Jan 1 00:00:02 1988 @@ -34,4 +34,4 @@ Executing task C with x = 9 Fri Jan 1 00:00:18 1988 Executing task A Fri Jan 1 00:00:18 1988 Executing task A Fri Jan 1 00:00:19 1988 Executing task B with x = 10 Fri Jan 1 00:00:20 1988 -*** END OF POSIX Timers Test *** +*** END OF POSIX Timers Test 01 *** diff --git a/testsuites/psxtests/psxtimer/system.h b/testsuites/psxtests/psxtimer01/system.h index 2b471f5b32..2fab0862ee 100644 --- a/testsuites/psxtests/psxtimer/system.h +++ b/testsuites/psxtests/psxtimer01/system.h @@ -7,7 +7,7 @@ * found in the file LICENSE in this distribution or at * http://www.rtems.com/license/LICENSE. * - * system.h,v 1.9 1996/08/09 18:48:33 joel Exp + * $Id} */ /* functions */ diff --git a/testsuites/psxtests/psxtimer02/.cvsignore b/testsuites/psxtests/psxtimer02/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/psxtests/psxtimer02/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/psxtests/psxtimer02/Makefile.am b/testsuites/psxtests/psxtimer02/Makefile.am new file mode 100644 index 0000000000..d3acc0aac1 --- /dev/null +++ b/testsuites/psxtests/psxtimer02/Makefile.am @@ -0,0 +1,28 @@ +## +## $Id$ +## + +MANAGERS = all + +rtems_tests_PROGRAMS = psxtimer02.exe +psxtimer02_exe_SOURCES = psxtimer.c system.h ../include/pmacros.h + +dist_rtems_tests_DATA = psxtimer02.scn + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +psxtimer02_exe_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel) + +AM_CPPFLAGS += -I$(top_srcdir)/include +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(psxtimer02_exe_OBJECTS) $(psxtimer02_exe_LDADD) +LINK_LIBS = $(psxtimer02_exe_LDLIBS) + +psxtimer02.exe$(EXEEXT): $(psxtimer02_exe_OBJECTS) $(psxtimer02_exe_DEPENDENCIES) + @rm -f psxtimer02.exe$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/psxtests/psxtimer02/psxtimer.c b/testsuites/psxtests/psxtimer02/psxtimer.c new file mode 100644 index 0000000000..330d4abbe0 --- /dev/null +++ b/testsuites/psxtests/psxtimer02/psxtimer.c @@ -0,0 +1,110 @@ +/* + * + * This is a simple real-time applications which contains 3 periodic tasks. + * + * Task A is an independent task. + * + * Task B and C share a data. + * + * Tasks are implemented as POSIX threads. + * + * The share data is protected with a POSIX mutex. + * + * Other POSIX facilities such as timers, condition, .. is also used + * + * 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$ + */ + +#define CONFIGURE_INIT +#include "system.h" +#include "tmacros.h" +#include <signal.h> /* signal facilities */ +#include <unistd.h> /* sleep facilities */ +#include <time.h> /* time facilities */ +#include <stdio.h> /* console facilities */ + +void *POSIX_Init ( + void *argument +) + +{ + struct sigevent event; + int status; + timer_t timer; + timer_t timer1; + struct itimerspec itimer; + + /* + * If these are not filled in correctly, we don't pass its error checking. + */ + event.sigev_notify = SIGEV_SIGNAL; + event.sigev_signo = SIGUSR1; + + puts( "\n\n*** POSIX Timers Test 02 ***" ); + + puts( "timer_create - bad clock id - EINVAL" ); + status = timer_create( -1, &event, &timer ); + fatal_posix_service_status_errno( status, EINVAL, "bad clock id" ); + + puts( "timer_create - bad timer id pointer - EINVAL" ); + status = timer_create( CLOCK_REALTIME, &event, NULL ); + fatal_posix_service_status_errno( status, EINVAL, "bad timer id" ); + + puts( "timer_create - OK" ); + status = timer_create( CLOCK_REALTIME, NULL, &timer ); + posix_service_failed( status, "timer_create OK" ); + + puts( "timer_create - too many - EAGAIN" ); + status = timer_create( CLOCK_REALTIME, NULL, &timer1 ); + fatal_posix_service_status_errno( status, EAGAIN, "too many" ); + + puts( "timer_delete - bad id - EINVAL" ); + status = timer_delete( timer1 + 1 ); + fatal_posix_service_status_errno( status, EINVAL, "bad id" ); + + puts( "timer_getoverrun - bad id - EINVAL" ); + status = timer_getoverrun( timer1 + 1 ); + fatal_posix_service_status_errno( status, EINVAL, "bad id" ); + + puts( "timer_gettime - bad itimer - EINVAL" ); + status = timer_gettime( timer1, NULL ); + fatal_posix_service_status_errno( status, EINVAL, "bad id" ); + + puts( "timer_gettime - bad id - EINVAL" ); + status = timer_gettime( timer1 + 1, &itimer ); + fatal_posix_service_status_errno( status, EINVAL, "bad id" ); + + puts( "timer_settime - bad itimer pointer - EINVAL" ); + status = timer_settime( timer, TIMER_ABSTIME, &itimer, NULL ); + fatal_posix_service_status_errno( status, EINVAL, "bad itimer pointer" ); + + itimer.it_value.tv_nsec = 2000000000; + puts( "timer_settime - bad itimer value - too many nanosecond - EINVAL" ); + status = timer_settime( timer, TIMER_ABSTIME, &itimer, NULL ); + fatal_posix_service_status_errno( status, EINVAL, "bad itimer value #1" ); + + itimer.it_value.tv_nsec = -1; + puts( "timer_settime - bad itimer value - negative nanosecond - EINVAL" ); + status = timer_settime( timer, TIMER_ABSTIME, &itimer, NULL ); + fatal_posix_service_status_errno( status, EINVAL, "bad itimer value #2" ); + + itimer.it_value.tv_nsec = 0; + puts( "timer_settime - bad clock value - EINVAL" ); + status = timer_settime( timer, 0x80, &itimer, NULL ); + fatal_posix_service_status_errno( status, EINVAL, "bad clock value" ); + + puts( "timer_delete - OK" ); + status = timer_delete( timer ); + posix_service_failed( status, "timer_delete OK" ); + + puts( "timer_delete - bad id - EINVAL" ); + status = timer_delete( timer ); + fatal_posix_service_status_errno( status, EINVAL, "bad id" ); + + puts( "*** END OF POSIX Timers Test 02 ***" ); + rtems_test_exit (0); +} diff --git a/testsuites/psxtests/psxtimer02/psxtimer02.scn b/testsuites/psxtests/psxtimer02/psxtimer02.scn new file mode 100644 index 0000000000..e78425a32e --- /dev/null +++ b/testsuites/psxtests/psxtimer02/psxtimer02.scn @@ -0,0 +1,16 @@ +*** POSIX Timers Test 02 *** +timer_create - bad clock id - EINVAL +timer_create - bad timer id pointer - EINVAL +timer_create - OK +timer_create - too many - EAGAIN +timer_delete - bad id - EINVAL +timer_getoverrun - bad id - EINVAL +timer_gettime - bad itimer - EINVAL +timer_gettime - bad id - EINVAL +timer_settime - bad itimer pointer - EINVAL +timer_settime - bad itimer value - too many nanosecond - EINVAL +timer_settime - bad itimer value - negative nanosecond - EINVAL +timer_settime - bad clock value - EINVAL +timer_delete - OK +timer_delete - bad id - EINVAL +*** END OF POSIX Timers Test 02 *** diff --git a/testsuites/psxtests/psxtimer02/system.h b/testsuites/psxtests/psxtimer02/system.h new file mode 100644 index 0000000000..5f18d521ca --- /dev/null +++ b/testsuites/psxtests/psxtimer02/system.h @@ -0,0 +1,37 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * 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$ + */ + +/* functions */ + +#include <pmacros.h> +#include <unistd.h> +#include <errno.h> +#include <sched.h> + +void *POSIX_Init ( + void *arg +); + +/* configuration information */ + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_MAXIMUM_POSIX_THREADS 1 +#define CONFIGURE_MAXIMUM_POSIX_TIMERS 1 + + +#include <rtems/confdefs.h> + +/* end of include file */ |