summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorChristian Mauderer <Christian.Mauderer@embedded-brains.de>2014-03-21 14:29:55 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-03-24 08:31:49 +0100
commit5ef9f23fb430f73cbb7cca72631768431f17717f (patch)
treeccf9776f7d2808b138323c8f753bd7252179efcc /testsuites
parentlibcsupport: Remove unused gxx-wrapper function. (diff)
downloadrtems-5ef9f23fb430f73cbb7cca72631768431f17717f.tar.bz2
libcsupport: Use POSIX keys for GXX key functions
With this patch C++ applications now eventually need additional POSIX-keys and POSIX-key-value-pairs configured.
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/libtests/gxx01/gxx01.scn8
-rw-r--r--testsuites/libtests/gxx01/init.c29
-rw-r--r--testsuites/sptests/spfatal24/spfatal24.doc2
-rw-r--r--testsuites/sptests/spfatal24/testcase.h6
-rw-r--r--testsuites/sptests/sptls02/init.cc3
5 files changed, 37 insertions, 11 deletions
diff --git a/testsuites/libtests/gxx01/gxx01.scn b/testsuites/libtests/gxx01/gxx01.scn
index cb9f6b505b..f831881fa3 100644
--- a/testsuites/libtests/gxx01/gxx01.scn
+++ b/testsuites/libtests/gxx01/gxx01.scn
@@ -22,10 +22,14 @@ Call once method the second time
rtems_gxx_key_create(&key, NULL) - OK
rtems_gxx_key_delete(key) - OK
rtems_gxx_key_create(&key, key_dtor) - OK
-rtems_gxx_setspecific() - OK
+rtems_gxx_getspecific(key) not set - OK
+rtems_gxx_setspecific(key, 0x1234) - OK
rtems_gxx_getspecific(key) already existing - OK
rtems_gxx_key_delete(key) - OK
rtems_gxx_getspecific(key) non-existent - OK
-rtems_gxx_key_delete(key) - OK
+rtems_gxx_key_delete(key) - NOT OK
+rtems_gxx_setspecific(NULL, 0x1234) - NOT OK
+rtems_gxx_getspecific(NULL) - OK
+rtems_gxx_key_delete(NULL) - NOT OK
*** END OF TEST GXX 01 ***
diff --git a/testsuites/libtests/gxx01/init.c b/testsuites/libtests/gxx01/init.c
index f9252848de..a0debcdc91 100644
--- a/testsuites/libtests/gxx01/init.c
+++ b/testsuites/libtests/gxx01/init.c
@@ -11,6 +11,7 @@
#include "config.h"
#endif
+#include <errno.h>
#include <tmacros.h>
#include "test_support.h"
#include <rtems/gxx_wrappers.h>
@@ -142,7 +143,11 @@ void test_key(void)
sc = rtems_gxx_key_create(&key, key_dtor);
rtems_test_assert( sc == 0 );
- puts( "rtems_gxx_setspecific() - OK" );
+ puts( "rtems_gxx_getspecific(key) not set - OK" );
+ p = rtems_gxx_getspecific(key);
+ rtems_test_assert( p == NULL );
+
+ puts( "rtems_gxx_setspecific(key, 0x1234) - OK" );
sc = rtems_gxx_setspecific(key, (void *)0x1234);
rtems_test_assert( sc == 0 );
@@ -153,7 +158,8 @@ void test_key(void)
puts( "rtems_gxx_key_delete(key) - OK" );
sc = rtems_gxx_key_delete(key);
rtems_test_assert( sc == 0 );
- rtems_test_assert( key_dtor_ran == true );
+ /* pthread_key man-page: the dtor should _not_ be called */
+ rtems_test_assert( key_dtor_ran != true );
key = calloc( 1, sizeof( *key ) );
rtems_test_assert( key != NULL );
@@ -162,9 +168,21 @@ void test_key(void)
p = rtems_gxx_getspecific( key );
rtems_test_assert( p == NULL );
- puts( "rtems_gxx_key_delete(key) - OK" );
+ puts( "rtems_gxx_key_delete(key) - NOT OK" );
sc = rtems_gxx_key_delete( key );
- rtems_test_assert( sc == 0 );
+ rtems_test_assert( sc != 0 );
+
+ puts( "rtems_gxx_setspecific(NULL, 0x1234) - NOT OK" );
+ sc = rtems_gxx_setspecific( NULL, (void *)0x1234 );
+ rtems_test_assert( sc == EINVAL );
+
+ puts( "rtems_gxx_getspecific(NULL) - OK" );
+ p = rtems_gxx_getspecific( NULL );
+ rtems_test_assert( p == NULL );
+
+ puts( "rtems_gxx_key_delete(NULL) - NOT OK" );
+ sc = rtems_gxx_key_delete( NULL );
+ rtems_test_assert( sc == EINVAL );
}
rtems_task Init(
@@ -195,6 +213,9 @@ rtems_task Init(
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 1
+#define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS 1
+
#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_MAXIMUM_SEMAPHORES 2
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
diff --git a/testsuites/sptests/spfatal24/spfatal24.doc b/testsuites/sptests/spfatal24/spfatal24.doc
index e30241bc8b..b697770085 100644
--- a/testsuites/sptests/spfatal24/spfatal24.doc
+++ b/testsuites/sptests/spfatal24/spfatal24.doc
@@ -12,7 +12,7 @@ test set name: spfatal24
directives:
- rtems_gxx_getspecific();
+ rtems_gxx_setspecific();
concepts:
diff --git a/testsuites/sptests/spfatal24/testcase.h b/testsuites/sptests/spfatal24/testcase.h
index 73ecf857a9..87cbe534a8 100644
--- a/testsuites/sptests/spfatal24/testcase.h
+++ b/testsuites/sptests/spfatal24/testcase.h
@@ -18,9 +18,7 @@
void force_error()
{
- __gthread_key key;
+ pthread_key_t key = -1;
- rtems_workspace_greedy_allocate( NULL, 0 );
-
- rtems_gxx_getspecific( &key );
+ rtems_gxx_setspecific( &key, NULL );
}
diff --git a/testsuites/sptests/sptls02/init.cc b/testsuites/sptests/sptls02/init.cc
index 603e2288d6..5902a77a5f 100644
--- a/testsuites/sptests/sptls02/init.cc
+++ b/testsuites/sptests/sptls02/init.cc
@@ -251,6 +251,9 @@ extern "C" void Init(rtems_task_argument arg)
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 2
+#define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS 2
+
#define CONFIGURE_INIT
#include <rtems/confdefs.h>