[PATCH 01/32] psxclassic01: Assume correct pthread_detach()
Sebastian Huber
sebastian.huber at embedded-brains.de
Wed May 18 09:20:20 UTC 2016
Update #2714.
---
testsuites/psxtests/psxclassic01/init.c | 35 +++++++++++++++++------
testsuites/psxtests/psxclassic01/psxclassic01.scn | 6 ++--
2 files changed, 31 insertions(+), 10 deletions(-)
diff --git a/testsuites/psxtests/psxclassic01/init.c b/testsuites/psxtests/psxclassic01/init.c
index 3ffbd3c..924224c 100644
--- a/testsuites/psxtests/psxclassic01/init.c
+++ b/testsuites/psxtests/psxclassic01/init.c
@@ -99,17 +99,14 @@ rtems_task test_task(rtems_task_argument arg)
}
}
puts( "test_task exiting thread" );
- pthread_exit( 0 );
+ pthread_exit( (void *) 123 );
}
-rtems_task Init(rtems_task_argument arg)
+
+static rtems_id create_task( void )
{
rtems_status_code sc;
rtems_id task_id;
- int status;
- void *retval;
-
- TEST_BEGIN();
sc = rtems_task_create(
rtems_build_name('T','E','S','T'),
@@ -124,6 +121,18 @@ rtems_task Init(rtems_task_argument arg)
sc = rtems_task_start( task_id, test_task, 0 );
rtems_test_assert( sc == RTEMS_SUCCESSFUL );
+ return task_id;
+}
+
+rtems_task Init( rtems_task_argument arg )
+{
+ rtems_id task_id;
+ int status;
+ void *retval;
+
+ TEST_BEGIN();
+
+ task_id = create_task();
puts( "Init - pthread_equal on Classic Ids" );
status = pthread_equal( task_id, task_id );
@@ -136,13 +145,23 @@ rtems_task Init(rtems_task_argument arg)
status = pthread_detach( task_id );
rtems_test_assert( status == 0 );
+ retval = (void *) 456;
status = pthread_join( task_id, &retval );
- if ( status != EINVAL ) printf( "JOIN %s\n", strerror( status ) );
- rtems_test_assert( status == EINVAL );
+ rtems_test_assert( status == ESRCH );
+ rtems_test_assert( retval == (void *) 456 );
+
+ status = pthread_kill( task_id, SIGUSR1 );
+ rtems_test_assert( status == ESRCH );
+
+ task_id = create_task();
status = pthread_kill( task_id, SIGUSR1 );
rtems_test_assert( status == 0 );
+ status = pthread_join( task_id, &retval );
+ rtems_test_assert( status == 0 );
+ rtems_test_assert( retval == (void *) 123 );
+
TEST_END();
exit(0);
}
diff --git a/testsuites/psxtests/psxclassic01/psxclassic01.scn b/testsuites/psxtests/psxclassic01/psxclassic01.scn
index 1d7c4dd..a783750 100644
--- a/testsuites/psxtests/psxclassic01/psxclassic01.scn
+++ b/testsuites/psxtests/psxclassic01/psxclassic01.scn
@@ -1,8 +1,10 @@
-*** START OF CLASSIC API TEST OF POSIX 01 ***
+*** BEGIN OF TEST PSXCLASSIC 1 ***
test_task starting...
test_task waiting for signal...
Init - pthread_equal on Classic Ids
Init - pthread_cancel on Classic Task
+test_task starting...
+test_task waiting for signal...
Signal_info: 25 si_signo= 0 si_code= 0 value= 0
test_task exiting thread
-*** END OF CLASSIC API TEST OF POSIX 01 ***
+*** END OF TEST PSXCLASSIC 1 ***
--
1.8.4.5
More information about the devel
mailing list