diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-07-20 20:48:26 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-07-20 20:48:26 +0000 |
commit | e264777d4286df776a5d33abcd2612b0082ea319 (patch) | |
tree | 090d2f7dbbbb345de6a3e83f8426efdf9967203e /rtems-test-template | |
parent | 0bf2f75b9902819cfa14e223f9f5c3223f78fce5 (diff) |
2011-07-20 Joel Sherrill <joel.sherrill@oarcorp.com>
* psxtmtest_blocking/init.c: Add template for POSIX timing test of
unblocking operation with no preemption.
* psxtmtest_unblocking_nopreempt/Makefile.am,
psxtmtest_unblocking_nopreempt/TEST.doc,
psxtmtest_unblocking_nopreempt/init.c: New files.
Diffstat (limited to 'rtems-test-template')
-rw-r--r-- | rtems-test-template/ChangeLog | 8 | ||||
-rw-r--r-- | rtems-test-template/psxtmtest_blocking/init.c | 4 | ||||
-rw-r--r-- | rtems-test-template/psxtmtest_unblocking_nopreempt/Makefile.am | 30 | ||||
-rw-r--r-- | rtems-test-template/psxtmtest_unblocking_nopreempt/TEST.doc | 14 | ||||
-rw-r--r-- | rtems-test-template/psxtmtest_unblocking_nopreempt/init.c | 113 |
5 files changed, 167 insertions, 2 deletions
diff --git a/rtems-test-template/ChangeLog b/rtems-test-template/ChangeLog index 7ce0007..18f76b5 100644 --- a/rtems-test-template/ChangeLog +++ b/rtems-test-template/ChangeLog @@ -1,3 +1,11 @@ +2011-07-20 Joel Sherrill <joel.sherrill@oarcorp.com> + + * psxtmtest_blocking/init.c: Add template for POSIX timing test of + unblocking operation with no preemption. + * psxtmtest_unblocking_nopreempt/Makefile.am, + psxtmtest_unblocking_nopreempt/TEST.doc, + psxtmtest_unblocking_nopreempt/init.c: New files. + 2011-07-12 Joel Sherrill <joel.sherrill@oarcorp.com> * psxtmtest_single/init.c: Fix operation count and move timing to diff --git a/rtems-test-template/psxtmtest_blocking/init.c b/rtems-test-template/psxtmtest_blocking/init.c index e1d1310..45b3e39 100644 --- a/rtems-test-template/psxtmtest_blocking/init.c +++ b/rtems-test-template/psxtmtest_blocking/init.c @@ -36,7 +36,7 @@ void *Low( 0 ); - puts( "*** END OF POSIX TIME TEST @DESC@ ***" ); + puts( "*** END OF POSIX TIME TEST @TESTNUM@ ***" ); rtems_test_exit( 0 ); return NULL; @@ -58,7 +58,7 @@ void *POSIX_Init( int status; pthread_t threadId; - puts( "\n\n*** POSIX TIME TEST @DESC@ ***" ); + puts( "\n\n*** POSIX TIME TEST @TESTNUM@ ***" ); for ( i=0 ; i < OPERATION_COUNT - 1 ; i++ ) { status = pthread_create( &threadId, NULL, Middle, NULL ); diff --git a/rtems-test-template/psxtmtest_unblocking_nopreempt/Makefile.am b/rtems-test-template/psxtmtest_unblocking_nopreempt/Makefile.am new file mode 100644 index 0000000..3e83ed8 --- /dev/null +++ b/rtems-test-template/psxtmtest_unblocking_nopreempt/Makefile.am @@ -0,0 +1,30 @@ +## +## $Id$ +## + +MANAGERS = all + +rtems_tests_PROGRAMS = @LOWER@ +@LOWER@_SOURCES = init.c ../../tmtests/include/timesys.h \ + ../../support/src/tmtests_empty_function.c \ + ../../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_unblocking_nopreempt/TEST.doc b/rtems-test-template/psxtmtest_unblocking_nopreempt/TEST.doc new file mode 100644 index 0000000..dc56765 --- /dev/null +++ b/rtems-test-template/psxtmtest_unblocking_nopreempt/TEST.doc @@ -0,0 +1,14 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989-2011. +# 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@ diff --git a/rtems-test-template/psxtmtest_unblocking_nopreempt/init.c b/rtems-test-template/psxtmtest_unblocking_nopreempt/init.c new file mode 100644 index 0000000..39e6857 --- /dev/null +++ b/rtems-test-template/psxtmtest_unblocking_nopreempt/init.c @@ -0,0 +1,113 @@ +/* + * COPYRIGHT (c) 1989-2011. + * 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$ + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <coverhd.h> +#include <tmacros.h> +#include <timesys.h> +#include "test_support.h" +#include <pthread.h> +#include <sched.h> +#include <rtems/timerdrv.h> + +pthread_mutex_t MutexId; + +void *Blockers( + void *argument +) +{ + int status; + + /* + * Now we have finished the thread startup overhead, + * so let other threads run. When we return, we can + * finish the benchmark. + */ + sched_yield(); + /* let other threads run */ + + status = pthread_mutex_lock( &MutexId ); + rtems_test_assert( status == 0 ); + + return NULL; +} + +void *POSIX_Init( + void *argument +) +{ + int i; + int status; + pthread_t threadId; + long end_time; + + puts( "\n\n*** POSIX TIME TEST MUTEX @TESTNUM@ ***" ); + + for ( i=0 ; i < OPERATION_COUNT ; i++ ) { + status = pthread_create( &threadId, NULL, Blockers, NULL ); + rtems_test_assert( status == 0 ); + } + + /* + * Deliberately create the XXX after the threads. This way if the + * threads do run before we intend, they will get an error. + */ + status = 0; /* XXX create the resource */ + rtems_test_assert( status == 0 ); + + /* + * Ensure the mutex is unavailable so the other threads block. + */ + status = 0; /* XXX ensure the resource is unavailable so the threads block */ + rtems_test_assert( status == 0 ); + + /* + * Let the other threads start so the thread startup overhead, + * is accounted for. When we return, we can start the benchmark. + */ + sched_yield(); + /* let other threads run */ + + benchmark_timer_initialize(); + status = 0; /* XXX release the resource */ + end_time = benchmark_timer_read(); + rtems_test_assert( status == 0 ); + + put_time( + "@DESC@", + end_time, + OPERATION_COUNT, + 0, + 0 + ); + + puts( "*** END OF POSIX TIME TEST MUTEX @TESTNUM@ ***" ); + rtems_test_exit( 0 ); + + return NULL; +} + +/* configuration information */ + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER + +#define CONFIGURE_MAXIMUM_POSIX_THREADS OPERATION_COUNT + 1 +/* XXX configure one of the resources */ +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_INIT + +#include <rtems/confdefs.h> + /* end of file */ |