From 71cb49560fe4f8c72282641aa46b41b6308b82b1 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 20 Dec 2012 14:17:17 -0600 Subject: psxtmtest_init_destroy: Add new test template --- .../psxtmtest_init_destroy/Makefile.am | 27 +++++++ .../psxtmtest_init_destroy/TEST.doc | 13 +++ rtems-test-template/psxtmtest_init_destroy/init.c | 94 ++++++++++++++++++++++ 3 files changed, 134 insertions(+) create mode 100644 rtems-test-template/psxtmtest_init_destroy/Makefile.am create mode 100644 rtems-test-template/psxtmtest_init_destroy/TEST.doc create mode 100644 rtems-test-template/psxtmtest_init_destroy/init.c diff --git a/rtems-test-template/psxtmtest_init_destroy/Makefile.am b/rtems-test-template/psxtmtest_init_destroy/Makefile.am new file mode 100644 index 0000000..ec853b3 --- /dev/null +++ b/rtems-test-template/psxtmtest_init_destroy/Makefile.am @@ -0,0 +1,27 @@ +MANAGERS = all + +rtems_tests_PROGRAMS = @LOWER@ +@LOWER@_SOURCES = init.c +@LOWER@_SOURCES += ../../tmtests/include/timesys.h +@LOWER@_SOURCES += ../../support/src/tmtests_empty_function.c +@LOWER@_SOURCES += ../../support/src/tmtests_support.c + +dist_rtems_tests_DATA = @LOWER@.doc + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +OPERATION_COUNT = @OPERATION_COUNT@ +AM_CPPFLAGS += -I$(top_srcdir)/../tmtests/include +AM_CPPFLAGS += -DOPERATION_COUNT=$(OPERATION_COUNT) +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(@LOWER@_OBJECTS) $(@LOWER@_LDADD) +LINK_LIBS = $(@LOWER@_LDLIBS) + +@LOWER@$(EXEEXT): $(@LOWER@_OBJECTS) $(@LOWER@_DEPENDENCIES) + @rm -f @LOWER@$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/rtems-test-template/psxtmtest_init_destroy/TEST.doc b/rtems-test-template/psxtmtest_init_destroy/TEST.doc new file mode 100644 index 0000000..e2e56e8 --- /dev/null +++ b/rtems-test-template/psxtmtest_init_destroy/TEST.doc @@ -0,0 +1,13 @@ +# COPYRIGHT (c) 1989-2012. +# 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 test benchmarks the following operations: + ++ @DESC@ ++ @DESC@ ++ XXX Fix above diff --git a/rtems-test-template/psxtmtest_init_destroy/init.c b/rtems-test-template/psxtmtest_init_destroy/init.c new file mode 100644 index 0000000..a98c3ce --- /dev/null +++ b/rtems-test-template/psxtmtest_init_destroy/init.c @@ -0,0 +1,94 @@ +/* + * COPYRIGHT (c) 1989-2012. + * 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include "test_support.h" + +/* forward declarations to avoid warnings */ +void *POSIX_Init(void *argument); +void benchmark_NAME_OF_CREATE_OPERATION(void); +void benchmark_NAME_OF_DELETE_OPERATION(void); + +void benchmark_NAME_OF_CREATE_OPERATION(void) +{ + long end_time; + int status; + + benchmark_timer_initialize(); + /* XXX single shot CREATE operation goes here -- test expected status */ + /* XXX outside of the benchmark'ed region */ + end_time = benchmark_timer_read(); + rtems_test_assert( status == 0 ); + + put_time( + "@DESC@", /* XXX fix to indicate create name */ + end_time, + 1, /* Only executed once */ + 0, + 0 + ); + +} + +void benchmark_NAME_OF_DELETE_OPERATION(void) +{ + long end_time; + int status; + + benchmark_timer_initialize(); + /* XXX single shot operation goes here -- test expected status outside */ + /* XXX of the benchmark'ed region */ + end_time = benchmark_timer_read(); + rtems_test_assert( status == 0 ); + + put_time( + "@DESC@", /* XXX fix to indicate delete name */ + end_time, + 1, /* Only executed once */ + 0, + 0 + ); + +} + +void *POSIX_Init( + void *argument +) +{ + + puts( "\n\n*** POSIX TIME TEST @UPPER@ ***" ); + + /* XXX any required initialization goes here */ + + benchmark_NAME_OF_CREATE_OPERATION(); + benchmark_NAME_OF_DELETE_OPERATION(); + + puts( "*** END OF POSIX TIME TEST @UPPER@ ***" ); + rtems_test_exit(0); +} + +/* configuration information */ + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER + +/* XXX configure an instance of the object created/destroyed */ + +#define CONFIGURE_MAXIMUM_POSIX_THREADS 1 +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_INIT + +#include +/* end of file */ -- cgit v1.2.3