[rtems-testing commit] psxtmtest_init_destroy: Add new test template

Joel Sherrill joel at rtems.org
Thu Dec 20 20:13:44 UTC 2012


Module:    rtems-testing
Branch:    master
Commit:    71cb49560fe4f8c72282641aa46b41b6308b82b1
Changeset: http://git.rtems.org/rtems-testing/commit/?id=71cb49560fe4f8c72282641aa46b41b6308b82b1

Author:    Joel Sherrill <joel.sherrill at oarcorp.com>
Date:      Thu Dec 20 14:17:17 2012 -0600

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(+), 0 deletions(-)

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@
+ at LOWER@_SOURCES  = init.c
+ at LOWER@_SOURCES += ../../tmtests/include/timesys.h
+ at LOWER@_SOURCES += ../../support/src/tmtests_empty_function.c
+ at LOWER@_SOURCES += ../../support/src/tmtests_support.c
+
+dist_rtems_tests_DATA = @LOWER at .doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .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 at _OBJECTS) $(@LOWER at _LDADD)
+LINK_LIBS = $(@LOWER at _LDLIBS)
+
+ at LOWER@$(EXEEXT): $(@LOWER at _OBJECTS) $(@LOWER at _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 <timesys.h>
+#include <rtems/timerdrv.h>
+#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 <rtems/confdefs.h>
+/* end of file */




More information about the vc mailing list