summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests/psxautoinit02
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-09-26 07:49:17 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-05 14:29:02 +0200
commit5222488573e3ba8c2eceffe29f878a73a3a81694 (patch)
tree4b4ca72268b8f40da493ca252780c197bd23a5ef /testsuites/psxtests/psxautoinit02
parentposix: Implement self-contained POSIX rwlocks (diff)
downloadrtems-5222488573e3ba8c2eceffe29f878a73a3a81694.tar.bz2
posix: Implement self-contained POSIX condvar
POSIX condition variables are now available in all configurations and no longer depend on --enable-posix. Update #2514. Update #3113.
Diffstat (limited to 'testsuites/psxtests/psxautoinit02')
-rw-r--r--testsuites/psxtests/psxautoinit02/init.c63
-rw-r--r--testsuites/psxtests/psxautoinit02/psxautoinit02.scn15
2 files changed, 66 insertions, 12 deletions
diff --git a/testsuites/psxtests/psxautoinit02/init.c b/testsuites/psxtests/psxautoinit02/init.c
index 967b9b86d5..bba4e24ea4 100644
--- a/testsuites/psxtests/psxautoinit02/init.c
+++ b/testsuites/psxtests/psxautoinit02/init.c
@@ -25,20 +25,65 @@ void *POSIX_Init(
)
{
int sc;
- pthread_cond_t cond1;
- pthread_cond_t cond2;
+ pthread_cond_t cond1 = PTHREAD_COND_INITIALIZER;
+ pthread_cond_t cond2 = PTHREAD_COND_INITIALIZER;
+ pthread_cond_t cond3 = PTHREAD_COND_INITIALIZER;
+ pthread_cond_t cond4 = PTHREAD_COND_INITIALIZER;
+ pthread_cond_t cond5 = PTHREAD_COND_INITIALIZER;
+ pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
+ struct timespec to;
TEST_BEGIN();
- cond1 = PTHREAD_COND_INITIALIZER;
- cond2 = PTHREAD_COND_INITIALIZER;
puts( "Init - pthread_cond_broadcast - auto initialize - OK" );
sc = pthread_cond_broadcast( &cond1 );
fatal_posix_service_status( sc, 0, "cond broadcast OK" );
- puts( "Init - pthread_cond_broadcast - auto initialize - EINVAL" );
- sc = pthread_cond_broadcast( &cond2 );
- fatal_posix_service_status( sc, EINVAL, "cond lock EINVAL" );
+ puts( "Init - pthread_cond_signal - auto initialize - OK" );
+ sc = pthread_cond_signal( &cond2 );
+ fatal_posix_service_status( sc, 0, "cond signal OK" );
+
+ puts( "Init - pthread_cond_init - auto initialize - OK" );
+ sc = pthread_cond_init( &cond3, NULL );
+ fatal_posix_service_status( sc, 0, "cond init OK" );
+
+ puts( "Init - pthread_mutex_lock - OK" );
+ sc = pthread_mutex_lock( &mtx );
+ fatal_posix_service_status( sc, 0, "mtx lock OK" );
+
+ puts( "Init - pthread_cond_timedwait - auto initialize - OK" );
+ to.tv_sec = 1;
+ to.tv_nsec = 1;
+ sc = pthread_cond_timedwait( &cond4, &mtx, &to );
+ fatal_posix_service_status( sc, ETIMEDOUT, "cond timedwait OK" );
+
+ puts( "Init - pthread_mutex_unlock - OK" );
+ sc = pthread_mutex_unlock( &mtx );
+ fatal_posix_service_status( sc, 0, "mtx unlock OK" );
+
+ puts( "Init - pthread_mutex_destroy - OK" );
+ sc = pthread_mutex_destroy( &mtx );
+ fatal_posix_service_status( sc, 0, "mtx destroy OK" );
+
+ puts( "Init - pthread_cond_destroy - OK" );
+ sc = pthread_cond_destroy( &cond5 );
+ fatal_posix_service_status( sc, 0, "cond destroy OK" );
+
+ puts( "Init - pthread_cond_destroy - EINVAL" );
+ sc = pthread_cond_destroy( &cond5 );
+ fatal_posix_service_status( sc, EINVAL, "cond destroy EINVAL" );
+
+ puts( "Init - pthread_cond_destroy - OK" );
+ sc = pthread_cond_destroy( &cond4 );
+ fatal_posix_service_status( sc, 0, "cond destroy OK" );
+
+ puts( "Init - pthread_cond_destroy - OK" );
+ sc = pthread_cond_destroy( &cond3 );
+ fatal_posix_service_status( sc, 0, "cond destroy OK" );
+
+ puts( "Init - pthread_cond_destroy - OK" );
+ sc = pthread_cond_destroy( &cond2 );
+ fatal_posix_service_status( sc, 0, "cond destroy OK" );
puts( "Init - pthread_cond_destroy - OK" );
sc = pthread_cond_destroy( &cond1 );
@@ -51,12 +96,12 @@ void *POSIX_Init(
}
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
-#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
-#define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 1
+#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 1
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
diff --git a/testsuites/psxtests/psxautoinit02/psxautoinit02.scn b/testsuites/psxtests/psxautoinit02/psxautoinit02.scn
index bfe3067468..047088a6d9 100644
--- a/testsuites/psxtests/psxautoinit02/psxautoinit02.scn
+++ b/testsuites/psxtests/psxautoinit02/psxautoinit02.scn
@@ -1,5 +1,14 @@
-*** POSIX TEST -- AUTOMATIC INITIALIZAITON 02 ***
+*** BEGIN OF TEST PSXAUTOINIT 2 ***
Init - pthread_cond_broadcast - auto initialize - OK
-Init - pthread_cond_broadcast - auto initialize - EINVAL
+Init - pthread_cond_signal - auto initialize - OK
+Init - pthread_cond_init - auto initialize - OK
+Init - pthread_mutex_lock - OK
+Init - pthread_cond_timedwait - auto initialize - OK
+Init - pthread_mutex_unlock - OK
+Init - pthread_mutex_destroy - OK
Init - pthread_cond_destroy - OK
-*** END OF POSIX TEST AUTOMATIC INITIALIZATION 02 ***
+Init - pthread_cond_destroy - OK
+Init - pthread_cond_destroy - OK
+Init - pthread_cond_destroy - OK
+Init - pthread_cond_destroy - OK
+*** END OF TEST PSXAUTOINIT 2 ***