summaryrefslogtreecommitdiffstats
path: root/testsuites/libtests/gxx01
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2010-07-25 14:53:37 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2010-07-25 14:53:37 +0000
commit972a8dba7200480964db334c5ff1014097c864dd (patch)
tree1b2ff8c9e773925ae5c8c856f04161b38f1e17f7 /testsuites/libtests/gxx01
parent2010-07-25 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-972a8dba7200480964db334c5ff1014097c864dd.tar.bz2
2010-07-25 Joel Sherrill <joel.sherrill@oarcorp.com>
* gxx01/gxx01.scn, gxx01/init.c: Add more testcases.
Diffstat (limited to 'testsuites/libtests/gxx01')
-rw-r--r--testsuites/libtests/gxx01/gxx01.scn10
-rw-r--r--testsuites/libtests/gxx01/init.c50
2 files changed, 52 insertions, 8 deletions
diff --git a/testsuites/libtests/gxx01/gxx01.scn b/testsuites/libtests/gxx01/gxx01.scn
index bec6d16ecb..e66bd6a156 100644
--- a/testsuites/libtests/gxx01/gxx01.scn
+++ b/testsuites/libtests/gxx01/gxx01.scn
@@ -12,6 +12,8 @@ rtems_gxx_recursive_mutex_unlock() - Unnest
rtems_gxx_recursive_mutex_unlock() - OK
rtems_gxx_recursive_mutex_lock() - OK
rtems_gxx_recursive_mutex_unlock() - OK
+rtems_gxx_mutex_destroy(mutex) - OK
+rtems_gxx_mutex_destroy(mutex) - NOT OK
Call once method the first time
Running once method
@@ -21,6 +23,12 @@ 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_petspecific() - OK
+rtems_gxx_getspecific(key) already existing - OK
rtems_gxx_key_delete(key) - OK
+rtems_gxx_getspecific(key_for_testing) non-existent - OK
+rtems_gxx_key_delete(key_for_testing) - OK
+
+rtems_gxx_mutex_init() until exhausted and panic
+rtems_gxx_mutex_init
+fatal error, exiting
*** END OF TEST GXX 01 ***
diff --git a/testsuites/libtests/gxx01/init.c b/testsuites/libtests/gxx01/init.c
index b298d51f28..b9f9ff599c 100644
--- a/testsuites/libtests/gxx01/init.c
+++ b/testsuites/libtests/gxx01/init.c
@@ -46,6 +46,14 @@ void test_recursive_mutex(void)
puts( "rtems_gxx_recursive_mutex_unlock() - OK" );
sc = rtems_gxx_recursive_mutex_unlock(&mutex);
rtems_test_assert( sc == 0 );
+
+ puts( "rtems_gxx_mutex_destroy(mutex) - OK" );
+ sc = rtems_gxx_mutex_destroy(&mutex);
+ rtems_test_assert( sc == 0 );
+
+ puts( "rtems_gxx_mutex_destroy(mutex) - NOT OK" );
+ sc = rtems_gxx_mutex_destroy(&mutex);
+ rtems_test_assert( sc == -1 );
}
void test_mutex(void)
@@ -97,6 +105,7 @@ void test_once(void)
}
volatile bool key_dtor_ran;
+void *key_for_testing;
void key_dtor(void *ptr)
{
@@ -125,7 +134,7 @@ void test_key(void)
sc = rtems_gxx_setspecific(key, (void *)0x1234);
rtems_test_assert( sc == 0 );
- puts( "rtems_gxx_petspecific() - OK" );
+ puts( "rtems_gxx_getspecific(key) already existing - OK" );
p = rtems_gxx_getspecific(key);
rtems_test_assert( p == (void *)0x1234 );
@@ -134,12 +143,38 @@ void test_key(void)
rtems_test_assert( sc == 0 );
rtems_test_assert( key_dtor_ran == true );
-#if 0
+ puts( "rtems_gxx_getspecific(key_for_testing) non-existent - OK" );
+ p = rtems_gxx_getspecific((__gthread_key_t) &key_for_testing);
+ rtems_test_assert( p == NULL );
+ rtems_test_assert( key_for_testing == NULL );
+
+ key_for_testing = malloc(4);
+ rtems_test_assert( key_for_testing != NULL );
+
+ puts( "rtems_gxx_key_delete(key_for_testing) - OK" );
+ sc = rtems_gxx_key_delete((__gthread_key_t) &key_for_testing);
+ rtems_test_assert( sc == 0 );
+ rtems_test_assert( key_for_testing == NULL );
+}
+
+void _exit(int status) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE;
+
+void _exit(int status)
+{
+ puts( "*** END OF TEST GXX 01 ***" );
+
+ rtems_shutdown_executive(0);
+}
-void *rtems_gxx_getspecific(__gthread_key_t key);
+void test_out_of_mutexes(void)
+{
+ __gthread_mutex_t mutex;
-int rtems_gxx_setspecific(__gthread_key_t key, const void *ptr);
-#endif
+ puts( "rtems_gxx_mutex_init() until exhausted and panic" );
+ while (1) {
+ rtems_gxx_mutex_init(&mutex);
+ rtems_test_assert( mutex != 0 );
+ }
}
rtems_task Init(
@@ -158,10 +193,11 @@ rtems_task Init(
puts( "" );
test_key();
+ puts( "" );
- puts( "*** END OF TEST GXX 01 ***" );
+ test_out_of_mutexes();
- rtems_test_exit(0);
+ /* does not return */
}
/* configuration information */