From ea7d86b2450f3d4587e13c21b900ad10211aed60 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 12 Nov 2009 00:21:51 +0000 Subject: 2009-11-11 Joel Sherrill 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. --- testsuites/psxtests/psxusleep/.cvsignore | 2 + testsuites/psxtests/psxusleep/Makefile.am | 29 ++++++++++++ testsuites/psxtests/psxusleep/init.c | 68 +++++++++++++++++++++++++++++ testsuites/psxtests/psxusleep/psxusleep.doc | 24 ++++++++++ testsuites/psxtests/psxusleep/psxusleep.scn | 7 +++ 5 files changed, 130 insertions(+) create mode 100644 testsuites/psxtests/psxusleep/.cvsignore create mode 100644 testsuites/psxtests/psxusleep/Makefile.am create mode 100644 testsuites/psxtests/psxusleep/init.c create mode 100644 testsuites/psxtests/psxusleep/psxusleep.doc create mode 100644 testsuites/psxtests/psxusleep/psxusleep.scn (limited to 'testsuites/psxtests/psxusleep') 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 +#include +#include + +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 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 *** -- cgit v1.2.3