summaryrefslogtreecommitdiffstats
path: root/testsuites
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2023-08-04 09:56:37 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2023-08-04 09:56:37 +0200
commite02be3a8d133b1beb00a1789935e2c55d4a978cd (patch)
tree734e06f236d3df656591a59b8af5116c7f204f79 /testsuites
parentbuild: Add PROGRAM_PREFIX option (diff)
downloadrtems-e02be3a8d133b1beb00a1789935e2c55d4a978cd.tar.bz2
psxkey07: Fix POSIX key value pair configuration
Make sure we have enough POSIX key value pairs available. This fixes a test failure on some targets. Make objects and functions static. Initialize variable to get rid of warnings.
Diffstat (limited to 'testsuites')
-rw-r--r--testsuites/psxtests/psxkey07/init.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/testsuites/psxtests/psxkey07/init.c b/testsuites/psxtests/psxkey07/init.c
index 15387264ba..ff7b3a0bd0 100644
--- a/testsuites/psxtests/psxkey07/init.c
+++ b/testsuites/psxtests/psxkey07/init.c
@@ -39,32 +39,27 @@
const char rtems_test_name[] = "PSXKEY 7";
-/* forward declarations to avoid warnings */
-rtems_task Init(rtems_task_argument argument);
-rtems_task Test_Thread(rtems_task_argument argument);
+#define INITIAL_TASK_COUNT 10
-pthread_key_t Key;
-int created_thread_count, setted_thread_count, got_thread_count;
-int all_thread_created;
-pthread_mutex_t mutex1, mutex2;
-pthread_cond_t create_condition_var, set_condition_var;
+#define ADDITIONAL_TASK_COUNT 13
-rtems_task Test_Thread(rtems_task_argument argument)
+static pthread_key_t Key;
+static int created_thread_count, setted_thread_count, got_thread_count;
+static int all_thread_created;
+static pthread_mutex_t mutex1, mutex2;
+static pthread_cond_t create_condition_var, set_condition_var;
+
+static rtems_task Test_Thread(rtems_task_argument argument)
{
int sc;
int *value_p, *value_p2;
value_p = malloc( sizeof( int ) );
rtems_test_assert(value_p != NULL);
-/*
- * This was added to address the following warning.
- * warning: 'value_p' may be used uninitialized
- */
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
- sc = pthread_setspecific( Key, value_p );
-#pragma GCC diagnostic pop
- rtems_test_assert( !sc );
+
+ *value_p = 123;
+ sc = pthread_setspecific( Key, value_p );
+ rtems_test_assert( !sc );
pthread_mutex_lock( &mutex1 );
++setted_thread_count;
@@ -86,12 +81,13 @@ rtems_task Test_Thread(rtems_task_argument argument)
rtems_task_exit();
}
-rtems_task Init(rtems_task_argument argument)
+static rtems_task Init(rtems_task_argument argument)
{
rtems_status_code rc;
int sc;
struct timespec delay_request;
- uintptr_t max_free_size = 13 * RTEMS_MINIMUM_STACK_SIZE;
+ uintptr_t max_free_size =
+ ADDITIONAL_TASK_COUNT * RTEMS_MINIMUM_STACK_SIZE;
void *greedy;
all_thread_created = 0;
@@ -222,8 +218,10 @@ rtems_task Init(rtems_task_argument argument)
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
-#define CONFIGURE_MAXIMUM_TASKS rtems_resource_unlimited(10)
-#define CONFIGURE_MAXIMUM_POSIX_KEYS 1
+#define CONFIGURE_MAXIMUM_TASKS rtems_resource_unlimited(INITIAL_TASK_COUNT)
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 1
+#define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS \
+ (INITIAL_TASK_COUNT + ADDITIONAL_TASK_COUNT)
#define CONFIGURE_UNIFIED_WORK_AREAS
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE