summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests/psxkey01
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/psxtests/psxkey01
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/psxtests/psxkey01')
-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
5 files changed, 16 insertions, 88 deletions
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 */
-}