summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1998-11-23 18:58:48 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1998-11-23 18:58:48 +0000
commitcd3fb80a263a5d998c8386141fad2d6b42a6224a (patch)
tree4c1423a6a58c6a7138030bc215f7de1c05046fb4
parent0895bdb89c1674d01ecb9886a0624096ef939ad1 (diff)
downloadrtems-cd3fb80a263a5d998c8386141fad2d6b42a6224a.tar.bz2
Added new tests in support of the file system infrastructure.
-rw-r--r--c/src/tests/psxtests/psxtime/Makefile.in63
-rw-r--r--c/src/tests/psxtests/psxtime/main.c40
-rw-r--r--c/src/tests/psxtests/psxtime/psxtime.scn0
-rw-r--r--c/src/tests/psxtests/psxtime/test.c115
-rw-r--r--testsuites/psxtests/psxtime/main.c40
-rw-r--r--testsuites/psxtests/psxtime/psxtime.scn0
-rw-r--r--testsuites/psxtests/psxtime/test.c115
7 files changed, 373 insertions, 0 deletions
diff --git a/c/src/tests/psxtests/psxtime/Makefile.in b/c/src/tests/psxtests/psxtime/Makefile.in
new file mode 100644
index 0000000000..7aa1922836
--- /dev/null
+++ b/c/src/tests/psxtests/psxtime/Makefile.in
@@ -0,0 +1,63 @@
+#
+# $Id$
+#
+
+@SET_MAKE@
+srcdir = @srcdir@
+VPATH = @srcdir@
+RTEMS_ROOT = @top_srcdir@
+PROJECT_ROOT = @PROJECT_ROOT@
+
+TEST=psxtime
+
+MANAGERS=all
+
+# C source names, if any, go here -- minus the .c
+C_PIECES=main test
+C_FILES=$(C_PIECES:%=%.c)
+C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
+
+H_FILES=
+
+DOCTYPES=scn
+DOCS=$(DOCTYPES:%=$(TEST).%)
+
+SRCS=$(DOCS) $(C_FILES) $(H_FILES)
+OBJS=$(C_O_FILES)
+
+PRINT_SRCS=$(DOCS)
+
+PGM=${ARCH}/$(TEST).exe
+
+include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg
+include $(RTEMS_ROOT)/make/leaf.cfg
+
+#
+# (OPTIONAL) Add local stuff here using +=
+#
+
+DEFINES +=
+CPPFLAGS +=
+CFLAGS +=
+
+LD_PATHS +=
+LD_LIBS +=
+LDFLAGS +=
+
+#
+# Add your list of files to delete here. The config files
+# already know how to delete some stuff, so you may want
+# to just run 'make clean' first to see what gets missed.
+# 'make clobber' already includes 'make clean'
+#
+
+CLEAN_ADDITIONS +=
+CLOBBER_ADDITIONS +=
+
+all: ${ARCH} $(SRCS) $(PGM)
+ $(INSTALL_VARIANT) -m 555 ${PGM} ${PROJECT_RELEASE}/tests
+ $(INSTALL) $(srcdir)/$(TEST).scn \
+ ${PROJECT_RELEASE}/tests/screens/psxtests/$(TEST).scn
+
+${PGM}: $(OBJS) $(LINK_FILES)
+ $(make-exe)
diff --git a/c/src/tests/psxtests/psxtime/main.c b/c/src/tests/psxtests/psxtime/main.c
new file mode 100644
index 0000000000..37658f4feb
--- /dev/null
+++ b/c/src/tests/psxtests/psxtime/main.c
@@ -0,0 +1,40 @@
+/*
+ * Simple test program -- simplified version of sample test hello.
+ *
+ * COPYRIGHT (c) 1989-1998.
+ * On-Line Applications Research Corporation (OAR).
+ * Copyright assigned to U.S. Government, 1994.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+
+#include <bsp.h>
+
+void test_main( void );
+
+rtems_task Init(
+ rtems_task_argument ignored
+)
+{
+ test_main();
+ exit( 0 );
+}
+
+/* configuration information */
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+
+#include <confdefs.h>
+
+/* end of file */
diff --git a/c/src/tests/psxtests/psxtime/psxtime.scn b/c/src/tests/psxtests/psxtime/psxtime.scn
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/c/src/tests/psxtests/psxtime/psxtime.scn
diff --git a/c/src/tests/psxtests/psxtime/test.c b/c/src/tests/psxtests/psxtime/test.c
new file mode 100644
index 0000000000..8ce431145d
--- /dev/null
+++ b/c/src/tests/psxtests/psxtime/test.c
@@ -0,0 +1,115 @@
+/*
+ * This test exercises the time of day services via the Classic
+ * and POSIX APIs to make sure they are consistent.
+ *
+ * COPYRIGHT (c) 1989-1998.
+ * On-Line Applications Research Corporation (OAR).
+ * Copyright assigned to U.S. Government, 1994.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+#include <assert.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <rtems.h>
+#include <rtems/libio.h>
+
+/*
+ * List of dates and times to test.
+ */
+#define NUMBER_OF_DATES 7
+rtems_time_of_day Dates[ NUMBER_OF_DATES ] = {
+ /* YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, TICKS */
+ { 1988, 1, 1, 12, 45, 00, 0 },
+ { 1988, 12, 31, 9, 00, 00, 0 },
+ { 1999, 12, 31, 23, 55, 59, 0 },
+ { 1999, 06, 30, 00, 01, 30, 0 },
+ { 2000, 1, 1, 0, 15, 59, 0 },
+ { 2005, 2, 2, 5, 10, 59, 0 },
+ { 2010, 3, 3, 10, 5, 59, 0 },
+ { 2020, 4, 4, 15, 0, 59, 0 },
+};
+
+/*
+ * Check out a single date and time
+ */
+
+void check_a_tod(
+ rtems_time_of_day *the_tod
+)
+{
+ rtems_status_code status;
+ rtems_time_of_day new_tod;
+ time_t a_time_t;
+ struct timeval tv;
+ struct tm *a_tm;
+ int result;
+ int i = 0;
+
+ print_time( "rtems_clock_set ", the_tod, "\n" );
+ status = rtems_clock_set( the_tod );
+ assert( !status );
+
+ do {
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &new_tod );
+ assert( !status );
+ print_time( "rtems_clock_get ", &new_tod, "\n" );
+
+ /* now do the posix time gets */
+ result = gettimeofday( &tv, 0 );
+ assert( result == 0 );
+ printf( "gettimeofday: %s", ctime( &tv.tv_sec ) );
+
+ a_time_t = time( 0 );
+ printf( "time: %s", ctime( &a_time_t ) );
+
+ a_tm = localtime( &a_time_t );
+ printf( "localtime: %s", asctime( a_tm ) );
+
+ a_tm = gmtime( &a_time_t );
+ printf( "gmtime: %s\n", asctime( a_tm ) );
+
+ status = rtems_task_wake_after( 5 * TICKS_PER_SECOND );
+
+ i++;
+
+ } while( i < 6 );
+}
+
+/*
+ * main entry point to the test
+ */
+
+#if defined(__rtems__)
+int test_main(void)
+#else
+int main(
+ int argc,
+ char **argv
+)
+#endif
+{
+ int i;
+
+ puts( "\n\n*** POSIX TIME OF DAY TEST ***" );
+
+ i = 0;
+ while ( i < NUMBER_OF_DATES ) {
+ check_a_tod( &Dates[i] );
+ i++;
+ }
+
+ puts( "\n\n*** END OF TIME OF DAY TEST 01 ***" );
+ exit(0);
+}
+
diff --git a/testsuites/psxtests/psxtime/main.c b/testsuites/psxtests/psxtime/main.c
new file mode 100644
index 0000000000..37658f4feb
--- /dev/null
+++ b/testsuites/psxtests/psxtime/main.c
@@ -0,0 +1,40 @@
+/*
+ * Simple test program -- simplified version of sample test hello.
+ *
+ * COPYRIGHT (c) 1989-1998.
+ * On-Line Applications Research Corporation (OAR).
+ * Copyright assigned to U.S. Government, 1994.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#define TEST_INIT
+
+#include <bsp.h>
+
+void test_main( void );
+
+rtems_task Init(
+ rtems_task_argument ignored
+)
+{
+ test_main();
+ exit( 0 );
+}
+
+/* configuration information */
+
+#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+
+#include <confdefs.h>
+
+/* end of file */
diff --git a/testsuites/psxtests/psxtime/psxtime.scn b/testsuites/psxtests/psxtime/psxtime.scn
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/testsuites/psxtests/psxtime/psxtime.scn
diff --git a/testsuites/psxtests/psxtime/test.c b/testsuites/psxtests/psxtime/test.c
new file mode 100644
index 0000000000..8ce431145d
--- /dev/null
+++ b/testsuites/psxtests/psxtime/test.c
@@ -0,0 +1,115 @@
+/*
+ * This test exercises the time of day services via the Classic
+ * and POSIX APIs to make sure they are consistent.
+ *
+ * COPYRIGHT (c) 1989-1998.
+ * On-Line Applications Research Corporation (OAR).
+ * Copyright assigned to U.S. Government, 1994.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.OARcorp.com/rtems/license.html.
+ *
+ * $Id$
+ */
+
+#include <tmacros.h>
+#include <assert.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <rtems.h>
+#include <rtems/libio.h>
+
+/*
+ * List of dates and times to test.
+ */
+#define NUMBER_OF_DATES 7
+rtems_time_of_day Dates[ NUMBER_OF_DATES ] = {
+ /* YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, TICKS */
+ { 1988, 1, 1, 12, 45, 00, 0 },
+ { 1988, 12, 31, 9, 00, 00, 0 },
+ { 1999, 12, 31, 23, 55, 59, 0 },
+ { 1999, 06, 30, 00, 01, 30, 0 },
+ { 2000, 1, 1, 0, 15, 59, 0 },
+ { 2005, 2, 2, 5, 10, 59, 0 },
+ { 2010, 3, 3, 10, 5, 59, 0 },
+ { 2020, 4, 4, 15, 0, 59, 0 },
+};
+
+/*
+ * Check out a single date and time
+ */
+
+void check_a_tod(
+ rtems_time_of_day *the_tod
+)
+{
+ rtems_status_code status;
+ rtems_time_of_day new_tod;
+ time_t a_time_t;
+ struct timeval tv;
+ struct tm *a_tm;
+ int result;
+ int i = 0;
+
+ print_time( "rtems_clock_set ", the_tod, "\n" );
+ status = rtems_clock_set( the_tod );
+ assert( !status );
+
+ do {
+ status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &new_tod );
+ assert( !status );
+ print_time( "rtems_clock_get ", &new_tod, "\n" );
+
+ /* now do the posix time gets */
+ result = gettimeofday( &tv, 0 );
+ assert( result == 0 );
+ printf( "gettimeofday: %s", ctime( &tv.tv_sec ) );
+
+ a_time_t = time( 0 );
+ printf( "time: %s", ctime( &a_time_t ) );
+
+ a_tm = localtime( &a_time_t );
+ printf( "localtime: %s", asctime( a_tm ) );
+
+ a_tm = gmtime( &a_time_t );
+ printf( "gmtime: %s\n", asctime( a_tm ) );
+
+ status = rtems_task_wake_after( 5 * TICKS_PER_SECOND );
+
+ i++;
+
+ } while( i < 6 );
+}
+
+/*
+ * main entry point to the test
+ */
+
+#if defined(__rtems__)
+int test_main(void)
+#else
+int main(
+ int argc,
+ char **argv
+)
+#endif
+{
+ int i;
+
+ puts( "\n\n*** POSIX TIME OF DAY TEST ***" );
+
+ i = 0;
+ while ( i < NUMBER_OF_DATES ) {
+ check_a_tod( &Dates[i] );
+ i++;
+ }
+
+ puts( "\n\n*** END OF TIME OF DAY TEST 01 ***" );
+ exit(0);
+}
+