diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-07-29 16:54:32 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-07-29 16:54:32 +0000 |
commit | 4f6cc11d36107ee52a0f70589f964b9e26bfb8be (patch) | |
tree | 7ddbfaacb00b442317159bac1151f417232a5568 /testsuites/psxtmtests | |
parent | 2011-07-29 Ricardo Aguirre <el.mastin@ymail.com> (diff) | |
download | rtems-4f6cc11d36107ee52a0f70589f964b9e26bfb8be.tar.bz2 |
2011-07-29 Ricardo Aguirre <el.mastin@ymail.com>
PR 1863/tests
* Makefile.am, configure.ac, psxtmtests_plan.csv: Add benchmark of
pthread_barrier_wait - releasing, no preempt
* psxtmbarrier03/.cvsignore, psxtmbarrier03/Makefile.am,
psxtmbarrier03/init.c, psxtmbarrier03/psxtmbarrier03.doc: New files.
Diffstat (limited to 'testsuites/psxtmtests')
-rw-r--r-- | testsuites/psxtmtests/ChangeLog | 8 | ||||
-rw-r--r-- | testsuites/psxtmtests/Makefile.am | 1 | ||||
-rw-r--r-- | testsuites/psxtmtests/configure.ac | 1 | ||||
-rw-r--r-- | testsuites/psxtmtests/psxtmbarrier03/.cvsignore | 2 | ||||
-rw-r--r-- | testsuites/psxtmtests/psxtmbarrier03/Makefile.am | 30 | ||||
-rw-r--r-- | testsuites/psxtmtests/psxtmbarrier03/init.c | 103 | ||||
-rw-r--r-- | testsuites/psxtmtests/psxtmbarrier03/psxtmbarrier03.doc | 14 | ||||
-rw-r--r-- | testsuites/psxtmtests/psxtmtests_plan.csv | 2 |
8 files changed, 160 insertions, 1 deletions
diff --git a/testsuites/psxtmtests/ChangeLog b/testsuites/psxtmtests/ChangeLog index a2c5ac061b..2afd8abecd 100644 --- a/testsuites/psxtmtests/ChangeLog +++ b/testsuites/psxtmtests/ChangeLog @@ -1,5 +1,13 @@ 2011-07-29 Ricardo Aguirre <el.mastin@ymail.com> + PR 1863/tests + * Makefile.am, configure.ac, psxtmtests_plan.csv: Add benchmark of + pthread_barrier_wait - releasing, no preempt + * psxtmbarrier03/.cvsignore, psxtmbarrier03/Makefile.am, + psxtmbarrier03/init.c, psxtmbarrier03/psxtmbarrier03.doc: New files. + +2011-07-29 Ricardo Aguirre <el.mastin@ymail.com> + PR 1859/tests * Makefile.am, configure.ac, psxtmtests_plan.csv: Add benchmark of pthread_barrier_wait - blocking diff --git a/testsuites/psxtmtests/Makefile.am b/testsuites/psxtmtests/Makefile.am index b37b12af0c..4382fcf251 100644 --- a/testsuites/psxtmtests/Makefile.am +++ b/testsuites/psxtmtests/Makefile.am @@ -9,6 +9,7 @@ SUBDIRS = if HAS_POSIX SUBDIRS += psxtmbarrier01 SUBDIRS += psxtmbarrier02 +SUBDIRS += psxtmbarrier03 SUBDIRS += psxtmkey01 SUBDIRS += psxtmkey02 SUBDIRS += psxtmmutex01 diff --git a/testsuites/psxtmtests/configure.ac b/testsuites/psxtmtests/configure.ac index 5045a60d53..1a56efc3bb 100644 --- a/testsuites/psxtmtests/configure.ac +++ b/testsuites/psxtmtests/configure.ac @@ -81,6 +81,7 @@ AC_SUBST(OPERATION_COUNT) AC_CONFIG_FILES([Makefile psxtmbarrier01/Makefile psxtmbarrier02/Makefile +psxtmbarrier03/Makefile psxtmkey01/Makefile psxtmkey02/Makefile psxtmmutex01/Makefile diff --git a/testsuites/psxtmtests/psxtmbarrier03/.cvsignore b/testsuites/psxtmtests/psxtmbarrier03/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/psxtmtests/psxtmbarrier03/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/psxtmtests/psxtmbarrier03/Makefile.am b/testsuites/psxtmtests/psxtmbarrier03/Makefile.am new file mode 100644 index 0000000000..a686c8a91a --- /dev/null +++ b/testsuites/psxtmtests/psxtmbarrier03/Makefile.am @@ -0,0 +1,30 @@ +## +## $Id$ +## + +MANAGERS = all + +rtems_tests_PROGRAMS = psxtmbarrier03 +psxtmbarrier03_SOURCES = init.c ../../tmtests/include/timesys.h \ + ../../support/src/tmtests_empty_function.c \ + ../../support/src/tmtests_support.c + +dist_rtems_tests_DATA = psxtmbarrier03.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 = $(psxtmbarrier03_OBJECTS) $(psxtmbarrier03_LDADD) +LINK_LIBS = $(psxtmbarrier03_LDLIBS) + +psxtmbarrier03$(EXEEXT): $(psxtmbarrier03_OBJECTS) $(psxtmbarrier03_DEPENDENCIES) + @rm -f psxtmbarrier03$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/psxtmtests/psxtmbarrier03/init.c b/testsuites/psxtmtests/psxtmbarrier03/init.c new file mode 100644 index 0000000000..14f7d46fa2 --- /dev/null +++ b/testsuites/psxtmtests/psxtmbarrier03/init.c @@ -0,0 +1,103 @@ +/* + * 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> + +#define N 2 +pthread_barrier_t barrier; + +void *Blocker( + void *argument +) +{ + (void) pthread_barrier_wait( &barrier ); + rtems_test_assert( FALSE ); + return NULL; +} + +void *POSIX_Init( + void *argument +) +{ + int status; + pthread_t threadId; + long end_time; + + puts( "\n\n*** POSIX TIME TEST PSXTMBARRIER 03 ***" ); + + status = pthread_create( &threadId, NULL, Blocker, NULL ); + rtems_test_assert( status == 0 ); + + /* + * Deliberately create the barrier after the threads. This way if the + * threads do run before we intend, they will get an error. + * The barrier will be released on the Nth thread blocking. + */ + status = pthread_barrier_init( &barrier, NULL, N ); + rtems_test_assert( status == 0 ); + + /* + * Let the other thread start so the thread startup overhead, + * is accounted for. When we return, we can start the benchmark. + */ + sched_yield(); + /* let other thread run */ + + /* + * Because this is the Nth thread at the barrier, this is an + * unblocking operation. + */ + benchmark_timer_initialize(); + status = pthread_barrier_wait( &barrier ); + end_time = benchmark_timer_read(); + /* + * Upon successful completion return value, the status should be + * PTHREAD_BARRIER_SERIAL_THREAD. + */ + rtems_test_assert( status == PTHREAD_BARRIER_SERIAL_THREAD ); + + put_time( + "pthread_barrier_wait – releasing, no preempt", + end_time, + 1, + 0, + 0 + ); + + puts( "*** END OF POSIX TIME TEST PSXTMBARRIER 03 ***" ); + 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 2 +#define CONFIGURE_MAXIMUM_POSIX_BARRIERS 1 +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_INIT + +#include <rtems/confdefs.h> +/* end of file */ diff --git a/testsuites/psxtmtests/psxtmbarrier03/psxtmbarrier03.doc b/testsuites/psxtmtests/psxtmbarrier03/psxtmbarrier03.doc new file mode 100644 index 0000000000..41f577f961 --- /dev/null +++ b/testsuites/psxtmtests/psxtmbarrier03/psxtmbarrier03.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: + ++ pthread_barrier_wait – releasing, no preempt diff --git a/testsuites/psxtmtests/psxtmtests_plan.csv b/testsuites/psxtmtests/psxtmtests_plan.csv index 07854266c8..a4d54417de 100644 --- a/testsuites/psxtmtests/psxtmtests_plan.csv +++ b/testsuites/psxtmtests/psxtmtests_plan.csv @@ -53,7 +53,7 @@ "pthread_barrier_init","psxtmbarrier01","psxtmtest_init_destroy","Yes" "pthread_barrier_destroy","psxtmbarrier01","psxtmtest_init_destroy","Yes" "pthread_barrier_wait - blocking","psxtmbarrier02","psxtmtest_blocking","Yes" -"pthread_barrier_wait - releasing, no preempt","psxtmbarrier03","psxtmtest_unblocking_nopreempt", +"pthread_barrier_wait - releasing, no preempt","psxtmbarrier03","psxtmtest_unblocking_nopreempt","Yes" "pthread_barrier_wait - releasing, preempt","psxtmbarrier04","psxtmtest_unblocking_preempt", ,,, "pthread_spin_init",,"psxtmtest_init_destroy", |