From b499cb7a6045ec92c2e22d635ced448a52c91b3c Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 20 Jul 2011 21:30:02 +0000 Subject: 2011-07-20 Joel Sherrill * psxtmmutex05/init.c: Fix test. Pattern was wrong. --- testsuites/psxtmtests/ChangeLog | 4 ++++ testsuites/psxtmtests/psxtmmutex05/init.c | 32 ++++++++++--------------------- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/testsuites/psxtmtests/ChangeLog b/testsuites/psxtmtests/ChangeLog index 4ff60be620..609d963ab9 100644 --- a/testsuites/psxtmtests/ChangeLog +++ b/testsuites/psxtmtests/ChangeLog @@ -1,3 +1,7 @@ +2011-07-20 Joel Sherrill + + * psxtmmutex05/init.c: Fix test. Pattern was wrong. + 2011-07-20 Joel Sherrill * Makefile.am, configure.ac: Add benchmark of pthread_mutex_unlock diff --git a/testsuites/psxtmtests/psxtmmutex05/init.c b/testsuites/psxtmtests/psxtmmutex05/init.c index 5f39743df2..05caa310d6 100644 --- a/testsuites/psxtmtests/psxtmmutex05/init.c +++ b/testsuites/psxtmtests/psxtmmutex05/init.c @@ -23,22 +23,13 @@ pthread_mutex_t MutexId; -void *Blockers( +void *Blocker( 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 ); + (void) pthread_mutex_lock( &MutexId ); + /* should never return */ + rtems_test_assert( FALSE ); return NULL; } @@ -47,17 +38,14 @@ void *POSIX_Init( void *argument ) { - int i; int status; pthread_t threadId; long end_time; puts( "\n\n*** POSIX TIME TEST MUTEX 05 ***" ); - for ( i=0 ; i < OPERATION_COUNT ; i++ ) { - status = pthread_create( &threadId, NULL, Blockers, NULL ); - rtems_test_assert( status == 0 ); - } + status = pthread_create( &threadId, NULL, Blocker, NULL ); + rtems_test_assert( status == 0 ); /* * Deliberately create the mutex after the threads. This way if the @@ -73,11 +61,11 @@ void *POSIX_Init( rtems_test_assert( status == 0 ); /* - * Let the other threads start so the thread startup overhead, + * 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 threads run */ + /* let other thread run */ benchmark_timer_initialize(); status = pthread_mutex_unlock( &MutexId ); @@ -87,7 +75,7 @@ void *POSIX_Init( put_time( "pthread_mutex_unlock (no preemption)", end_time, - OPERATION_COUNT, + 1, 0, 0 ); @@ -103,7 +91,7 @@ void *POSIX_Init( #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER #define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER -#define CONFIGURE_MAXIMUM_POSIX_THREADS OPERATION_COUNT + 1 +#define CONFIGURE_MAXIMUM_POSIX_THREADS 2 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1 #define CONFIGURE_POSIX_INIT_THREAD_TABLE -- cgit v1.2.3