summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-11-12 00:21:51 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-11-12 00:21:51 +0000
commitea7d86b2450f3d4587e13c21b900ad10211aed60 (patch)
treed7068175de1b77342af1ca747f109ba76bd61501 /testsuites
parent2009-11-11 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff)
downloadrtems-ea7d86b2450f3d4587e13c21b900ad10211aed60.tar.bz2
2009-11-11 Joel Sherrill <joel.sherrill@oarcorp.com>
PR 1466/tests * Makefile.am, configure.ac, psxclock/init.c, psxclock/psxclock.doc, psxclock/psxclock.scn, psxkey03/init.c, psxsignal02/init.c, psxsignal03/init.c, psxstack01/init.c: Remove usleep() from tests. Add test specifically to test it since it is deprecated as of POSIX.1-2008. * psxusleep/.cvsignore, psxusleep/Makefile.am, psxusleep/init.c, psxusleep/psxusleep.doc, psxusleep/psxusleep.scn: New files.
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/psxtests/ChangeLog11
-rw-r--r--testsuites/psxtests/Makefile.am2
-rw-r--r--testsuites/psxtests/configure.ac1
-rw-r--r--testsuites/psxtests/psxclock/init.c10
-rw-r--r--testsuites/psxtests/psxclock/psxclock.doc1
-rw-r--r--testsuites/psxtests/psxclock/psxclock.scn2
-rw-r--r--testsuites/psxtests/psxkey03/init.c13
-rw-r--r--testsuites/psxtests/psxsignal02/init.c6
-rw-r--r--testsuites/psxtests/psxsignal03/init.c9
-rw-r--r--testsuites/psxtests/psxstack01/init.c6
-rw-r--r--testsuites/psxtests/psxusleep/.cvsignore2
-rw-r--r--testsuites/psxtests/psxusleep/Makefile.am29
-rw-r--r--testsuites/psxtests/psxusleep/init.c68
-rw-r--r--testsuites/psxtests/psxusleep/psxusleep.doc24
-rw-r--r--testsuites/psxtests/psxusleep/psxusleep.scn7
15 files changed, 176 insertions, 15 deletions
diff --git a/testsuites/psxtests/ChangeLog b/testsuites/psxtests/ChangeLog
index d6051f4959..51b13f161a 100644
--- a/testsuites/psxtests/ChangeLog
+++ b/testsuites/psxtests/ChangeLog
@@ -1,3 +1,14 @@
+2009-11-11 Joel Sherrill <joel.sherrill@oarcorp.com>
+
+ PR 1466/tests
+ * Makefile.am, configure.ac, psxclock/init.c, psxclock/psxclock.doc,
+ psxclock/psxclock.scn, psxkey03/init.c, psxsignal02/init.c,
+ psxsignal03/init.c, psxstack01/init.c: Remove usleep() from tests.
+ Add test specifically to test it since it is deprecated as of
+ POSIX.1-2008.
+ * psxusleep/.cvsignore, psxusleep/Makefile.am, psxusleep/init.c,
+ psxusleep/psxusleep.doc, psxusleep/psxusleep.scn: New files.
+
2009-11-09 Joel Sherrill <joel.sherrill@oarcorp.com>
* psxcancel01/init.c: Initialize start time.
diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index 9b37902371..9847d72f57 100644
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -14,7 +14,7 @@ SUBDIRS += psxhdrs psx01 psx02 psx03 psx04 psx05 psx06 psx07 psx08 psx09 \
psxkey03 psxitimer psxmsgq01 psxmsgq02 psxmsgq03 psxmsgq04 \
psxmutexattr01 psxobj01 psxrwlock01 psxsem01 psxsignal01 psxsignal02 \
psxsignal03 psxsignal04 psxsignal05 psxspin01 psxspin02 psxsysconf \
- psxtime psxtimer01 psxtimer02 psxualarm psxfatal01 psxfatal02 \
+ psxtime psxtimer01 psxtimer02 psxualarm psxusleep psxfatal01 psxfatal02 \
psxintrcritical01 psxstack01
endif
diff --git a/testsuites/psxtests/configure.ac b/testsuites/psxtests/configure.ac
index c77e9b67c3..f536844258 100644
--- a/testsuites/psxtests/configure.ac
+++ b/testsuites/psxtests/configure.ac
@@ -115,5 +115,6 @@ psxtime/Makefile
psxtimer01/Makefile
psxtimer02/Makefile
psxualarm/Makefile
+psxusleep/Makefile
])
AC_OUTPUT
diff --git a/testsuites/psxtests/psxclock/init.c b/testsuites/psxtests/psxclock/init.c
index 41fd228875..1930bfa073 100644
--- a/testsuites/psxtests/psxclock/init.c
+++ b/testsuites/psxtests/psxclock/init.c
@@ -34,7 +34,7 @@ rtems_task Init(
time_t seconds1;
unsigned int remaining;
struct tm tm;
- useconds_t useconds;
+ struct timespec delay_request;
puts( "\n\n*** POSIX CLOCK TEST ***" );
@@ -206,9 +206,11 @@ rtems_task Init(
printf( "Init: sec (%ld), nsec (%ld) remaining\n", tr.tv_sec, tr.tv_nsec );
rtems_test_assert( !tr.tv_sec && !tr.tv_nsec );
- puts( "Init: usleep - 1.35 seconds" );
- useconds = usleep ( 1350000 );
- rtems_test_assert( useconds < 1350000 );
+ puts( "Init: nanosleep - 1.35 seconds" );
+ delay_request.tv_sec = 1;
+ delay_request.tv_nsec = 35000000;
+ sc = nanosleep( &delay_request, NULL );
+ assert( !sc );
/* print the current real time again */
sc = clock_gettime( CLOCK_REALTIME, &tv );
diff --git a/testsuites/psxtests/psxclock/psxclock.doc b/testsuites/psxtests/psxclock/psxclock.doc
index 8bb4c5e6c3..5ea9e0b4d4 100644
--- a/testsuites/psxtests/psxclock/psxclock.doc
+++ b/testsuites/psxtests/psxclock/psxclock.doc
@@ -17,7 +17,6 @@ directives:
clock_settime
clock_gettime
nanosleep
- usleep
sleep
concepts:
diff --git a/testsuites/psxtests/psxclock/psxclock.scn b/testsuites/psxtests/psxclock/psxclock.scn
index 1144faa726..afd449dd21 100644
--- a/testsuites/psxtests/psxclock/psxclock.scn
+++ b/testsuites/psxtests/psxclock/psxclock.scn
@@ -28,7 +28,7 @@ Init: nanosleep - yield with NULL time remaining
Init: nanosleep - 1.05 seconds
Fri May 24 11:05:06 1996
Init: sec (0), nsec (0) remaining
-Init: usleep - 1.35 seconds
+Init: nanosleep - 1.35 seconds
Fri May 24 11:05:07 1996
clock_gettime - CLOCK_THREAD_CPUTIME -- ENOSYS
clock_settime - CLOCK_PROCESS_CPUTIME -- ENOSYS
diff --git a/testsuites/psxtests/psxkey03/init.c b/testsuites/psxtests/psxkey03/init.c
index 70de64a9ca..02d45da610 100644
--- a/testsuites/psxtests/psxkey03/init.c
+++ b/testsuites/psxtests/psxkey03/init.c
@@ -40,8 +40,9 @@ void *POSIX_Init(
void *ignored
)
{
- pthread_t thread;
- int sc;
+ pthread_t thread;
+ int sc;
+ struct timespec delay_request;
puts( "\n\n*** TEST KEY 03 ***" );
@@ -57,7 +58,10 @@ void *POSIX_Init(
assert( !sc );
puts( "Init - sleep - let thread run - OK" );
- usleep(500000);
+ delay_request.tv_sec = 0;
+ delay_request.tv_nsec = 5 * 100000000;
+ sc = nanosleep( &delay_request, NULL );
+ assert( !sc );
puts( "Init - pthread_key_delete - OK" );
sc = pthread_key_delete( Key );
@@ -76,7 +80,8 @@ void *POSIX_Init(
assert( !sc );
puts( "Init - sleep - let thread run - OK" );
- usleep(500000);
+ sc = nanosleep( &delay_request, NULL );
+ assert( !sc );
puts( "Init - verify destructor did NOT ran" );
assert( destructor_ran == false );
diff --git a/testsuites/psxtests/psxsignal02/init.c b/testsuites/psxtests/psxsignal02/init.c
index 8e22db4e5e..ee58a16a15 100644
--- a/testsuites/psxtests/psxsignal02/init.c
+++ b/testsuites/psxtests/psxsignal02/init.c
@@ -125,6 +125,7 @@ void *POSIX_Init(
struct sched_param param;
Test_t *test;
struct sigaction act;
+ struct timespec delay_request;
puts( "\n\n*** POSIX TEST SIGNAL 02 ***" );
@@ -161,7 +162,10 @@ void *POSIX_Init(
assert( !sc );
puts( "Init - sleep - let thread settle - OK" );
- usleep(500000);
+ delay_request.tv_sec = 0;
+ delay_request.tv_nsec = 50000000;
+ sc = nanosleep( &delay_request, NULL );
+ assert( !sc );
}
puts( "Init - sending SIGUSR1" );
diff --git a/testsuites/psxtests/psxsignal03/init.c b/testsuites/psxtests/psxsignal03/init.c
index d6f2e8b4e7..38b69ce8dc 100644
--- a/testsuites/psxtests/psxsignal03/init.c
+++ b/testsuites/psxtests/psxsignal03/init.c
@@ -148,6 +148,7 @@ void *POSIX_Init(
struct sigaction act;
bool trueArg = true;
bool falseArg = false;
+ struct timespec delay_request;
puts( "\n\n*** POSIX TEST SIGNAL " TEST_NAME " ***" );
puts( "Init - Variation is: " TEST_STRING );
@@ -168,10 +169,14 @@ void *POSIX_Init(
assert( !sc );
puts( "Init - sleep - let threads settle - OK" );
- usleep(500000);
+ delay_request.tv_sec = 0;
+ delay_request.tv_nsec = 5 * 100000000;
+ sc = nanosleep( &delay_request, NULL );
+ assert( !sc );
puts( "Init - sleep - SignalBlocked thread settle - OK" );
- usleep(500000);
+ sc = nanosleep( &delay_request, NULL );
+ assert( !sc );
printf( "Init - sending %s - deliver to one thread\n",
signal_name(SIGNAL_TWO));
diff --git a/testsuites/psxtests/psxstack01/init.c b/testsuites/psxtests/psxstack01/init.c
index 70a4b65949..6866f286ec 100644
--- a/testsuites/psxtests/psxstack01/init.c
+++ b/testsuites/psxtests/psxstack01/init.c
@@ -49,6 +49,7 @@ void *POSIX_Init(
int sc;
pthread_t id;
pthread_attr_t attr;
+ struct timespec delay_request;
puts( "\n\n*** POSIX STACK ATTRIBUTE TEST 01 ***" );
@@ -72,7 +73,10 @@ void *POSIX_Init(
assert( !sc );
puts( "Init - let other thread run" );
- usleep( 500000 );
+ delay_request.tv_sec = 0;
+ delay_request.tv_nsec = 5 * 100000000;
+ sc = nanosleep( &delay_request, NULL );
+ assert( !sc );
puts( "*** END OF POSIX STACK ATTRIBUTE TEST 01 ***" );
rtems_test_exit(0);
diff --git a/testsuites/psxtests/psxusleep/.cvsignore b/testsuites/psxtests/psxusleep/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/testsuites/psxtests/psxusleep/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/testsuites/psxtests/psxusleep/Makefile.am b/testsuites/psxtests/psxusleep/Makefile.am
new file mode 100644
index 0000000000..7bd1ecf19a
--- /dev/null
+++ b/testsuites/psxtests/psxusleep/Makefile.am
@@ -0,0 +1,29 @@
+##
+## $Id$
+##
+
+MANAGERS = all
+
+rtems_tests_PROGRAMS = psxusleep
+psxusleep_SOURCES = init.c ../include/pmacros.h
+
+dist_rtems_tests_DATA = psxusleep.scn
+dist_rtems_tests_DATA += psxusleep.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+psxusleep_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
+
+AM_CPPFLAGS += -I$(top_srcdir)/include
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(psxusleep_OBJECTS) $(psxusleep_LDADD)
+LINK_LIBS = $(psxusleep_LDLIBS)
+
+psxusleep$(EXEEXT): $(psxusleep_OBJECTS) $(psxusleep_DEPENDENCIES)
+ @rm -f psxusleep$(EXEEXT)
+ $(make-exe)
+
+include $(top_srcdir)/../automake/local.am
diff --git a/testsuites/psxtests/psxusleep/init.c b/testsuites/psxtests/psxusleep/init.c
new file mode 100644
index 0000000000..077dfb84d7
--- /dev/null
+++ b/testsuites/psxtests/psxusleep/init.c
@@ -0,0 +1,68 @@
+/*
+ * 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 <time.h>
+#include <errno.h>
+
+rtems_task Init(
+ rtems_task_argument argument
+)
+{
+ struct tm tm;
+ struct timespec tv;
+ useconds_t remaining;
+ int sc;
+
+ puts( "\n\n*** POSIX USLEEP TEST ***" );
+
+ tm_build_time( &tm, TM_FRIDAY, TM_MAY, 24, 96, 11, 5, 0 );
+
+ /* set the time of day, and print our buffer in multiple ways */
+
+ tv.tv_nsec = 0;
+ tv.tv_sec = mktime( &tm );
+ rtems_test_assert( tv.tv_sec != -1 );
+
+ /* now set the time of day */
+
+ printf( asctime( &tm ) );
+ puts( "Init: clock_settime - SUCCESSFUL" );
+ sc = clock_settime( CLOCK_REALTIME, &tv );
+ rtems_test_assert( !sc );
+
+ printf( asctime( &tm ) );
+ printf( ctime( &tv.tv_sec ) );
+
+ /* use sleep to delay */
+
+ remaining = usleep( 3 * 1000000 );
+ rtems_test_assert( !remaining );
+
+ sc = clock_gettime( CLOCK_REALTIME, &tv );
+ rtems_test_assert( !sc );
+
+ printf( ctime( &tv.tv_sec ) );
+
+ puts( "*** END OF POSIX USLEEP TEST ***" );
+ rtems_test_exit(0);
+}
+
+
+/* configuration information */
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+#define CONFIGURE_MAXIMUM_TASKS 1
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
diff --git a/testsuites/psxtests/psxusleep/psxusleep.doc b/testsuites/psxtests/psxusleep/psxusleep.doc
new file mode 100644
index 0000000000..6145bf5f3b
--- /dev/null
+++ b/testsuites/psxtests/psxusleep/psxusleep.doc
@@ -0,0 +1,24 @@
+#
+# $Id$
+#
+# 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.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: psxusleep
+
+directives:
+ usleep
+
+concepts:
+
++ This test exercises the usleep() method.
+
+NOTE: usleep() has been deprecated by Open Group. This is why usleep is not
+ used in any other test and why this test exists.
diff --git a/testsuites/psxtests/psxusleep/psxusleep.scn b/testsuites/psxtests/psxusleep/psxusleep.scn
new file mode 100644
index 0000000000..33e1981028
--- /dev/null
+++ b/testsuites/psxtests/psxusleep/psxusleep.scn
@@ -0,0 +1,7 @@
+*** POSIX USLEEP TEST ***
+Fri May 24 11:05:00 1996
+Init: clock_settime - SUCCESSFUL
+Fri May 24 11:05:00 1996
+Fri May 24 11:05:00 1996
+Fri May 24 11:05:03 1996
+*** END OF POSIX USLEEP TEST ***