summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-09-01 14:07:51 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-09-01 14:07:51 +0200
commitd9d0a84f8584042f5c594a4c4306a6d1ad87835e (patch)
treee93861fcd270dc2f274313694e56a371f6e8c083 /testsuites
parentscore: Fix return status of mutex try acquire (diff)
downloadrtems-d9d0a84f8584042f5c594a4c4306a6d1ad87835e.tar.bz2
psxtests/psxcancel: Check return status
Update #2402.
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/psxtests/psxcancel/init.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/testsuites/psxtests/psxcancel/init.c b/testsuites/psxtests/psxcancel/init.c
index c8c96b556c..2007529d42 100644
--- a/testsuites/psxtests/psxcancel/init.c
+++ b/testsuites/psxtests/psxcancel/init.c
@@ -41,9 +41,14 @@ void *countTaskDeferred(void *ignored)
{
int i=0;
int type,state;
-
- pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &type);
- pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &state);
+ int sc;
+
+ sc = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &type);
+ fatal_posix_service_status( sc, 0, "cancel state deferred" );
+ rtems_test_assert( type == PTHREAD_CANCEL_ENABLE );
+ sc = pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &state);
+ fatal_posix_service_status( sc, 0, "cancel type deferred" );
+ rtems_test_assert( state == PTHREAD_CANCEL_DEFERRED );
while (1) {
printf("countTaskDeferred: elapsed time (second): %2d\n", i++ );
sleep(1);
@@ -55,9 +60,14 @@ void *countTaskAsync(void *ignored)
{
int i=0;
int type,state;
-
- pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &type);
- pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &state);
+ int sc;
+
+ sc = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &type);
+ fatal_posix_service_status( sc, 0, "cancel state async" );
+ rtems_test_assert( type == PTHREAD_CANCEL_ENABLE );
+ sc = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &state);
+ fatal_posix_service_status( sc, 0, "cancel type async" );
+ rtems_test_assert( state == PTHREAD_CANCEL_DEFERRED );
pthread_cleanup_push(countTask_cancel_handler, NULL);
while (1) {
printf("countTaskAsync: elapsed time (second): %2d\n", i++ );
@@ -114,8 +124,10 @@ void *countTaskAsync(void *ignored)
}
/* sleep for 5 seconds, then cancel it */
sleep(5);
- pthread_cancel(task);
- pthread_join(task, NULL);
+ sc = pthread_cancel(task);
+ fatal_posix_service_status( sc, 0, "cancel deferred" );
+ sc = pthread_join(task, NULL);
+ fatal_posix_service_status( sc, 0, "join deferred" );
}
/* Start countTask asynchronous */
@@ -127,8 +139,10 @@ void *countTaskAsync(void *ignored)
}
/* sleep for 5 seconds, then cancel it */
sleep(5);
- pthread_cancel(task);
- pthread_join(task, NULL);
+ sc = pthread_cancel(task);
+ fatal_posix_service_status( sc, 0, "cancel async" );
+ sc = pthread_join(task, NULL);
+ fatal_posix_service_status( sc, 0, "join async" );
}