summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2014-03-04 15:54:12 -0600
committerJoel Sherrill <joel.sherrill@oarcorp.com>2014-03-07 13:21:11 -0600
commite6c87f78724743bc74a38678f93ed579ace840f2 (patch)
treedce3962edb00574dade0c8caf837cd85b9607831 /testsuites
parentRemove trailing whitespace in previous patches (diff)
downloadrtems-e6c87f78724743bc74a38678f93ed579ace840f2.tar.bz2
POSIX keys now enabled in all configurations.
Formerly POSIX keys were only enabled when POSIX threads were enabled. Because they are a truly safe alternative to per-task variables in an SMP system, they are being enabled in all configurations.
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/psxtests/Makefile.am11
-rw-r--r--testsuites/psxtests/psxkey01/Makefile.am3
-rw-r--r--testsuites/psxtests/psxkey01/init.c15
-rw-r--r--testsuites/psxtests/psxkey01/psxkey01.scn1
-rw-r--r--testsuites/psxtests/psxkey01/system.h31
-rw-r--r--testsuites/psxtests/psxkey01/task.c54
-rw-r--r--testsuites/psxtests/psxkey02/init.c12
-rw-r--r--testsuites/psxtests/psxkey02/psxkey02.scn4
-rw-r--r--testsuites/psxtests/psxkey03/init.c68
-rw-r--r--testsuites/psxtests/psxkey03/psxkey03.scn7
-rw-r--r--testsuites/psxtests/psxkey04/init.c81
-rw-r--r--testsuites/psxtests/psxkey04/psxkey04.scn5
-rw-r--r--testsuites/psxtests/psxkey05/init.c15
-rw-r--r--testsuites/psxtests/psxkey05/psxkey05.scn7
-rw-r--r--testsuites/psxtests/psxkey06/init.c78
-rw-r--r--testsuites/psxtests/psxkey07/init.c118
-rw-r--r--testsuites/psxtests/psxkey07/psxkey07.scn7
-rw-r--r--testsuites/psxtests/psxkey08/init.c95
-rw-r--r--testsuites/psxtests/psxkey08/psxkey08.scn7
-rw-r--r--testsuites/psxtests/psxkey09/init.c51
-rw-r--r--testsuites/psxtests/psxkey09/psxkey09.scn5
-rw-r--r--testsuites/psxtests/psxkey10/init.c52
-rw-r--r--testsuites/psxtests/psxkey10/psxkey10.scn6
23 files changed, 378 insertions, 355 deletions
diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index 0d457ea00c..fd4ceac338 100644
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -7,8 +7,7 @@ SUBDIRS += psxhdrs psx01 psx02 psx03 psx04 psx05 psx06 psx07 psx08 psx09 \
psxaio01 psxaio02 psxaio03 \
psxalarm01 psxautoinit01 psxautoinit02 psxbarrier01 \
psxcancel psxcancel01 psxclassic01 psxcleanup psxcleanup01 \
- psxcond01 psxconfig01 psxenosys psxkey01 psxkey02 psxkey03 psxkey04 \
- psxkey05 psxkey06 psxkey07 psxkey08 psxkey09 psxkey10 \
+ psxcond01 psxconfig01 psxenosys \
psxitimer psxmsgq01 psxmsgq02 psxmsgq03 psxmsgq04 \
psxmutexattr01 psxobj01 psxrwlock01 psxsem01 psxsignal01 psxsignal02 \
psxsignal03 psxsignal04 psxsignal05 psxsignal06 \
@@ -23,6 +22,14 @@ SUBDIRS += psxfile01 psxfile02 psxfilelock01 psxgetrusage01 psxid01 \
psximfs01 psximfs02 psxreaddir psxstat psxmount psx13 psxchroot01 \
psxpasswd01 psxpasswd02 psxpipe01 psxtimes01 psxfchx01
+## POSIX Keys are always available
+SUBDIRS += psxkey01 psxkey02 psxkey03 psxkey04 \
+ psxkey05 psxkey06 psxkey08 psxkey09 psxkey10
+## But some of the tests need other POSIX features
+if HAS_POSIX
+SUBDIRS += psxkey07
+endif
+
SUBDIRS += psxrdwrv
include $(top_srcdir)/../automake/subdirs.am
diff --git a/testsuites/psxtests/psxkey01/Makefile.am b/testsuites/psxtests/psxkey01/Makefile.am
index bb9b119b7d..e5cb1f5400 100644
--- a/testsuites/psxtests/psxkey01/Makefile.am
+++ b/testsuites/psxtests/psxkey01/Makefile.am
@@ -1,9 +1,8 @@
rtems_tests_PROGRAMS = psxkey01
-psxkey01_SOURCES = init.c task.c system.h ../include/pmacros.h \
+psxkey01_SOURCES = init.c system.h ../include/pmacros.h \
../../support/src/test_support.c
-
dist_rtems_tests_DATA = psxkey01.scn
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
diff --git a/testsuites/psxtests/psxkey01/init.c b/testsuites/psxtests/psxkey01/init.c
index e63407cda8..da51043e43 100644
--- a/testsuites/psxtests/psxkey01/init.c
+++ b/testsuites/psxtests/psxkey01/init.c
@@ -17,39 +17,30 @@
#include "tmacros.h"
/* forward declarations to avoid warnings */
-void *POSIX_Init(void *argument);
+rtems_task Init(rtems_task_argument argument);
void Key_destructor(void *key_data);
void Key_destructor(void *key_data)
{
}
-void *POSIX_Init(
- void *argument
-)
+rtems_task Init(rtems_task_argument argument)
{
int status;
puts( "\n\n*** POSIX KEY 01 TEST ***" );
- /* set the time of day, and print our buffer in multiple ways */
-
- set_time( TM_FRIDAY, TM_MAY, 24, 96, 11, 5, 0 );
-
/* get id of this thread */
- Init_id = pthread_self();
+ Init_id = rtems_task_self();
printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
rtems_workspace_greedy_allocate( NULL, 0 );
puts("Init: pthread_key_create - OK");
- empty_line();
status = pthread_key_create( &Key_id[0], Key_destructor );
fatal_directive_check_status_only( status, 0, "OK" );
puts( "*** END OF POSIX KEY 01 TEST ***" );
rtems_test_exit( 0 );
-
- return NULL; /* just so the compiler thinks we returned something */
}
diff --git a/testsuites/psxtests/psxkey01/psxkey01.scn b/testsuites/psxtests/psxkey01/psxkey01.scn
index e1a747c8ab..e9dacb8a00 100644
--- a/testsuites/psxtests/psxkey01/psxkey01.scn
+++ b/testsuites/psxtests/psxkey01/psxkey01.scn
@@ -1,5 +1,4 @@
*** POSIX KEY 01 TEST ***
Init's ID is 0x0b010001
Init: pthread_key_create - OK
-
*** END OF POSIX KEY 01 TEST ***
diff --git a/testsuites/psxtests/psxkey01/system.h b/testsuites/psxtests/psxkey01/system.h
index d441a3b2ef..c5c9e0f862 100644
--- a/testsuites/psxtests/psxkey01/system.h
+++ b/testsuites/psxtests/psxkey01/system.h
@@ -1,9 +1,12 @@
-/* system.h
+/**
+ * @file
*
* This include file contains information that is included in every
* function in the test set.
- *
- * COPYRIGHT (c) 1989-1999.
+ */
+
+/*
+ * COPYRIGHT (c) 1989-2014.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -15,24 +18,15 @@
#include <pmacros.h>
-void *POSIX_Init(
- void *argument
-);
-
-void *Task_1(
- void *argument
-);
-
-
/* configuration information */
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
-#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
-#define CONFIGURE_MAXIMUM_POSIX_THREADS 21
-#define CONFIGURE_MAXIMUM_POSIX_KEYS 21
+#define CONFIGURE_MAXIMUM_TASKS 1
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 1
-#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#include <rtems/confdefs.h>
@@ -45,9 +39,8 @@ void *Task_1(
#endif
TEST_EXTERN pthread_t Init_id;
-TEST_EXTERN pthread_t Task_id[CONFIGURE_MAXIMUM_POSIX_THREADS-1];
-TEST_EXTERN pthread_key_t Key_id[CONFIGURE_MAXIMUM_POSIX_KEYS-1];
-TEST_EXTERN uint32_t Data_array[ CONFIGURE_MAXIMUM_POSIX_THREADS ];
+TEST_EXTERN pthread_key_t Key_id[CONFIGURE_MAXIMUM_POSIX_KEYS - 1];
+TEST_EXTERN uint32_t Data_array[ CONFIGURE_MAXIMUM_TASKS ];
#undef TEST_EXTERN
/* end of include file */
diff --git a/testsuites/psxtests/psxkey01/task.c b/testsuites/psxtests/psxkey01/task.c
deleted file mode 100644
index 4f83ebeecf..0000000000
--- a/testsuites/psxtests/psxkey01/task.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Task_1
- *
- * This routine serves as a test task. It verifies the basic task
- * switching capabilities of the executive.
- *
- * Input parameters:
- * argument - task argument
- *
- * Output parameters: NONE
- *
- * COPYRIGHT (c) 1989-2009.
- * On-Line Applications Research Corporation (OAR).
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.com/license/LICENSE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "system.h"
-#include <errno.h>
-
-void *Task_1(
- void *arg
-)
-{
- pthread_t id = *(pthread_t *) arg;
- int status;
- uint32_t *key_data;
-
- printf( "Thread 0x%08" PRIxpthread_t "\n", id );
- printf( "Task_1: Setting the key to %d\n", 1 );
- status = pthread_setspecific( Key_id[0], (void *)&Data_array[ 1 ] );
- if ( status )
- printf( "status = %d\n", status );
- rtems_test_assert( !status );
-
- key_data = pthread_getspecific( Key_id[0] );
- printf( "Task_1: Got the key value of %ld\n",
- (unsigned long) ((uint32_t *)key_data - Data_array) );
- if ( status )
- printf( "status = %d\n", status );
- rtems_test_assert( !status );
-
- puts( "Task_1: exitting" );
- pthread_exit( NULL );
-
- /* switch to task 2 */
-
- return NULL; /* just so the compiler thinks we returned something */
-}
diff --git a/testsuites/psxtests/psxkey02/init.c b/testsuites/psxtests/psxkey02/init.c
index 6055dac828..6fc6a3c7a3 100644
--- a/testsuites/psxtests/psxkey02/init.c
+++ b/testsuites/psxtests/psxkey02/init.c
@@ -1,5 +1,5 @@
/*
- * COPYRIGHT (c) 1989-2012.
+ * COPYRIGHT (c) 1989-2014.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -18,11 +18,9 @@
#include "pmacros.h"
/* forward declarations to avoid warnings */
-void *POSIX_Init(void *argument);
+rtems_task Init(rtems_task_argument ignored);
-void *POSIX_Init(
- void *ignored
-)
+rtems_task Init(rtems_task_argument ignored)
{
pthread_key_t key;
int eno;
@@ -84,10 +82,10 @@ void *POSIX_Init(
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
-#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
+#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_MAXIMUM_POSIX_KEYS 1
-#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
diff --git a/testsuites/psxtests/psxkey02/psxkey02.scn b/testsuites/psxtests/psxkey02/psxkey02.scn
index fbc3342a23..f5a5f71f60 100644
--- a/testsuites/psxtests/psxkey02/psxkey02.scn
+++ b/testsuites/psxtests/psxkey02/psxkey02.scn
@@ -1,6 +1,8 @@
+sparc-rtems4.11-run is /home/joel/rtems-4.11-work/tools/bin/sparc-rtems4.11-run
+
+
*** TEST KEY 02 ***
Init - pthread_key_create - ENOMEM
Init - pthread_key_delete - OK
Init - verify workspace has same memory
*** END OF TEST KEY 02 ***
-
diff --git a/testsuites/psxtests/psxkey03/init.c b/testsuites/psxtests/psxkey03/init.c
index 0d12799515..7df359235a 100644
--- a/testsuites/psxtests/psxkey03/init.c
+++ b/testsuites/psxtests/psxkey03/init.c
@@ -1,5 +1,5 @@
/*
- * COPYRIGHT (c) 1989-2012.
+ * COPYRIGHT (c) 1989-2014.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -17,9 +17,10 @@
#include "pmacros.h"
/* forward declarations to avoid warnings */
-void *POSIX_Init(void *argument);
+rtems_task Init(rtems_task_argument value );
+rtems_task Test_Thread( rtems_task_argument value );
+
void destructor(void *value);
-void *Test_Thread(void *key_value);
pthread_key_t Key;
volatile bool destructor_ran;
@@ -29,32 +30,25 @@ void destructor(void *value)
destructor_ran = true;
}
-void *Test_Thread(
- void *key_value
-)
+rtems_task Test_Thread( rtems_task_argument value )
{
- int sc;
-
- /*
- * Detach ourselves so we don't wait for a join that won't happen.
- */
- pthread_detach( pthread_self() );
+ int sc;
+ void *key_value = (void *) value;
puts( "Test_Thread - pthread_setspecific - OK" );
sc = pthread_setspecific( Key, key_value );
rtems_test_assert( !sc );
puts( "Test_Thread - pthread_exit to run key destructors - OK" );
- return NULL;
+ rtems_task_delete( RTEMS_SELF );
}
-void *POSIX_Init(
- void *ignored
-)
+rtems_task Init(rtems_task_argument ignored)
{
- pthread_t thread;
- int sc;
- struct timespec delay_request;
+ rtems_id thread;
+ rtems_status_code rc;
+ int sc;
+ struct timespec delay_request;
puts( "\n\n*** TEST KEY 03 ***" );
@@ -65,9 +59,19 @@ void *POSIX_Init(
sc = pthread_key_create( &Key, NULL );
rtems_test_assert( !sc );
- puts( "Init - pthread_create - OK" );
- sc = pthread_create( &thread, NULL, Test_Thread, &sc );
- rtems_test_assert( !sc );
+ puts( "Init - create/start - OK" );
+ rc = rtems_task_create(
+ rtems_build_name( 'T', 'E', 'S', 'T' ),
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &thread
+ );
+ rtems_test_assert( rc == RTEMS_SUCCESSFUL );
+
+ rc = rtems_task_start( thread, Test_Thread, 0 );
+ rtems_test_assert( rc == RTEMS_SUCCESSFUL );
puts( "Init - sleep - let thread run - OK" );
delay_request.tv_sec = 0;
@@ -87,9 +91,19 @@ void *POSIX_Init(
sc = pthread_key_create( &Key, destructor );
rtems_test_assert( !sc );
- puts( "Init - pthread_create - OK" );
- sc = pthread_create( &thread, NULL, Test_Thread, NULL );
- rtems_test_assert( !sc );
+ puts( "Init - task create/start - OK" );
+ rc = rtems_task_create(
+ rtems_build_name( 'T', 'E', 'S', 'T' ),
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &thread
+ );
+ rtems_test_assert( rc == RTEMS_SUCCESSFUL );
+
+ rc = rtems_task_start( thread, Test_Thread, 0 );
+ rtems_test_assert( rc == RTEMS_SUCCESSFUL );
puts( "Init - sleep - let thread run - OK" );
sc = nanosleep( &delay_request, NULL );
@@ -111,10 +125,10 @@ void *POSIX_Init(
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
-#define CONFIGURE_MAXIMUM_POSIX_THREADS 2
+#define CONFIGURE_MAXIMUM_TASKS 2
#define CONFIGURE_MAXIMUM_POSIX_KEYS 1
-#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
diff --git a/testsuites/psxtests/psxkey03/psxkey03.scn b/testsuites/psxtests/psxkey03/psxkey03.scn
index 739cd35b2e..99c36175af 100644
--- a/testsuites/psxtests/psxkey03/psxkey03.scn
+++ b/testsuites/psxtests/psxkey03/psxkey03.scn
@@ -1,12 +1,15 @@
+sparc-rtems4.11-run is /home/joel/rtems-4.11-work/tools/bin/sparc-rtems4.11-run
+
+
*** TEST KEY 03 ***
Init - pthread_key_create with NULL destructor - OK
-Init - pthread_create - OK
+Init - create/start - OK
Init - sleep - let thread run - OK
Test_Thread - pthread_setspecific - OK
Test_Thread - pthread_exit to run key destructors - OK
Init - pthread_key_delete - OK
Init - pthread_key_create with non-NULL destructor - OK
-Init - pthread_create - OK
+Init - task create/start - OK
Init - sleep - let thread run - OK
Test_Thread - pthread_setspecific - OK
Test_Thread - pthread_exit to run key destructors - OK
diff --git a/testsuites/psxtests/psxkey04/init.c b/testsuites/psxtests/psxkey04/init.c
index 76540dd76f..67f0e988a1 100644
--- a/testsuites/psxtests/psxkey04/init.c
+++ b/testsuites/psxtests/psxkey04/init.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2012 Zhongwei Yao.
- * COPYRIGHT (c) 1989-2012.
+ * COPYRIGHT (c) 1989-2014.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -18,26 +18,20 @@
#include "pmacros.h"
/* forward declarations to avoid warnings */
-void *POSIX_Init(void *argument);
-void *Test_Thread1(void *argument);
-void *Test_Thread2(void *argument);
+rtems_task Init(rtems_task_argument argument);
+rtems_task Test_Thread1(rtems_task_argument argument);
+rtems_task Test_Thread2(rtems_task_argument argument);
-int Data_array[2] = {1, 2};
-pthread_t thread1, thread2;
+int Data_array[2] = {1, 2};
+rtems_id thread1, thread2;
pthread_key_t Key;
-void *Test_Thread1(
- void *argument
-)
+rtems_task Test_Thread1( rtems_task_argument argument )
{
- int sc;
- int *value;
+ int sc;
+ int *value;
struct timespec delay_request;
- /*
- * Detach ourselves so we don't wait for a join that won't happen.
- */
- pthread_detach( pthread_self() );
puts( "Test_Thread 1 - pthread_setspecific - OK" );
sc = pthread_setspecific( Key, &Data_array[0] );
@@ -53,19 +47,13 @@ void *Test_Thread1(
value = pthread_getspecific( Key );
rtems_test_assert( *value == Data_array[0] );
- return NULL;
+ rtems_task_delete( RTEMS_SELF );
}
-void *Test_Thread2(
- void *argument
-)
+rtems_task Test_Thread2( rtems_task_argument argument )
{
int sc;
int *value;
- /*
- * Detach ourselves so we don't wait for a join that won't happen.
- */
- pthread_detach( pthread_self() );
puts( "Test_Thread 2 - pthread_setspecific - OK" );
sc = pthread_setspecific( Key, &Data_array[1] );
@@ -75,15 +63,14 @@ void *Test_Thread2(
value = pthread_getspecific( Key );
rtems_test_assert( *value == Data_array[1] );
- return NULL;
+ rtems_task_delete( RTEMS_SELF );
}
-void *POSIX_Init(
- void *ignored
-)
+rtems_task Init( rtems_task_argument ignored )
{
- int sc;
- struct timespec delay_request;
+ int sc;
+ rtems_status_code rc;
+ struct timespec delay_request;
puts( "\n\n*** TEST KEY 04 ***" );
@@ -91,12 +78,32 @@ void *POSIX_Init(
sc = pthread_key_create( &Key, NULL );
rtems_test_assert( !sc );
- puts( "Init - pthread_create - OK" );
- sc = pthread_create( &thread1, NULL, Test_Thread1, NULL );
- rtems_test_assert( !sc );
-
- sc = pthread_create( &thread2, NULL, Test_Thread2, NULL );
- rtems_test_assert( !sc );
+ puts( "Init - create - OK" );
+ rc = rtems_task_create(
+ rtems_build_name( 'T', 'E', 'S', 'T' ),
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &thread1
+ );
+ rtems_test_assert( rc == RTEMS_SUCCESSFUL );
+
+ rc = rtems_task_start( thread1, Test_Thread1, 0 );
+ rtems_test_assert( rc == RTEMS_SUCCESSFUL );
+
+ rc = rtems_task_create(
+ rtems_build_name( 'T', 'E', 'S', 'T' ),
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &thread2
+ );
+ rtems_test_assert( rc == RTEMS_SUCCESSFUL );
+
+ rc = rtems_task_start( thread2, Test_Thread2, 0 );
+ rtems_test_assert( rc == RTEMS_SUCCESSFUL );
puts( "Init - sleep - let thread run - OK" );
delay_request.tv_sec = 0;
@@ -117,10 +124,10 @@ void *POSIX_Init(
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
-#define CONFIGURE_MAXIMUM_POSIX_THREADS 3
+#define CONFIGURE_MAXIMUM_TASKS 3
#define CONFIGURE_MAXIMUM_POSIX_KEYS 1
-#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
diff --git a/testsuites/psxtests/psxkey04/psxkey04.scn b/testsuites/psxtests/psxkey04/psxkey04.scn
index aa0500fcba..d6ab2b35a4 100644
--- a/testsuites/psxtests/psxkey04/psxkey04.scn
+++ b/testsuites/psxtests/psxkey04/psxkey04.scn
@@ -1,6 +1,9 @@
+sparc-rtems4.11-run is /home/joel/rtems-4.11-work/tools/bin/sparc-rtems4.11-run
+
+
*** TEST KEY 04 ***
Init - pthread_key_create - OK
-Init - pthread_create - OK
+Init - create - OK
Init - sleep - let thread run - OK
Test_Thread 1 - pthread_setspecific - OK
Test_Thread 1 - sleep - let thread 2 run - OK
diff --git a/testsuites/psxtests/psxkey05/init.c b/testsuites/psxtests/psxkey05/init.c
index 08d22b0cbd..155a9f5807 100644
--- a/testsuites/psxtests/psxkey05/init.c
+++ b/testsuites/psxtests/psxkey05/init.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2012 Zhongwei Yao.
- * COPYRIGHT (c) 1989-2012.
+ * COPYRIGHT (c) 1989-2014.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -18,11 +18,9 @@
#include "pmacros.h"
/* forward declarations to avoid warnings */
-void *POSIX_Init(void *argument);
+rtems_task Init( rtems_task_argument ignored );
-void *POSIX_Init(
- void *ignored
-)
+rtems_task Init( rtems_task_argument ignored )
{
pthread_key_t key1, key2;
int sc, *value;
@@ -69,12 +67,13 @@ void *POSIX_Init(
/* configuration information */
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
-#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
-#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
+#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_MAXIMUM_POSIX_KEYS 2
-#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
diff --git a/testsuites/psxtests/psxkey05/psxkey05.scn b/testsuites/psxtests/psxkey05/psxkey05.scn
index f352a36785..89127af466 100644
--- a/testsuites/psxtests/psxkey05/psxkey05.scn
+++ b/testsuites/psxtests/psxkey05/psxkey05.scn
@@ -1,10 +1,13 @@
+sparc-rtems4.11-run is /home/joel/rtems-4.11-work/tools/bin/sparc-rtems4.11-run
+
+
*** TEST KEY 05 ***
Init - pthread key1 create - OK
Init - pthread key2 create - OK
Init - key1 pthread_setspecific - OK
-Init - key1 pthread_getspecific - OK
Init - key2 pthread_setspecific - OK
+Init - key1 pthread_getspecific - OK
Init - key2 pthread_getspecific - OK
Init - pthread key1 delete - OK
Init - pthread key2 delete - OK
-*** END OF TEST KEY 05 *** \ No newline at end of file
+*** END OF TEST KEY 05 ***
diff --git a/testsuites/psxtests/psxkey06/init.c b/testsuites/psxtests/psxkey06/init.c
index 98b46a42be..baf07cc81c 100644
--- a/testsuites/psxtests/psxkey06/init.c
+++ b/testsuites/psxtests/psxkey06/init.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2012 Zhongwei Yao.
- * COPYRIGHT (c) 1989-2012.
+ * COPYRIGHT (c) 1989-2014.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -18,25 +18,19 @@
#include "pmacros.h"
/* forward declarations to avoid warnings */
-void *POSIX_Init(void *argument);
-void *Test_Thread1(void *argument);
-void *Test_Thread2(void *argument);
+rtems_task Init(rtems_task_argument argument);
+rtems_task Test_Thread1(rtems_task_argument argument);
+rtems_task Test_Thread2(rtems_task_argument argument);
int Data_array[4] = {1, 2, 3, 4};
pthread_key_t key1, key2;
-void *Test_Thread1(
- void *argument
-)
+rtems_task Test_Thread1( rtems_task_argument argument )
{
int sc;
int *value;
struct timespec delay_request;
- /*
- * Detach ourselves so we don't wait for a join that won't happen.
- */
- pthread_detach( pthread_self() );
puts( "Test_Thread 1 - key1 pthread_setspecific - OK" );
sc = pthread_setspecific( key1, &Data_array[0] );
@@ -60,19 +54,13 @@ void *Test_Thread1(
value = pthread_getspecific( key2 );
rtems_test_assert( *value == Data_array[1] );
- return NULL;
+ rtems_task_delete( RTEMS_SELF );
}
-void *Test_Thread2(
- void *argument
-)
+rtems_task Test_Thread2( rtems_task_argument argument )
{
int sc;
int *value;
- /*
- * Detach ourselves so we don't wait for a join that won't happen.
- */
- pthread_detach( pthread_self() );
puts( "Test_Thread 2 - key1 pthread_setspecific - OK" );
sc = pthread_setspecific( key1, &Data_array[2] );
@@ -90,16 +78,16 @@ void *Test_Thread2(
value = pthread_getspecific( key2 );
rtems_test_assert( *value == Data_array[3] );
- return NULL;
+ rtems_task_delete( RTEMS_SELF );
}
-void *POSIX_Init(
- void *ignored
-)
+rtems_task Init( rtems_task_argument ignored )
{
- pthread_t thread1, thread2;
- int sc;
- struct timespec delay_request;
+ rtems_id thread1;
+ rtems_id thread2;
+ rtems_status_code rc;
+ int sc;
+ struct timespec delay_request;
puts( "\n\n*** TEST KEY 06 ***" );
@@ -111,13 +99,33 @@ void *POSIX_Init(
sc = pthread_key_create( &key2, NULL );
rtems_test_assert( !sc );
- puts( "Init - pthread1 create - OK" );
- sc = pthread_create( &thread1, NULL, Test_Thread1, NULL );
- rtems_test_assert( !sc );
-
- puts( "Init - pthread2 create - OK" );
- sc = pthread_create( &thread2, NULL, Test_Thread2, NULL );
- rtems_test_assert( !sc );
+ puts( "Init - thread1 create - OK" );
+ rc = rtems_task_create(
+ rtems_build_name( 'T', 'E', 'S', 'T' ),
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &thread1
+ );
+ rtems_test_assert( rc == RTEMS_SUCCESSFUL );
+
+ rc = rtems_task_start( thread1, Test_Thread1, 0 );
+ rtems_test_assert( rc == RTEMS_SUCCESSFUL );
+
+ puts( "Init - thread2 create - OK" );
+ rc = rtems_task_create(
+ rtems_build_name( 'T', 'E', 'S', 'T' ),
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &thread2
+ );
+ rtems_test_assert( rc == RTEMS_SUCCESSFUL );
+
+ rc = rtems_task_start( thread2, Test_Thread2, 0 );
+ rtems_test_assert( rc == RTEMS_SUCCESSFUL );
puts( "Init - sleep - let thread run - OK" );
delay_request.tv_sec = 0;
@@ -142,10 +150,10 @@ void *POSIX_Init(
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
-#define CONFIGURE_MAXIMUM_POSIX_THREADS 3
+#define CONFIGURE_MAXIMUM_TASKS 3
#define CONFIGURE_MAXIMUM_POSIX_KEYS 2
-#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
diff --git a/testsuites/psxtests/psxkey07/init.c b/testsuites/psxtests/psxkey07/init.c
index e911dc77d9..b2aabb7a2b 100644
--- a/testsuites/psxtests/psxkey07/init.c
+++ b/testsuites/psxtests/psxkey07/init.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2012 Zhongwei Yao.
- * COPYRIGHT (c) 1989-2012.
+ * COPYRIGHT (c) 1989-2014.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -19,8 +19,8 @@
#include "pmacros.h"
/* forward declarations to avoid warnings */
-void *POSIX_Init(void *argument);
-void *Test_Thread(void *argument);
+rtems_task Init(rtems_task_argument argument);
+rtems_task Test_Thread(rtems_task_argument argument);
pthread_key_t Key;
int created_thread_count, setted_thread_count, got_thread_count;
@@ -28,17 +28,15 @@ int all_thread_created;
pthread_mutex_t mutex1, mutex2;
pthread_cond_t create_condition_var, set_condition_var;
-void *Test_Thread(
- void *argument
-)
+rtems_task Test_Thread(rtems_task_argument argument)
{
int sc;
int *value_p, *value_p2;
value_p = malloc( sizeof( int ) );
- //printf( "Test_Thread%d - Key pthread_setspecific - OK\n", (int)pthread_self() );
sc = pthread_setspecific( Key, value_p );
rtems_test_assert( !sc );
+
pthread_mutex_lock( &mutex1 );
++setted_thread_count;
pthread_cond_signal( &set_condition_var );
@@ -52,21 +50,20 @@ void *Test_Thread(
pthread_cond_wait( &create_condition_var, &mutex2 );
pthread_mutex_unlock( &mutex2 );
- //printf( "Test_Thread%d - Key pthread_getspecific - OK\n", (int)pthread_self() );
value_p2 = pthread_getspecific( Key );
rtems_test_assert( value_p == value_p2 );
++got_thread_count;
- return NULL;
+ rtems_task_delete( RTEMS_SELF );
}
-void *POSIX_Init(
- void *ignored
-)
+rtems_task Init(rtems_task_argument argument)
{
- pthread_t *thread_p;
- int sc;
- struct timespec delay_request;
+ rtems_id *thread_p;
+ rtems_status_code rc;
+ int sc;
+ struct timespec delay_request;
+
all_thread_created = 0;
puts( "\n\n*** TEST KEY 07 ***" );
@@ -74,12 +71,15 @@ void *POSIX_Init(
puts( "Init - Mutex 1 create - OK" );
sc = pthread_mutex_init( &mutex1, NULL );
rtems_test_assert( !sc );
+
puts( "Init - Mutex 2 create - OK" );
sc = pthread_mutex_init( &mutex2, NULL );
rtems_test_assert( !sc );
+
puts( "Init - Condition variable 1 create - OK" );
sc = pthread_cond_init( &create_condition_var, NULL );
rtems_test_assert( !sc );
+
puts( "Init - Condition variable 2 create - OK" );
sc = pthread_cond_init( &set_condition_var, NULL );
rtems_test_assert( !sc );
@@ -88,34 +88,54 @@ void *POSIX_Init(
sc = pthread_key_create( &Key, NULL );
rtems_test_assert( !sc );
- for( ; ; )
- {
- thread_p = malloc( sizeof( pthread_t ) );
- rtems_test_assert( thread_p );
- pthread_mutex_lock( &mutex1 );
- sc = pthread_create( thread_p, NULL, Test_Thread, NULL );
- rtems_test_assert( ( sc == 0 ) || ( sc == EAGAIN ) );
- /**
- * check if return is EAGAIN, it means RTEMS Workspace RAM
- * have been exhausted.
- */
- if ( sc == EAGAIN )
- {
- pthread_mutex_unlock( &mutex1 );
- break;
- }
- ++created_thread_count;
- /**
- * wait for test thread set key, the while loop here is used to
- * avoid suprious wakeup.
- */
- while( created_thread_count > setted_thread_count )
- pthread_cond_wait( &set_condition_var, &mutex1 );
+ for ( ; ; ) {
+ thread_p = malloc( sizeof( rtems_id ) );
+ rtems_test_assert( thread_p );
+ pthread_mutex_lock( &mutex1 );
+
+ rc = rtems_task_create(
+ rtems_build_name( 'T', 'E', 'S', 'T' ),
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ thread_p
+ );
+ rtems_test_assert(
+ ( rc == RTEMS_SUCCESSFUL ) || ( rc == RTEMS_UNSATISFIED )
+ );
+
+ if ( rc == RTEMS_SUCCESSFUL ) {
+ rc = rtems_task_start( *thread_p, Test_Thread, 0 );
+ rtems_test_assert( rc == RTEMS_SUCCESSFUL );
+ }
+
+ /**
+ * check if return is EAGAIN, it means RTEMS Workspace RAM
+ * have been exhausted.
+ */
+ if ( rc == RTEMS_UNSATISFIED ) {
pthread_mutex_unlock( &mutex1 );
+ break;
}
- printf( "Init - %d pthreads have been created - OK\n", created_thread_count );
- printf( "Init - %d pthreads have been setted key data - OK\n", setted_thread_count );
+ ++created_thread_count;
+
+ /**
+ * wait for test thread set key, the while loop here is used to
+ * avoid suprious wakeup.
+ */
+ while( created_thread_count > setted_thread_count )
+ pthread_cond_wait( &set_condition_var, &mutex1 );
+ pthread_mutex_unlock( &mutex1 );
+ }
+ printf(
+ "Init - %d pthreads have been created - OK\n"
+ "Init - %d pthreads have been setted key data - OK\n",
+ created_thread_count,
+ setted_thread_count
+ );
rtems_test_assert( created_thread_count == setted_thread_count );
+
/* unblock all created pthread to let them set key data.*/
pthread_mutex_lock( &mutex2 );
all_thread_created = 1;
@@ -128,8 +148,12 @@ void *POSIX_Init(
sc = nanosleep( &delay_request, NULL );
rtems_test_assert( !sc );
- printf( "Init - %d pthreads have been got key data - OK\n", got_thread_count );
+ printf(
+ "Init - %d pthreads have been got key data - OK\n",
+ got_thread_count
+ );
rtems_test_assert( created_thread_count == got_thread_count );
+
puts( "Init - pthread Key delete - OK" );
sc = pthread_key_delete( Key );
rtems_test_assert( sc == 0 );
@@ -137,12 +161,15 @@ void *POSIX_Init(
puts( "Init - Mutex1 delete - OK" );
sc = pthread_mutex_destroy( &mutex1 );
rtems_test_assert( !sc );
+
puts( "Init - Mutex2 delete - OK" );
sc = pthread_mutex_destroy( &mutex2 );
rtems_test_assert( !sc );
+
puts( "Init - Condition variable 1 delete - OK" );
sc = pthread_cond_destroy( &create_condition_var );
rtems_test_assert( !sc );
+
puts( "Init - Condition variable 2 delete - OK" );
sc = pthread_cond_destroy( &set_condition_var );
rtems_test_assert( !sc );
@@ -156,16 +183,13 @@ void *POSIX_Init(
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
-
-#define CONFIGURE_MAXIMUM_POSIX_THREADS rtems_resource_unlimited(10)
-#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 2
+#define CONFIGURE_MAXIMUM_TASKS rtems_resource_unlimited(10)
+#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 2
#define CONFIGURE_MAXIMUM_POSIX_KEYS 1
#define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 2
#define CONFIGURE_UNIFIED_WORK_AREAS
-
-
-#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
diff --git a/testsuites/psxtests/psxkey07/psxkey07.scn b/testsuites/psxtests/psxkey07/psxkey07.scn
index 851876fce1..f079a2dc5f 100644
--- a/testsuites/psxtests/psxkey07/psxkey07.scn
+++ b/testsuites/psxtests/psxkey07/psxkey07.scn
@@ -1,3 +1,4 @@
+sparc-rtems4.11-run is /home/joel/rtems-4.11-work/tools/bin/sparc-rtems4.11-run
*** TEST KEY 07 ***
@@ -6,10 +7,10 @@ Init - Mutex 2 create - OK
Init - Condition variable 1 create - OK
Init - Condition variable 2 create - OK
Init - pthread Key create - OK
-Init - 380 pthreads have been created - OK
-Init - 380 pthreads have been setted key data - OK
+Init - 719 pthreads have been created - OK
+Init - 719 pthreads have been setted key data - OK
Init - sleep - let threads run - OK
-Init - 380 pthreads have been got key data - OK
+Init - 719 pthreads have been got key data - OK
Init - pthread Key delete - OK
Init - Mutex1 delete - OK
Init - Mutex2 delete - OK
diff --git a/testsuites/psxtests/psxkey08/init.c b/testsuites/psxtests/psxkey08/init.c
index 81f4378828..2c74d23c18 100644
--- a/testsuites/psxtests/psxkey08/init.c
+++ b/testsuites/psxtests/psxkey08/init.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2012 Zhongwei Yao.
- * COPYRIGHT (c) 1989-2012.
+ * COPYRIGHT (c) 1989-2014.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -36,7 +36,6 @@ rtems_task test_task(rtems_task_argument arg)
int *value_p, *value_p2;
value_p = malloc( sizeof( int ) );
- //printf( "Test_Task%d - Key pthread_setspecific - OK\n", (int)rtems_task_self() );
sc = pthread_setspecific( Key, value_p );
rtems_test_assert( !sc );
++setted_task_count;
@@ -47,12 +46,11 @@ rtems_task test_task(rtems_task_argument arg)
*/
rtems_semaphore_obtain( sema2 , RTEMS_WAIT, 0 );
- //printf( "Test_Task%d - Key pthread_getspecific - OK\n", (int)rtems_task_self() );
value_p2 = pthread_getspecific( Key );
rtems_test_assert( value_p == value_p2 );
++got_task_count;
- pthread_exit( 0 );
+ rtems_task_delete( RTEMS_SELF );
}
rtems_task Init(rtems_task_argument arg)
@@ -67,54 +65,69 @@ rtems_task Init(rtems_task_argument arg)
puts( "Init - Semaphore 1 create - OK" );
name1 = rtems_build_name('S', 'E', 'M', '1');
- sc = rtems_semaphore_create( name1, 0,
- RTEMS_SIMPLE_BINARY_SEMAPHORE |
- RTEMS_FIFO,
- 0, &sema1 );
+ sc = rtems_semaphore_create(
+ name1, 0,
+ RTEMS_SIMPLE_BINARY_SEMAPHORE | RTEMS_FIFO,
+ 0,
+ &sema1
+ );
rtems_test_assert( sc == RTEMS_SUCCESSFUL );
puts( "Init - Semaphore 2 create - OK" );
name2 = rtems_build_name('S', 'E', 'M', '2');
- sc = rtems_semaphore_create( name2, 0,
- RTEMS_SIMPLE_BINARY_SEMAPHORE |
- RTEMS_FIFO,
- 0, &sema2 );
+ sc = rtems_semaphore_create(
+ name2,
+ 0,
+ RTEMS_SIMPLE_BINARY_SEMAPHORE | RTEMS_FIFO,
+ 0,
+ &sema2
+ );
rtems_test_assert( sc == RTEMS_SUCCESSFUL );
puts( "Init - pthread Key create - OK" );
sc = pthread_key_create( &Key, NULL );
rtems_test_assert( !sc );
- for( ; ; )
- {
- task_id_p = malloc( sizeof( rtems_id ) );
- rtems_test_assert( task_id_p );
- sc = rtems_task_create(
- rtems_build_name('T','A',created_task_count, ' '),
- 1,
- RTEMS_MINIMUM_STACK_SIZE,
- RTEMS_DEFAULT_MODES,
- RTEMS_DEFAULT_ATTRIBUTES,
- task_id_p
- );
- rtems_test_assert( (sc == RTEMS_UNSATISFIED) || (sc == RTEMS_TOO_MANY) || (sc == RTEMS_SUCCESSFUL) );
- /**
- * when return is RTEMS_TOO_MANY or RTEMS_UNSATISFIED, there is not
- * enough source to create task.
- */
- if ( (sc == RTEMS_TOO_MANY) || (sc == RTEMS_UNSATISFIED) )
- {
- break;
- }
- ++created_task_count;
- sc = rtems_task_start( *task_id_p, test_task, 0 );
- rtems_test_assert( sc == RTEMS_SUCCESSFUL );
- sc = rtems_semaphore_obtain( sema1, RTEMS_WAIT, 0 );
- rtems_test_assert( sc == RTEMS_SUCCESSFUL );
+ for ( ; ; ) {
+ task_id_p = malloc( sizeof( rtems_id ) );
+ rtems_test_assert( task_id_p );
+
+ sc = rtems_task_create(
+ rtems_build_name('T','A',created_task_count, ' '),
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ task_id_p
+ );
+ rtems_test_assert(
+ (sc == RTEMS_UNSATISFIED) ||
+ (sc == RTEMS_TOO_MANY) ||
+ (sc == RTEMS_SUCCESSFUL)
+ );
+
+ /**
+ * when return is RTEMS_TOO_MANY or RTEMS_UNSATISFIED, there is not
+ * enough source to create task.
+ */
+ if ( (sc == RTEMS_TOO_MANY) || (sc == RTEMS_UNSATISFIED) ) {
+ break;
}
+ ++created_task_count;
- printf( "Init - %d tasks have been created - OK\n", created_task_count );
- printf( "Init - %d tasks have been setted key data - OK\n", setted_task_count );
+ sc = rtems_task_start( *task_id_p, test_task, 0 );
+ rtems_test_assert( sc == RTEMS_SUCCESSFUL );
+
+ sc = rtems_semaphore_obtain( sema1, RTEMS_WAIT, 0 );
+ rtems_test_assert( sc == RTEMS_SUCCESSFUL );
+ }
+
+ printf(
+ "Init - %d tasks have been created - OK\n"
+ "Init - %d tasks have been setted key data - OK\n",
+ setted_task_count,
+ created_task_count
+ );
rtems_test_assert( created_task_count == setted_task_count );
/* unblock all created tasks to let them set key data.*/
@@ -146,7 +159,7 @@ rtems_task Init(rtems_task_argument arg)
/* configuration information */
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
-#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_TASKS rtems_resource_unlimited(5)
#define CONFIGURE_MAXIMUM_SEMAPHORES 2
diff --git a/testsuites/psxtests/psxkey08/psxkey08.scn b/testsuites/psxtests/psxkey08/psxkey08.scn
index a4f1be4959..64f23f8829 100644
--- a/testsuites/psxtests/psxkey08/psxkey08.scn
+++ b/testsuites/psxtests/psxkey08/psxkey08.scn
@@ -1,14 +1,15 @@
+sparc-rtems4.11-run is /home/joel/rtems-4.11-work/tools/bin/sparc-rtems4.11-run
*** TEST KEY 08 ***
Init - Semaphore 1 create - OK
Init - Semaphore 2 create - OK
Init - pthread Key create - OK
-Init - 651 tasks have been created - OK
-Init - 651 tasks have been setted key data - OK
+Init - 720 tasks have been created - OK
+Init - 720 tasks have been setted key data - OK
Init - flush semaphore 2 - OK
Init - sleep to yield processor - OK
-Init - 651 Tasks have been got key data - OK
+Init - 720 Tasks have been got key data - OK
Init - pthread Key delete - OK
Init - semaphore 1 delete - OK
Init - semaphore 2 delete - OK
diff --git a/testsuites/psxtests/psxkey09/init.c b/testsuites/psxtests/psxkey09/init.c
index a44f0e36ca..9aa5e73efb 100644
--- a/testsuites/psxtests/psxkey09/init.c
+++ b/testsuites/psxtests/psxkey09/init.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2012 Zhongwei Yao.
- * COPYRIGHT (c) 1989-2012.
+ * COPYRIGHT (c) 1989-2014.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -19,9 +19,9 @@
/* forward declarations to avoid warnings */
-void *POSIX_Init(void *argument);
+rtems_task Init(rtems_task_argument argument);
+rtems_task Test_Thread(rtems_task_argument argument);
void destructor(void *value);
-void *Test_Thread(void *argument);
int Data_array[1] = {1};
@@ -33,32 +33,25 @@ void destructor(void *value)
destructor_ran = true;
}
-void *Test_Thread(
- void *argument
-)
+rtems_task Test_Thread( rtems_task_argument arg )
{
- int sc;
-
- /**
- * Detach ourselves to release test thread's resource after thread exit.
- */
- pthread_detach( pthread_self() );
+ void *argument = (void *)arg;
+ int sc;
puts( "Test_Thread - key pthread_setspecific - OK" );
sc = pthread_setspecific( key, argument );
rtems_test_assert( !sc );
puts( "Test_Thread - pthread_exit to run key destructors - OK" );
- return NULL;
+ rtems_task_delete( RTEMS_SELF );
}
-void *POSIX_Init(
- void *ignored
-)
+rtems_task Init( rtems_task_argument ignored )
{
- pthread_t thread;
- int sc;
- struct timespec delay_request;
+ rtems_id thread;
+ rtems_status_code rc;
+ int sc;
+ struct timespec delay_request;
puts( "\n\n*** TEST KEY 09 ***" );
@@ -66,9 +59,19 @@ void *POSIX_Init(
sc = pthread_key_create( &key, destructor );
rtems_test_assert( !sc );
- puts( "Init - pthread create - OK" );
- sc = pthread_create( &thread, NULL, Test_Thread, &sc );
- rtems_test_assert( !sc );
+ puts( "Init - thread create - OK" );
+ rc = rtems_task_create(
+ rtems_build_name( 'T', 'E', 'S', 'T' ),
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &thread
+ );
+ rtems_test_assert( rc == RTEMS_SUCCESSFUL );
+
+ rc = rtems_task_start( thread, Test_Thread, (rtems_task_argument)Data_array );
+ rtems_test_assert( rc == RTEMS_SUCCESSFUL );
puts( "Init - sleep - let thread run - OK" );
delay_request.tv_sec = 0;
@@ -92,10 +95,10 @@ void *POSIX_Init(
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
-#define CONFIGURE_MAXIMUM_POSIX_THREADS 2
+#define CONFIGURE_MAXIMUM_TASKS 2
#define CONFIGURE_MAXIMUM_POSIX_KEYS 1
-#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
diff --git a/testsuites/psxtests/psxkey09/psxkey09.scn b/testsuites/psxtests/psxkey09/psxkey09.scn
index 707c7d63b1..6ed6bd309a 100644
--- a/testsuites/psxtests/psxkey09/psxkey09.scn
+++ b/testsuites/psxtests/psxkey09/psxkey09.scn
@@ -1,6 +1,9 @@
+sparc-rtems4.11-run is /home/joel/rtems-4.11-work/tools/bin/sparc-rtems4.11-run
+
+
*** TEST KEY 09 ***
Init - pthread key create with destructor - OK
-Init - pthread create - OK
+Init - thread create - OK
Init - sleep - let thread run - OK
Test_Thread - key pthread_setspecific - OK
Test_Thread - pthread_exit to run key destructors - OK
diff --git a/testsuites/psxtests/psxkey10/init.c b/testsuites/psxtests/psxkey10/init.c
index eee0c18d8d..edbf6c375c 100644
--- a/testsuites/psxtests/psxkey10/init.c
+++ b/testsuites/psxtests/psxkey10/init.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2012 Zhongwei Yao.
- * COPYRIGHT (c) 1989-2012.
+ * COPYRIGHT (c) 1989-2014.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -18,9 +18,10 @@
#include "pmacros.h"
/* forward declarations to avoid warnings */
-void *POSIX_Init(void *argument);
+rtems_task Init(rtems_task_argument argument);
+rtems_task Test_Thread(rtems_task_argument argument);
+
void destructor(void *value);
-void *Test_Thread(void *argument);
int Data_array[1] = {1};
@@ -32,17 +33,11 @@ void destructor(void *value)
destructor_ran = true;
}
-void *Test_Thread(
- void *argument
-)
+rtems_task Test_Thread( rtems_task_argument arg )
{
+ void *argument = (void *) arg;
int sc;
- /**
- * Detach ourselves to release test thread's resource after thread exit.
- */
- pthread_detach( pthread_self() );
-
puts( "Test_Thread - key pthread_setspecific - OK" );
sc = pthread_setspecific( key, argument );
rtems_test_assert( !sc );
@@ -51,17 +46,16 @@ void *Test_Thread(
sc = pthread_key_delete( key );
rtems_test_assert( sc == 0 );
- puts( "Test_Thread - pthread exit, but don't run key destructors - OK" );
- return NULL;
+ puts( "Test_Thread - exit but don't run key destructors - OK" );
+ rtems_task_delete( RTEMS_SELF );
}
-void *POSIX_Init(
- void *ignored
-)
+rtems_task Init( rtems_task_argument ignored )
{
- pthread_t thread;
- int sc;
- struct timespec delay_request;
+ rtems_id thread;
+ rtems_status_code rc;
+ int sc;
+ struct timespec delay_request;
puts( "\n\n*** TEST KEY 10 ***" );
@@ -69,9 +63,19 @@ void *POSIX_Init(
sc = pthread_key_create( &key, destructor );
rtems_test_assert( !sc );
- puts( "Init - pthread create - OK" );
- sc = pthread_create( &thread, NULL, Test_Thread, &sc );
- rtems_test_assert( !sc );
+ puts( "Init - thread create - OK" );
+ rc = rtems_task_create(
+ rtems_build_name( 'T', 'E', 'S', 'T' ),
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &thread
+ );
+ rtems_test_assert( rc == RTEMS_SUCCESSFUL );
+
+ rc = rtems_task_start( thread, Test_Thread, 0 );
+ rtems_test_assert( rc == RTEMS_SUCCESSFUL );
puts( "Init - sleep - let thread run - OK" );
delay_request.tv_sec = 0;
@@ -95,10 +99,10 @@ void *POSIX_Init(
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
-#define CONFIGURE_MAXIMUM_POSIX_THREADS 2
+#define CONFIGURE_MAXIMUM_TASKS 2
#define CONFIGURE_MAXIMUM_POSIX_KEYS 1
-#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
diff --git a/testsuites/psxtests/psxkey10/psxkey10.scn b/testsuites/psxtests/psxkey10/psxkey10.scn
index 98940e24ad..10c403057d 100644
--- a/testsuites/psxtests/psxkey10/psxkey10.scn
+++ b/testsuites/psxtests/psxkey10/psxkey10.scn
@@ -1,10 +1,12 @@
+sparc-rtems4.11-run is /home/joel/rtems-4.11-work/tools/bin/sparc-rtems4.11-run
+
*** TEST KEY 10 ***
Init - pthread key create with destructor - OK
-Init - pthread create - OK
+Init - thread create - OK
Init - sleep - let thread run - OK
Test_Thread - key pthread_setspecific - OK
Test_Thread - pthread key delete - OK
-Test_Thread - pthread exit, but don't run key destructors - OK
+Test_Thread - exit but don't run key destructors - OK
Init - verify destructor did NOT run - OK
*** END OF TEST KEY 10 ***