summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/psxtests')
-rw-r--r--testsuites/psxtests/psx08/init.c118
-rw-r--r--testsuites/psxtests/psx12/init.c2
-rw-r--r--testsuites/psxtests/psx13/test.c2
-rw-r--r--testsuites/psxtests/psx15/init.c2
-rw-r--r--testsuites/psxtests/psxbarrier01/test.c2
-rw-r--r--testsuites/psxtests/psxchroot01/test.c2
-rw-r--r--testsuites/psxtests/psxcleanup02/init.c2
-rw-r--r--testsuites/psxtests/psxcleanup02/main.c2
-rw-r--r--testsuites/psxtests/psxclock/init.c172
-rw-r--r--testsuites/psxtests/psxclockrealtime01/init.c2
-rw-r--r--testsuites/psxtests/psxconfig01/init.c4
-rw-r--r--testsuites/psxtests/psxconfig01/psxconfig01.doc2
-rw-r--r--testsuites/psxtests/psxenosys/init.c10
-rw-r--r--testsuites/psxtests/psxenosys/psxenosys.scn2
-rw-r--r--testsuites/psxtests/psxftw01/init.c64
-rw-r--r--testsuites/psxtests/psxglobalcon01/init.cc2
-rw-r--r--testsuites/psxtests/psxglobalcon02/init.cc2
-rw-r--r--testsuites/psxtests/psxhdrs/arpa/inet/inet_ntop.c2
-rw-r--r--testsuites/psxtests/psxhdrs/fcntl/openat.c4
-rw-r--r--testsuites/psxtests/psxhdrs/netdb/gethostbyaddr.c2
-rw-r--r--testsuites/psxtests/psxhdrs/pthread/pthread_attr_getdetachstate.c4
-rw-r--r--testsuites/psxtests/psxhdrs/pthread/pthread_attr_getguardsize.c4
-rw-r--r--testsuites/psxtests/psxhdrs/pthread/pthread_attr_getinheritsched.c4
-rw-r--r--testsuites/psxtests/psxhdrs/pthread/pthread_attr_getschedparam.c4
-rw-r--r--testsuites/psxtests/psxhdrs/pthread/pthread_attr_getschedpolicy.c4
-rw-r--r--testsuites/psxtests/psxhdrs/pthread/pthread_attr_getscope.c4
-rw-r--r--testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstack.c2
-rw-r--r--testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstackaddr.c2
-rw-r--r--testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstacksize.c4
-rw-r--r--testsuites/psxtests/psxhdrs/pthread/pthread_attr_setschedparam.c4
-rw-r--r--testsuites/psxtests/psxhdrs/pthread/pthread_cond_init.c2
-rw-r--r--testsuites/psxtests/psxhdrs/pthread/pthread_cond_timedwait.c2
-rw-r--r--testsuites/psxtests/psxhdrs/pthread/pthread_condattr_getpshared.c2
-rw-r--r--testsuites/psxtests/psxhdrs/pthread/pthread_create.c2
-rw-r--r--testsuites/psxtests/psxhdrs/pthread/pthread_mutex_getprioceiling.c4
-rw-r--r--testsuites/psxtests/psxhdrs/pthread/pthread_mutex_init.c2
-rw-r--r--testsuites/psxtests/psxhdrs/pthread/pthread_mutex_timedlock.c2
-rw-r--r--testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_getprioceiling.c2
-rw-r--r--testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_getprotocol.c4
-rw-r--r--testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_getpshared.c4
-rw-r--r--testsuites/psxtests/psxhdrs/sys/select/pselect.c4
-rw-r--r--testsuites/psxtests/psxhdrs/sys/socket/bind.c2
-rw-r--r--testsuites/psxtests/psxhdrs/sys/socket/connect.c6
-rw-r--r--testsuites/psxtests/psxhdrs/sys/socket/getsockopt.c2
-rw-r--r--testsuites/psxtests/psxhdrs/sys/socket/send.c2
-rw-r--r--testsuites/psxtests/psxhdrs/sys/socket/sendmsg.c2
-rw-r--r--testsuites/psxtests/psxhdrs/sys/socket/sendto.c4
-rw-r--r--testsuites/psxtests/psxhdrs/sys/socket/setsockopt.c2
-rw-r--r--testsuites/psxtests/psxhdrs/sys/stat/futimens.c4
-rw-r--r--testsuites/psxtests/psxhdrs/sys/stat/utimensat.c4
-rw-r--r--testsuites/psxtests/psxhdrs/sys/time/utimes.c8
-rw-r--r--testsuites/psxtests/psxhdrs/termios/cfgetispeed.c4
-rw-r--r--testsuites/psxtests/psxhdrs/termios/cfgetospeed.c4
-rw-r--r--testsuites/psxtests/psxhdrs/termios/cfsetispeed.c4
-rw-r--r--testsuites/psxtests/psxhdrs/termios/cfsetospeed.c4
-rw-r--r--testsuites/psxtests/psxhdrs/termios/tcgetattr.c4
-rw-r--r--testsuites/psxtests/psxhdrs/termios/tcsetattr.c4
-rw-r--r--testsuites/psxtests/psxhdrs/time/asctime.c2
-rw-r--r--testsuites/psxtests/psxhdrs/time/asctime_r.c2
-rw-r--r--testsuites/psxtests/psxhdrs/time/clock_settime.c2
-rw-r--r--testsuites/psxtests/psxhdrs/time/ctime.c2
-rw-r--r--testsuites/psxtests/psxhdrs/time/ctime_r.c2
-rw-r--r--testsuites/psxtests/psxhdrs/time/gmtime.c2
-rw-r--r--testsuites/psxtests/psxhdrs/time/gmtime_r.c2
-rw-r--r--testsuites/psxtests/psxhdrs/time/localtime.c2
-rw-r--r--testsuites/psxtests/psxhdrs/time/localtime_r.c2
-rw-r--r--testsuites/psxtests/psxhdrs/time/strftime.c2
-rw-r--r--testsuites/psxtests/psxhdrs/unistd/setgroups.c2
-rw-r--r--testsuites/psxtests/psxhdrs/utime/utime.c2
-rw-r--r--testsuites/psxtests/psxhdrs/wchar/mbsinit.c4
-rw-r--r--testsuites/psxtests/psxintrcritical01/init.c2
-rw-r--r--testsuites/psxtests/psxkey07/init.c34
-rw-r--r--testsuites/psxtests/psxkey08/init.c2
-rw-r--r--testsuites/psxtests/psxmount/test.c2
-rw-r--r--testsuites/psxtests/psxmsgq01/init.c2
-rw-r--r--testsuites/psxtests/psxonce01/init.c2
-rw-r--r--testsuites/psxtests/psxonce01/psxonce01.doc2
-rw-r--r--testsuites/psxtests/psxrwlock01/test.c28
-rw-r--r--testsuites/psxtests/psxthreadname01/init.c2
-rw-r--r--testsuites/psxtests/psxtimer01/psxtimer.c9
-rw-r--r--testsuites/psxtests/psxtimer02/psxtimer.c9
-rw-r--r--testsuites/psxtests/psxtimer_face01/psxtimer.c123
-rw-r--r--testsuites/psxtests/psxtimer_face01/psxtimer_face01.doc49
-rw-r--r--testsuites/psxtests/psxtimer_face01/psxtimer_face01.scn6
84 files changed, 638 insertions, 188 deletions
diff --git a/testsuites/psxtests/psx08/init.c b/testsuites/psxtests/psx08/init.c
index b4b22a5338..3af6f83d7f 100644
--- a/testsuites/psxtests/psx08/init.c
+++ b/testsuites/psxtests/psx08/init.c
@@ -4,6 +4,8 @@
* COPYRIGHT (c) 1989-2009.
* On-Line Applications Research Corporation (OAR).
*
+ * Copyright (C) 2022 embedded brains GmbH & Co. KG
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -36,6 +38,119 @@
const char rtems_test_name[] = "PSX 8";
+static void *async_join_thread( void *arg )
+{
+ pthread_t *th;
+ int eno;
+ int type;
+
+ th = arg;
+
+ type = PTHREAD_CANCEL_ASYNCHRONOUS;
+ eno = pthread_setcanceltype( type, &type );
+ rtems_test_assert( eno == 0 );
+ rtems_test_assert( type == PTHREAD_CANCEL_DEFERRED );
+
+ (void) pthread_join( *th, NULL );
+ rtems_test_assert( 0 );
+}
+
+static void test_join_deadlock( void )
+{
+ pthread_t td;
+ pthread_t self;
+ int eno;
+ void *value;
+
+ self = pthread_self();
+
+ eno = pthread_create( &td, NULL, async_join_thread, &self );
+ rtems_test_assert( eno == 0 );
+
+ sched_yield();
+
+ eno = pthread_join( td, NULL );
+ rtems_test_assert( eno == EDEADLK );
+
+ eno = pthread_cancel( td );
+ rtems_test_assert( eno == 0 );
+
+ value = NULL;
+ eno = pthread_join( td, &value );
+ rtems_test_assert( eno == 0 );
+ rtems_test_assert( value == PTHREAD_CANCELED );
+}
+
+typedef struct {
+ pthread_t protected_join;
+ pthread_t deleter;
+ rtems_status_code delete_status;
+} delete_deadlock_context;
+
+static void *protected_join_thread( void *arg )
+{
+ delete_deadlock_context *ctx;
+ int state;
+ int eno;
+ void *value;
+
+ ctx = arg;
+
+ state = PTHREAD_CANCEL_DISABLE;
+ eno = pthread_setcancelstate( state, &state );
+ rtems_test_assert( eno == 0 );
+ rtems_test_assert( state == PTHREAD_CANCEL_ENABLE );
+
+ value = NULL;
+ eno = pthread_join( ctx->deleter, &value );
+ rtems_test_assert( eno == 0 );
+ rtems_test_assert( value == &ctx->deleter );
+
+ state = PTHREAD_CANCEL_ENABLE;
+ eno = pthread_setcancelstate( state, &state );
+ rtems_test_assert( eno == 0 );
+ rtems_test_assert( state == PTHREAD_CANCEL_DISABLE );
+
+ pthread_testcancel();
+ rtems_test_assert( 0 );
+}
+
+static void *deleter_thread( void *arg )
+{
+ delete_deadlock_context *ctx;
+
+ ctx = arg;
+ ctx->delete_status = rtems_task_delete( ctx->protected_join );
+ return &ctx->deleter;
+}
+
+static void test_delete_deadlock( void )
+{
+ delete_deadlock_context ctx;
+ int eno;
+ void *value;
+
+ ctx.delete_status = RTEMS_NOT_IMPLEMENTED;
+
+ eno = pthread_create(
+ &ctx.protected_join,
+ NULL,
+ protected_join_thread,
+ &ctx
+ );
+ rtems_test_assert( eno == 0 );
+
+ eno = pthread_create( &ctx.deleter, NULL, deleter_thread, &ctx );
+ rtems_test_assert( eno == 0 );
+
+ value = NULL;
+ eno = pthread_join( ctx.protected_join, &value );
+ rtems_test_assert( eno == 0 );
+ rtems_test_assert( value == PTHREAD_CANCELED );
+
+ rtems_test_assert( ctx.delete_status == RTEMS_INCORRECT_STATE );
+}
+
void *POSIX_Init(
void *argument
)
@@ -54,6 +169,9 @@ void *POSIX_Init(
Init_id = pthread_self();
printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
+ test_join_deadlock();
+ test_delete_deadlock();
+
puts( "Init: pthread_detach - ESRCH (invalid id)" );
status = pthread_detach( (pthread_t) -1 );
rtems_test_assert( status == ESRCH );
diff --git a/testsuites/psxtests/psx12/init.c b/testsuites/psxtests/psx12/init.c
index 76737b0c3b..6526805313 100644
--- a/testsuites/psxtests/psx12/init.c
+++ b/testsuites/psxtests/psx12/init.c
@@ -226,6 +226,8 @@ static void *POSIX_Init( void *argument )
puts( "Init: pthread_create - SUCCESSFUL" );
+ pthread_setschedprio( pthread_self(), SS_PRIO_LOW );
+
/* Align with clock tick */
sleep( 1 );
diff --git a/testsuites/psxtests/psx13/test.c b/testsuites/psxtests/psx13/test.c
index 0754dbcf30..951953ae98 100644
--- a/testsuites/psxtests/psx13/test.c
+++ b/testsuites/psxtests/psx13/test.c
@@ -639,6 +639,8 @@ static void FutimensTest( void )
/* EBADF test case */
/* Case: Pass an invalid file descriptor */
+ _Timespec_Set_to_zero( &time[0] );
+ _Timespec_Set_to_zero( &time[1] );
rv = futimens( -1, time );
rtems_test_assert( rv == -1 );
rtems_test_assert( errno == EBADF );
diff --git a/testsuites/psxtests/psx15/init.c b/testsuites/psxtests/psx15/init.c
index e6ade823f7..fff3db01c3 100644
--- a/testsuites/psxtests/psx15/init.c
+++ b/testsuites/psxtests/psx15/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2010 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2010 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/psxtests/psxbarrier01/test.c b/testsuites/psxtests/psxbarrier01/test.c
index 3bea278aac..1f3bdb138c 100644
--- a/testsuites/psxtests/psxbarrier01/test.c
+++ b/testsuites/psxtests/psxbarrier01/test.c
@@ -6,7 +6,7 @@
* COPYRIGHT (c) 1989-2009.
* On-Line Applications Research Corporation (OAR).
*
- * Copyright (c) 2017 embedded brains GmbH
+ * Copyright (c) 2017 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/psxtests/psxchroot01/test.c b/testsuites/psxtests/psxchroot01/test.c
index 8270bf5b58..7ac6a80d56 100644
--- a/testsuites/psxtests/psxchroot01/test.c
+++ b/testsuites/psxtests/psxchroot01/test.c
@@ -5,7 +5,7 @@
* On-Line Applications Research Corporation (OAR).
*
* Modifications to support reference counting in the file system are
- * Copyright (c) 2012 embedded brains GmbH.
+ * Copyright (c) 2012 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/psxtests/psxcleanup02/init.c b/testsuites/psxtests/psxcleanup02/init.c
index 89ae7f1930..c123a817ea 100644
--- a/testsuites/psxtests/psxcleanup02/init.c
+++ b/testsuites/psxtests/psxcleanup02/init.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2015 embedded brains GmbH & Co. KG
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
diff --git a/testsuites/psxtests/psxcleanup02/main.c b/testsuites/psxtests/psxcleanup02/main.c
index 071d84c059..a72c30970a 100644
--- a/testsuites/psxtests/psxcleanup02/main.c
+++ b/testsuites/psxtests/psxcleanup02/main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2015 embedded brains GmbH & Co. KG
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
diff --git a/testsuites/psxtests/psxclock/init.c b/testsuites/psxtests/psxclock/init.c
index 2300056f61..eb2f1d130c 100644
--- a/testsuites/psxtests/psxclock/init.c
+++ b/testsuites/psxtests/psxclock/init.c
@@ -50,6 +50,174 @@ static void check_enosys(int status)
rtems_test_exit(0);
}
+static void wait_ticks( rtems_interval ticks )
+{
+ /*
+ * Avoid any clock related sleep calls
+ */
+ rtems_test_assert( rtems_task_wake_after( ticks ) == RTEMS_SUCCESSFUL );
+}
+
+struct clock_context;
+typedef struct clock_context clock_context;
+typedef void (*clock_sleeper)(clock_context* ctx);
+struct clock_context {
+ const char* name;
+ int instance;
+ rtems_id tid;
+ int counter;
+ int result;
+ rtems_interval ticks;
+ struct timespec tspec;
+ clock_sleeper sleeper;
+};
+
+static void clock_context_init(
+ clock_context* ctx, const char* name, int instance,
+ time_t secs, long nsecs, clock_sleeper sleeper)
+{
+ memset( ctx, 0, sizeof( *ctx ) );
+ ctx->name = name;
+ ctx->instance = instance;
+ ctx->tspec.tv_sec = secs;
+ ctx->tspec.tv_nsec = nsecs;
+ ctx->sleeper = sleeper;
+}
+
+static void test_nanosleep( clock_context* ctx )
+{
+ if ( nanosleep ( &ctx->tspec, NULL ) < 0 )
+ {
+ ctx->result = errno;
+ }
+}
+
+static void test_clock_nanosleep_realtime( clock_context* ctx )
+{
+ if ( clock_nanosleep ( CLOCK_REALTIME, 0, &ctx->tspec, NULL ) < 0 )
+ {
+ ctx->result = errno;
+ }
+}
+
+static void test_clock_nanosleep_monotonic( clock_context* ctx )
+{
+ if ( clock_nanosleep ( CLOCK_MONOTONIC, 0, &ctx->tspec, NULL ) < 0 )
+ {
+ ctx->result = errno;
+ }
+}
+
+static void test_clock_check( clock_context* ctx, const rtems_interval ticks_per_sec )
+{
+ const long tick_period_nsec = 1000000000LLU / ticks_per_sec;
+ rtems_interval ticks =
+ (((ctx->tspec.tv_sec * 1000000000LLU) + ctx->tspec.tv_nsec) / tick_period_nsec) + 1;
+ rtems_test_assert( ctx->result == 0 );
+ printf(
+ "clock: %s: sec=%" PRIdtime_t" nsec=%li ticks=%u expected-ticks=%u\n",
+ ctx->name, ctx->tspec.tv_sec, ctx->tspec.tv_nsec, ctx->ticks, ticks);
+ rtems_test_assert( ctx->ticks == ticks );
+}
+
+static void task_clock( rtems_task_argument arg )
+{
+ clock_context* ctx = (clock_context*) arg;
+ rtems_interval start = rtems_clock_get_ticks_since_boot();
+ rtems_interval end;
+ ctx->result = 0;
+ ctx->sleeper( ctx );
+ end = rtems_clock_get_ticks_since_boot();
+ ctx->ticks = end - start;
+ ++ctx->counter;
+ rtems_task_delete( RTEMS_SELF );
+}
+
+static void test_start_task( clock_context* ctx )
+{
+ rtems_status_code sc;
+ sc = rtems_task_create(
+ rtems_build_name( 'C', 'R', 'T', '0' + ctx->instance ),
+ 1,
+ RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_DEFAULT_MODES,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &ctx->tid
+ );
+ rtems_test_assert( sc == RTEMS_SUCCESSFUL );
+ sc = rtems_task_start( ctx->tid, task_clock, (rtems_task_argument) ctx );
+ rtems_test_assert( sc == RTEMS_SUCCESSFUL );
+}
+
+static void test_settime_and_sleeping_step( int step )
+{
+ const rtems_interval ticks_per_sec = rtems_clock_get_ticks_per_second();
+ struct timespec tv;
+
+ clock_context ns_ctx;
+ clock_context cnr_ctx;
+ clock_context cnm_ctx;
+
+ printf( "\nClock settime while sleeping: step=%i\n", step );
+
+ clock_context_init(
+ &ns_ctx, "nanosleep", 0, 0, 500000000,
+ test_nanosleep );
+ clock_context_init(
+ &cnr_ctx, "clock_nanosleep(CLOCK_REALTIME)", 0, 0, 500000000,
+ test_clock_nanosleep_realtime );
+ clock_context_init(
+ &cnm_ctx, "clock_nanosleep(CLOCK_MONOTONIC)", 0, 0, 500000000,
+ test_clock_nanosleep_monotonic );
+
+ /* Sat, 01 Jan 2000 00:00:00 GMT */
+ tv.tv_sec = 946684800;
+ tv.tv_nsec = 0;
+ rtems_test_assert( clock_settime( CLOCK_REALTIME, &tv ) == 0 );
+
+ wait_ticks( 1 );
+
+ test_start_task( &ns_ctx );
+ test_start_task( &cnr_ctx );
+ test_start_task( &cnm_ctx );
+
+ wait_ticks( 2 );
+
+ /*
+ * Jump forwards 1 second
+ */
+ if ( step != 0 )
+ {
+ tv.tv_sec = 946684800 + step;
+ tv.tv_nsec = 0;
+ rtems_test_assert( clock_settime( CLOCK_REALTIME, &tv ) == 0 );
+ }
+
+ while (true)
+ {
+ int counts = 0;
+ wait_ticks( ticks_per_sec / 4 );
+ counts += ns_ctx.counter;
+ counts += cnr_ctx.counter;
+ counts += cnm_ctx.counter;
+ if (counts == 3)
+ {
+ break;
+ }
+ }
+
+ test_clock_check( &ns_ctx, ticks_per_sec );
+ test_clock_check( &cnr_ctx, ticks_per_sec );
+ test_clock_check( &cnm_ctx, ticks_per_sec );
+}
+
+static void test_settime_and_sleeping( void )
+{
+ test_settime_and_sleeping_step( 0 );
+ test_settime_and_sleeping_step( 1 );
+ test_settime_and_sleeping_step( -1 );
+}
+
typedef struct {
int counter;
struct timespec delta;
@@ -358,6 +526,8 @@ static rtems_task Init(
}
#endif
+ test_settime_and_sleeping( );
+
TEST_END();
rtems_test_exit(0);
}
@@ -370,7 +540,7 @@ static rtems_task Init(
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
-#define CONFIGURE_MAXIMUM_TASKS 2
+#define CONFIGURE_MAXIMUM_TASKS 4
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
diff --git a/testsuites/psxtests/psxclockrealtime01/init.c b/testsuites/psxtests/psxclockrealtime01/init.c
index 720e7ced52..722a756ebb 100644
--- a/testsuites/psxtests/psxclockrealtime01/init.c
+++ b/testsuites/psxtests/psxclockrealtime01/init.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2017 embedded brains GmbH & Co. KG
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
diff --git a/testsuites/psxtests/psxconfig01/init.c b/testsuites/psxtests/psxconfig01/init.c
index f1fcfe2b3b..77a96d1c67 100644
--- a/testsuites/psxtests/psxconfig01/init.c
+++ b/testsuites/psxtests/psxconfig01/init.c
@@ -10,7 +10,7 @@
/*
* Copyright (c) 2014. On-Line Applications Research Corporation (OAR).
- * Copyright (c) 2011-2014 embedded brains GmbH. All rights reserved.
+ * Copyright (C) 2011, 2014 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -200,7 +200,7 @@ static rtems_task Init(rtems_task_argument argument);
#include <rtems/confdefs.h>
typedef struct RTEMS_ALIGNED(RTEMS_PARTITION_ALIGNMENT) {
- uint64_t data [16];
+ uint64_t data [32];
} area;
#if CONFIGURE_MAXIMUM_PARTITIONS > 0
diff --git a/testsuites/psxtests/psxconfig01/psxconfig01.doc b/testsuites/psxtests/psxconfig01/psxconfig01.doc
index 524c8a9994..d8f70bded3 100644
--- a/testsuites/psxtests/psxconfig01/psxconfig01.doc
+++ b/testsuites/psxtests/psxconfig01/psxconfig01.doc
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: BSD-2-Clause
-# Copyright (c) 2011 embedded brains GmbH.
+# Copyright (c) 2011 embedded brains GmbH & Co. KG
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
diff --git a/testsuites/psxtests/psxenosys/init.c b/testsuites/psxtests/psxenosys/init.c
index 40f83aa0f0..d9a4d835f7 100644
--- a/testsuites/psxtests/psxenosys/init.c
+++ b/testsuites/psxtests/psxenosys/init.c
@@ -104,9 +104,15 @@ void *POSIX_Init(
sc = fork();
check_enosys( sc );
- puts( "pthread_atfork -- ENOSYS" );
+ /*
+ * The behavior of pthread_atfork() in single process environments was
+ * undefined by POSIX but the fACE Technical Standard required returning
+ * 0. Before ticket #4713, this did return ENOSYS. Just leaving this test
+ * case here for convenience.
+ */
+ puts( "pthread_atfork -- 0" );
sc = pthread_atfork( NULL, NULL, NULL );
- check_enosys( sc );
+ rtems_test_assert( !sc );
puts( "pthread_getcpuclockid -- ENOSYS" );
sc = pthread_getcpuclockid( 0, NULL );
diff --git a/testsuites/psxtests/psxenosys/psxenosys.scn b/testsuites/psxtests/psxenosys/psxenosys.scn
index 1ed64f92e9..9e88acd05a 100644
--- a/testsuites/psxtests/psxenosys/psxenosys.scn
+++ b/testsuites/psxtests/psxenosys/psxenosys.scn
@@ -9,7 +9,7 @@ execv -- ENOSYS
execve -- ENOSYS
execvp -- ENOSYS
fork -- ENOSYS
-pthread_atfork -- ENOSYS
+pthread_atfork -- 0
pthread_getcpuclockid -- ENOSYS
sched_setparam -- ENOSYS
sched_getparam -- ENOSYS
diff --git a/testsuites/psxtests/psxftw01/init.c b/testsuites/psxtests/psxftw01/init.c
index ee0e40c84a..5bd89928d1 100644
--- a/testsuites/psxtests/psxftw01/init.c
+++ b/testsuites/psxtests/psxftw01/init.c
@@ -6,7 +6,7 @@
/*
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (C) 2020 Eshan Dhawan, embedded brains GmbH, Joel Sherrill
+ * Copyright (C) 2020 Eshan Dhawan, embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -66,36 +66,6 @@ void *POSIX_Init (void * argument);
static char file_traverse_order[6][20];
static int file_order;
-static char buffer[512];
-
-static const T_action actions[] = {
- T_report_hash_sha256,
- T_check_task_context,
- T_check_file_descriptors,
- T_check_rtems_barriers,
- T_check_rtems_extensions,
- T_check_rtems_message_queues,
- T_check_rtems_partitions,
- T_check_rtems_periods,
- T_check_rtems_regions,
- T_check_rtems_semaphores,
- T_check_rtems_tasks,
- T_check_rtems_timers,
- T_check_posix_keys
-};
-
-static const T_config config = {
- .name = "psxftw01",
- .buf = buffer,
- .buf_size = sizeof(buffer),
- .putchar = rtems_put_char,
- .verbosity = T_VERBOSE,
- .now = T_now_clock,
- .action_count = T_ARRAY_SIZE(actions),
- .actions = actions
-};
-
-
static int fn_function (const char *fpath, const struct stat *sb,
int tflag, struct FTW *ftwbuf)
{
@@ -122,9 +92,7 @@ T_TEST_CASE(ftw)
TARFILE_SIZE,
&rtems_test_printer
);
- if (sc != RTEMS_SUCCESSFUL) {
- printf ("error: untar failed: %s\n", rtems_status_text (sc));
- }
+ T_rsc_success( sc );
/* Array with expected file order */
char arr_ftw_depth[5][20] = { "test_file", "test_script", "def", "abc", "home" };
@@ -136,49 +104,31 @@ T_TEST_CASE(ftw)
file_order = 0;
flags |= FTW_DEPTH;
r = nftw( files_path, fn_function, 5, flags );
-
- T_quiet_psx_success(r);
+ T_psx_success( r );
/*comparing the nftw file tree to the expexted file tree traversal */
for (i = 0; i < file_order; i++){
r = strcmp( arr_ftw_depth[i], file_traverse_order[i]);
- if (r){
- printf( "Incorrect Order " );
- }
- T_quiet_psx_success(r);
+ T_eq_int( r, 0 );
}
/*----------------Test Block 2--------------------*/
flags = 0;
file_order = 0;
flags |= FTW_PHYS;
r = nftw( files_path, fn_function, 5, flags );
- T_quiet_psx_success(r);
+ T_psx_success(r);
/*comparing the nftw file tree to the expected file tree traversal*/
for (i = 0; i < file_order; i++){
r = strcmp( arr_ftw_phys[i], file_traverse_order[i]);
- if (r){
- printf( "Incorrect Order " );
- }
- T_quiet_psx_success(r);
+ T_eq_int( r, 0 );
}
}
void *POSIX_Init (void * argument)
{
- int exit_code;
-
- TEST_BEGIN();
-
- T_register();
- exit_code = T_main(&config);
- if (exit_code == 0) {
- TEST_END();
- }
-
- rtems_test_exit(exit_code);
-
+ rtems_test_run( (rtems_task_argument) argument, TEST_STATE );
}
/* NOTICE: the clock driver is explicitly disabled */
diff --git a/testsuites/psxtests/psxglobalcon01/init.cc b/testsuites/psxtests/psxglobalcon01/init.cc
index 2ccbba9e34..a61734bcd1 100644
--- a/testsuites/psxtests/psxglobalcon01/init.cc
+++ b/testsuites/psxtests/psxglobalcon01/init.cc
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2014 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2014 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/psxtests/psxglobalcon02/init.cc b/testsuites/psxtests/psxglobalcon02/init.cc
index 0e530246e0..3d8206261a 100644
--- a/testsuites/psxtests/psxglobalcon02/init.cc
+++ b/testsuites/psxtests/psxglobalcon02/init.cc
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2014 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2014 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/psxtests/psxhdrs/arpa/inet/inet_ntop.c b/testsuites/psxtests/psxhdrs/arpa/inet/inet_ntop.c
index c3e3828b0b..5b64b565cc 100644
--- a/testsuites/psxtests/psxhdrs/arpa/inet/inet_ntop.c
+++ b/testsuites/psxtests/psxhdrs/arpa/inet/inet_ntop.c
@@ -32,7 +32,7 @@ int test(void);
int test(void)
{
int af = 0;
- struct in_addr addr;
+ struct in_addr addr = { 0 };
char *dst = "string";
const char *ret = inet_ntop(af, &addr, dst, sizeof(dst));
diff --git a/testsuites/psxtests/psxhdrs/fcntl/openat.c b/testsuites/psxtests/psxhdrs/fcntl/openat.c
index 927d56774b..1c15cd0867 100644
--- a/testsuites/psxtests/psxhdrs/fcntl/openat.c
+++ b/testsuites/psxtests/psxhdrs/fcntl/openat.c
@@ -5,7 +5,7 @@
/*
* SPDX-License-Identifier: BSD-2-Clause
- *
+ *
* Copyright (C) 2018, Zenon
*
* Redistribution and use in source and binary forms, with or without
@@ -40,7 +40,7 @@ int test(void);
int test(void){
int i0, i1;
- char c;
+ char c = '\0';
i0 = 0;
i1 = 0;
diff --git a/testsuites/psxtests/psxhdrs/netdb/gethostbyaddr.c b/testsuites/psxtests/psxhdrs/netdb/gethostbyaddr.c
index 07d734334b..cd2a271c37 100644
--- a/testsuites/psxtests/psxhdrs/netdb/gethostbyaddr.c
+++ b/testsuites/psxtests/psxhdrs/netdb/gethostbyaddr.c
@@ -43,7 +43,7 @@
int test( void )
{
struct hostent *host;
- struct in_addr ipv4addr;
+ struct in_addr ipv4addr = { 0 };
host = gethostbyaddr( &ipv4addr, sizeof(ipv4addr), AF_INET );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getdetachstate.c b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getdetachstate.c
index 9bac990cd3..e2341a582d 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getdetachstate.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getdetachstate.c
@@ -42,8 +42,8 @@ int test( void );
int test( void )
{
- pthread_attr_t attribute;
- int state;
+ pthread_attr_t attribute = { 0 };
+ int state = 0;
int result;
result = pthread_attr_getdetachstate( &attribute, &state );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getguardsize.c b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getguardsize.c
index 6542efdf13..5a816d2115 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getguardsize.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getguardsize.c
@@ -42,8 +42,8 @@ int test( void );
int test( void )
{
- pthread_attr_t attribute;
- size_t size;
+ pthread_attr_t attribute = { 0 };
+ size_t size = 0;
int result;
result = pthread_attr_getguardsize( &attribute, &size );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getinheritsched.c b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getinheritsched.c
index a76172908b..86a4547164 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getinheritsched.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getinheritsched.c
@@ -42,8 +42,8 @@ int test( void );
int test( void )
{
- pthread_attr_t attr;
- int inheritsched;
+ pthread_attr_t attr = { 0 };
+ int inheritsched = 0;
int result;
result = pthread_attr_getinheritsched( &attr, &inheritsched );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getschedparam.c b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getschedparam.c
index cc2dcb0198..743e2c4d21 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getschedparam.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getschedparam.c
@@ -42,8 +42,8 @@ int test( void );
int test( void )
{
- pthread_attr_t attr;
- struct sched_param param;
+ pthread_attr_t attr = { 0 };
+ struct sched_param param = { 0 };
int result;
result = pthread_attr_getschedparam( &attr, &param );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getschedpolicy.c b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getschedpolicy.c
index a341eeb337..60595d1a7a 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getschedpolicy.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getschedpolicy.c
@@ -42,8 +42,8 @@ int test( void );
int test( void )
{
- pthread_attr_t attr;
- int policy;
+ pthread_attr_t attr = { 0 };
+ int policy = 0;
int result;
result = pthread_attr_getschedpolicy( &attr, &policy );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getscope.c b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getscope.c
index 7023c29fce..7b97a7859c 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getscope.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getscope.c
@@ -42,8 +42,8 @@ int test( void );
int test( void )
{
- pthread_attr_t attr;
- int contentionscope;
+ pthread_attr_t attr = { 0 };
+ int contentionscope = 0;
int result;
result = pthread_attr_getscope( &attr, &contentionscope );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstack.c b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstack.c
index 177b775baf..f2d8a76362 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstack.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstack.c
@@ -47,7 +47,7 @@ int test( void );
int test( void )
{
- pthread_attr_t attribute;
+ pthread_attr_t attribute = { 0 };
void *stackaddr;
size_t stacksize;
int result;
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstackaddr.c b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstackaddr.c
index 4e7c17f40a..ed718c76d9 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstackaddr.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstackaddr.c
@@ -47,7 +47,7 @@ int test( void );
int test( void )
{
- pthread_attr_t attribute;
+ pthread_attr_t attribute = { 0 };
void *stackaddr;
int result;
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstacksize.c b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstacksize.c
index d9f8c4f718..ff9237a8eb 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstacksize.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_getstacksize.c
@@ -46,8 +46,8 @@ int test( void );
int test( void )
{
- pthread_attr_t attribute;
- size_t size;
+ pthread_attr_t attribute = { 0 };
+ size_t size = 0;
int result;
result = pthread_attr_getstacksize( &attribute, &size );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_setschedparam.c b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_setschedparam.c
index 70f001fc67..643ccde907 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_attr_setschedparam.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_attr_setschedparam.c
@@ -42,8 +42,8 @@ int test( void );
int test( void )
{
- pthread_attr_t attr;
- struct sched_param param;
+ pthread_attr_t attr = { 0 };
+ struct sched_param param = { 0 };
int result;
result = pthread_attr_setschedparam( &attr, &param );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_cond_init.c b/testsuites/psxtests/psxhdrs/pthread/pthread_cond_init.c
index 86f74d7cff..b7e2e2ad34 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_cond_init.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_cond_init.c
@@ -43,7 +43,7 @@ int test( void );
int test( void )
{
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
- pthread_condattr_t attribute;
+ pthread_condattr_t attribute = { 0 };
int result;
result = pthread_cond_init( &cond, &attribute );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_cond_timedwait.c b/testsuites/psxtests/psxhdrs/pthread/pthread_cond_timedwait.c
index 1c38af0067..72427266c1 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_cond_timedwait.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_cond_timedwait.c
@@ -44,7 +44,7 @@ int test( void )
{
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
- struct timespec abstime;
+ struct timespec abstime = { 0 };
int result;
result = pthread_cond_timedwait( &cond, &mutex, &abstime );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_condattr_getpshared.c b/testsuites/psxtests/psxhdrs/pthread/pthread_condattr_getpshared.c
index b37f1c00b9..21af201c65 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_condattr_getpshared.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_condattr_getpshared.c
@@ -45,7 +45,7 @@ int test( void );
int test( void )
{
- pthread_condattr_t attribute;
+ pthread_condattr_t attribute = { 0 };
int pshared;
int result;
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_create.c b/testsuites/psxtests/psxhdrs/pthread/pthread_create.c
index bde6105933..de4f6b0bec 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_create.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_create.c
@@ -53,7 +53,7 @@ void *test_task(
int test( void )
{
pthread_t thread;
- pthread_attr_t attribute;
+ pthread_attr_t attribute = { 0 };
void *arg = NULL;
int result;
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_mutex_getprioceiling.c b/testsuites/psxtests/psxhdrs/pthread/pthread_mutex_getprioceiling.c
index 4f652283df..65b44fa779 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_mutex_getprioceiling.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_mutex_getprioceiling.c
@@ -45,8 +45,8 @@ int test( void );
int test( void )
{
- pthread_mutex_t mutex;
- int prioceiling;
+ pthread_mutex_t mutex = { 0 };
+ int prioceiling = 0;
int result;
result = pthread_mutex_getprioceiling( &mutex, &prioceiling );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_mutex_init.c b/testsuites/psxtests/psxhdrs/pthread/pthread_mutex_init.c
index 085d6f9835..1b42dbc0f3 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_mutex_init.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_mutex_init.c
@@ -43,7 +43,7 @@ int test( void );
int test( void )
{
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
- pthread_mutexattr_t attribute;
+ pthread_mutexattr_t attribute = { 0 };
int result;
result = pthread_mutex_init( &mutex, &attribute );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_mutex_timedlock.c b/testsuites/psxtests/psxhdrs/pthread/pthread_mutex_timedlock.c
index c402d17a57..02f864493d 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_mutex_timedlock.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_mutex_timedlock.c
@@ -46,7 +46,7 @@ int test( void );
int test( void )
{
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
- struct timespec timeout;
+ struct timespec timeout = { 0 };
int result;
result = pthread_mutex_timedlock( &mutex, &timeout );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_getprioceiling.c b/testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_getprioceiling.c
index a53535881c..675ef02d38 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_getprioceiling.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_getprioceiling.c
@@ -45,7 +45,7 @@ int test( void );
int test( void )
{
- pthread_mutexattr_t attribute;
+ pthread_mutexattr_t attribute = { 0 };
int prioceiling = 0;
int result;
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_getprotocol.c b/testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_getprotocol.c
index 99cd093b17..da16c786b0 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_getprotocol.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_getprotocol.c
@@ -45,8 +45,8 @@ int test( void );
int test( void )
{
- pthread_mutexattr_t attribute;
- int protocol;
+ pthread_mutexattr_t attribute = { 0 };
+ int protocol = 0;
int result;
result = pthread_mutexattr_getprotocol( &attribute, &protocol );
diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_getpshared.c b/testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_getpshared.c
index 3735b76b41..d8e8eaabeb 100644
--- a/testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_getpshared.c
+++ b/testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_getpshared.c
@@ -45,8 +45,8 @@ int test( void );
int test( void )
{
- pthread_mutexattr_t attribute;
- int pshared;
+ pthread_mutexattr_t attribute = { 0 };
+ int pshared = 0;
int result;
result = pthread_mutexattr_getpshared( &attribute, &pshared );
diff --git a/testsuites/psxtests/psxhdrs/sys/select/pselect.c b/testsuites/psxtests/psxhdrs/sys/select/pselect.c
index d35a0d0921..ad96dda686 100644
--- a/testsuites/psxtests/psxhdrs/sys/select/pselect.c
+++ b/testsuites/psxtests/psxhdrs/sys/select/pselect.c
@@ -45,8 +45,8 @@ int test( void )
fd_set readfds;
fd_set writefds;
fd_set errorfds;
- struct timespec timeout;
- sigset_t sigmask;
+ struct timespec timeout = { 0 };
+ sigset_t sigmask = { 0 };
return_value = pselect(nfds, &readfds, &writefds, &errorfds, &timeout, &sigmask);
return return_value;
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/bind.c b/testsuites/psxtests/psxhdrs/sys/socket/bind.c
index 3da39b31ff..2fa19f2c26 100644
--- a/testsuites/psxtests/psxhdrs/sys/socket/bind.c
+++ b/testsuites/psxtests/psxhdrs/sys/socket/bind.c
@@ -44,7 +44,7 @@ int test(void);
int test(void)
{
int sockfd = 4;
- struct sockaddr addr;
+ struct sockaddr addr = { 0 };
socklen_t addrlen = sizeof(addr);
return bind(sockfd, &addr, addrlen);
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/connect.c b/testsuites/psxtests/psxhdrs/sys/socket/connect.c
index 1b8f5b9001..afb560ff52 100644
--- a/testsuites/psxtests/psxhdrs/sys/socket/connect.c
+++ b/testsuites/psxtests/psxhdrs/sys/socket/connect.c
@@ -43,9 +43,9 @@ int test(void);
int test(void)
{
- int sockfd = 4;
- struct sockaddr addr;
- socklen_t addrlen = sizeof(addr);
+ int sockfd = 4;
+ struct sockaddr addr = { 0 };
+ socklen_t addrlen = sizeof(addr);
return connect(sockfd, &addr, addrlen);
}
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/getsockopt.c b/testsuites/psxtests/psxhdrs/sys/socket/getsockopt.c
index 0ecf27dda5..e0cd442441 100644
--- a/testsuites/psxtests/psxhdrs/sys/socket/getsockopt.c
+++ b/testsuites/psxtests/psxhdrs/sys/socket/getsockopt.c
@@ -48,7 +48,7 @@ int test(void)
int optname = 67;
int value;
void *optval = &value;
- socklen_t optlen;
+ socklen_t optlen = { 0 };
return getsockopt(sockfd, level, optname, optval, &optlen);
}
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/send.c b/testsuites/psxtests/psxhdrs/sys/socket/send.c
index b93a87f482..de2ad3ba5a 100644
--- a/testsuites/psxtests/psxhdrs/sys/socket/send.c
+++ b/testsuites/psxtests/psxhdrs/sys/socket/send.c
@@ -44,7 +44,7 @@ ssize_t test(void);
ssize_t test(void)
{
int sockfd = 4;
- int buffer;
+ int buffer = 0;
void *buf = &buffer;
size_t len = sizeof(buffer);
int flags = 7;
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/sendmsg.c b/testsuites/psxtests/psxhdrs/sys/socket/sendmsg.c
index 3205271572..a14b8ff8d4 100644
--- a/testsuites/psxtests/psxhdrs/sys/socket/sendmsg.c
+++ b/testsuites/psxtests/psxhdrs/sys/socket/sendmsg.c
@@ -44,7 +44,7 @@ ssize_t test(void);
ssize_t test(void)
{
int sockfd = 4;
- struct msghdr msg;
+ struct msghdr msg = { 0 };
int flags = 7;
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/sendto.c b/testsuites/psxtests/psxhdrs/sys/socket/sendto.c
index 298d17f4ec..5050f1a0a5 100644
--- a/testsuites/psxtests/psxhdrs/sys/socket/sendto.c
+++ b/testsuites/psxtests/psxhdrs/sys/socket/sendto.c
@@ -44,11 +44,11 @@ ssize_t test(void);
ssize_t test(void)
{
int sockfd = 4;
- int buffer;
+ int buffer = 0;
const void *buf = &buffer;
size_t len = sizeof(buffer);
int flags = 7;
- struct sockaddr dest_addr;
+ struct sockaddr dest_addr = { 0 };
socklen_t addrlen = sizeof(dest_addr);
return sendto(sockfd, buf, len, flags, &dest_addr, addrlen);
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/setsockopt.c b/testsuites/psxtests/psxhdrs/sys/socket/setsockopt.c
index d373add6de..e4d21d3837 100644
--- a/testsuites/psxtests/psxhdrs/sys/socket/setsockopt.c
+++ b/testsuites/psxtests/psxhdrs/sys/socket/setsockopt.c
@@ -46,7 +46,7 @@ int test(void)
int sockfd = 4;
int level = SOL_SOCKET;
int optname = 67;
- int value;
+ int value = 0;
void *optval = &value;
socklen_t optlen = sizeof(value);
diff --git a/testsuites/psxtests/psxhdrs/sys/stat/futimens.c b/testsuites/psxtests/psxhdrs/sys/stat/futimens.c
index 75fa0ce0e6..9892352b71 100644
--- a/testsuites/psxtests/psxhdrs/sys/stat/futimens.c
+++ b/testsuites/psxtests/psxhdrs/sys/stat/futimens.c
@@ -42,9 +42,9 @@ int test( void )
{
int return_value;
int fd = 1;
- struct timespec times[2];
+ struct timespec times[2] = { 0 };
return_value = futimens(fd, times);
return (return_value != -1);
-} \ No newline at end of file
+}
diff --git a/testsuites/psxtests/psxhdrs/sys/stat/utimensat.c b/testsuites/psxtests/psxhdrs/sys/stat/utimensat.c
index c8c0767ce3..b74cc1a44b 100644
--- a/testsuites/psxtests/psxhdrs/sys/stat/utimensat.c
+++ b/testsuites/psxtests/psxhdrs/sys/stat/utimensat.c
@@ -44,9 +44,9 @@ int test( void )
int return_value;
int fd = 1;
char *path = "/";
- struct timespec times[2];
+ struct timespec times[2] = { 0 };
int flag = AT_SYMLINK_NOFOLLOW;
return_value = utimensat(fd, path, times, flag);
return (return_value != -1);
-} \ No newline at end of file
+}
diff --git a/testsuites/psxtests/psxhdrs/sys/time/utimes.c b/testsuites/psxtests/psxhdrs/sys/time/utimes.c
index ae69eb5ded..bebc7a77b4 100644
--- a/testsuites/psxtests/psxhdrs/sys/time/utimes.c
+++ b/testsuites/psxtests/psxhdrs/sys/time/utimes.c
@@ -5,7 +5,7 @@
/*
* SPDX-License-Identifier: BSD-2-Clause
- *
+ *
* Copyright (C) 2018, Zenon
*
* Redistribution and use in source and binary forms, with or without
@@ -41,8 +41,8 @@ int test(void);
int test(void)
{
int callback;
- struct timeval tv;
-
- callback = utimes(NULL, &tv);
+ struct timeval tv[2] = { 0 };
+
+ callback = utimes(NULL, &tv[0]);
return (callback == -1);
}
diff --git a/testsuites/psxtests/psxhdrs/termios/cfgetispeed.c b/testsuites/psxtests/psxhdrs/termios/cfgetispeed.c
index e98a28179e..0c8d304a71 100644
--- a/testsuites/psxtests/psxhdrs/termios/cfgetispeed.c
+++ b/testsuites/psxtests/psxhdrs/termios/cfgetispeed.c
@@ -40,11 +40,11 @@ int test( void );
int test( void )
{
- struct termios term;
+ struct termios term = { 0 };
speed_t rate;
rate = cfgetispeed(&term);
(void) rate;
return 0;
-} \ No newline at end of file
+}
diff --git a/testsuites/psxtests/psxhdrs/termios/cfgetospeed.c b/testsuites/psxtests/psxhdrs/termios/cfgetospeed.c
index b326a78378..4d2e23ed50 100644
--- a/testsuites/psxtests/psxhdrs/termios/cfgetospeed.c
+++ b/testsuites/psxtests/psxhdrs/termios/cfgetospeed.c
@@ -40,11 +40,11 @@ int test( void );
int test( void )
{
- struct termios term;
+ struct termios term = { 0 };
speed_t rate;
rate = cfgetospeed(&term);
(void) rate;
return 0;
-} \ No newline at end of file
+}
diff --git a/testsuites/psxtests/psxhdrs/termios/cfsetispeed.c b/testsuites/psxtests/psxhdrs/termios/cfsetispeed.c
index b73dbffce1..0f8ddfff57 100644
--- a/testsuites/psxtests/psxhdrs/termios/cfsetispeed.c
+++ b/testsuites/psxtests/psxhdrs/termios/cfsetispeed.c
@@ -41,10 +41,10 @@ int test( void );
int test( void )
{
int result;
- struct termios term;
+ struct termios term = { 0 };
speed_t speed = B0;
result = cfsetispeed(&term, speed);
return result;
-} \ No newline at end of file
+}
diff --git a/testsuites/psxtests/psxhdrs/termios/cfsetospeed.c b/testsuites/psxtests/psxhdrs/termios/cfsetospeed.c
index 8377fc6e26..8d5404c954 100644
--- a/testsuites/psxtests/psxhdrs/termios/cfsetospeed.c
+++ b/testsuites/psxtests/psxhdrs/termios/cfsetospeed.c
@@ -41,10 +41,10 @@ int test( void );
int test( void )
{
int result;
- struct termios term;
+ struct termios term = { 0 };
speed_t speed = B0;
result = cfsetospeed(&term, speed);
return result;
-} \ No newline at end of file
+}
diff --git a/testsuites/psxtests/psxhdrs/termios/tcgetattr.c b/testsuites/psxtests/psxhdrs/termios/tcgetattr.c
index d00336b214..843b7c8281 100644
--- a/testsuites/psxtests/psxhdrs/termios/tcgetattr.c
+++ b/testsuites/psxtests/psxhdrs/termios/tcgetattr.c
@@ -42,9 +42,9 @@ int test( void )
{
int result;
int fildes = 0;
- struct termios term;
+ struct termios term = { 0 };
result = tcgetattr(fildes, &term);
return result;
-} \ No newline at end of file
+}
diff --git a/testsuites/psxtests/psxhdrs/termios/tcsetattr.c b/testsuites/psxtests/psxhdrs/termios/tcsetattr.c
index e2bd6980a9..da0e0ea62d 100644
--- a/testsuites/psxtests/psxhdrs/termios/tcsetattr.c
+++ b/testsuites/psxtests/psxhdrs/termios/tcsetattr.c
@@ -43,9 +43,9 @@ int test( void )
int result;
int fildes = 0;
int optional_actions = 0;
- struct termios term;
+ struct termios term = { 0 };
result = tcsetattr(fildes, optional_actions, &term);
return result;
-} \ No newline at end of file
+}
diff --git a/testsuites/psxtests/psxhdrs/time/asctime.c b/testsuites/psxtests/psxhdrs/time/asctime.c
index c02a543d6b..400dbf5258 100644
--- a/testsuites/psxtests/psxhdrs/time/asctime.c
+++ b/testsuites/psxtests/psxhdrs/time/asctime.c
@@ -42,7 +42,7 @@ int test( void );
int test( void )
{
char *buffer;
- struct tm timestruct;
+ struct tm timestruct = { 0 };
buffer = asctime( &timestruct );
diff --git a/testsuites/psxtests/psxhdrs/time/asctime_r.c b/testsuites/psxtests/psxhdrs/time/asctime_r.c
index 231ea14dfb..c0a22b7d6b 100644
--- a/testsuites/psxtests/psxhdrs/time/asctime_r.c
+++ b/testsuites/psxtests/psxhdrs/time/asctime_r.c
@@ -42,7 +42,7 @@ int test( void );
int test( void )
{
char *buffer_pointer;
- struct tm timestruct;
+ struct tm timestruct = { 0 };
char buffer[ 80 ];
buffer_pointer = asctime_r( &timestruct, buffer );
diff --git a/testsuites/psxtests/psxhdrs/time/clock_settime.c b/testsuites/psxtests/psxhdrs/time/clock_settime.c
index 8a4d88c37f..8584e1c61f 100644
--- a/testsuites/psxtests/psxhdrs/time/clock_settime.c
+++ b/testsuites/psxtests/psxhdrs/time/clock_settime.c
@@ -46,7 +46,7 @@ int test( void );
int test( void )
{
clockid_t clock_id = 0;
- struct timespec tp;
+ struct timespec tp = { 0 };
int result;
result = clock_settime( clock_id, &tp );
diff --git a/testsuites/psxtests/psxhdrs/time/ctime.c b/testsuites/psxtests/psxhdrs/time/ctime.c
index f778e726a9..67dddf21ca 100644
--- a/testsuites/psxtests/psxhdrs/time/ctime.c
+++ b/testsuites/psxtests/psxhdrs/time/ctime.c
@@ -42,7 +42,7 @@ int test( void );
int test( void )
{
char *buffer;
- time_t time;
+ time_t time = { 0 };
buffer = ctime( &time );
diff --git a/testsuites/psxtests/psxhdrs/time/ctime_r.c b/testsuites/psxtests/psxhdrs/time/ctime_r.c
index b973a504ae..30f1285d0a 100644
--- a/testsuites/psxtests/psxhdrs/time/ctime_r.c
+++ b/testsuites/psxtests/psxhdrs/time/ctime_r.c
@@ -43,7 +43,7 @@ int test( void )
{
char *buffer_pointer;
char buffer[ 80 ];
- time_t time;
+ time_t time = { 0 };
buffer_pointer = ctime_r( &time, buffer );
diff --git a/testsuites/psxtests/psxhdrs/time/gmtime.c b/testsuites/psxtests/psxhdrs/time/gmtime.c
index 7118162c84..d7c08726ad 100644
--- a/testsuites/psxtests/psxhdrs/time/gmtime.c
+++ b/testsuites/psxtests/psxhdrs/time/gmtime.c
@@ -41,7 +41,7 @@ int test( void );
int test( void )
{
- time_t time;
+ time_t time = { 0 };
struct tm *timestruct;
timestruct = gmtime( &time );
diff --git a/testsuites/psxtests/psxhdrs/time/gmtime_r.c b/testsuites/psxtests/psxhdrs/time/gmtime_r.c
index 58f6a3212a..128e5107e0 100644
--- a/testsuites/psxtests/psxhdrs/time/gmtime_r.c
+++ b/testsuites/psxtests/psxhdrs/time/gmtime_r.c
@@ -41,7 +41,7 @@ int test( void );
int test( void )
{
- time_t time;
+ time_t time = { 0 };
struct tm *timestruct_pointer;
struct tm timestruct;
diff --git a/testsuites/psxtests/psxhdrs/time/localtime.c b/testsuites/psxtests/psxhdrs/time/localtime.c
index 674d8e43c2..7f1b4e481d 100644
--- a/testsuites/psxtests/psxhdrs/time/localtime.c
+++ b/testsuites/psxtests/psxhdrs/time/localtime.c
@@ -41,7 +41,7 @@ int test( void );
int test( void )
{
- time_t time;
+ time_t time = { 0 };
struct tm *timestruct;
timestruct = localtime( &time );
diff --git a/testsuites/psxtests/psxhdrs/time/localtime_r.c b/testsuites/psxtests/psxhdrs/time/localtime_r.c
index be85af36c5..10338db9fe 100644
--- a/testsuites/psxtests/psxhdrs/time/localtime_r.c
+++ b/testsuites/psxtests/psxhdrs/time/localtime_r.c
@@ -41,7 +41,7 @@ int test( void );
int test( void )
{
- time_t time;
+ time_t time = { 0 };
struct tm *timestruct_pointer;
struct tm timestruct;
diff --git a/testsuites/psxtests/psxhdrs/time/strftime.c b/testsuites/psxtests/psxhdrs/time/strftime.c
index ee27e7b8d4..6b75cdac1e 100644
--- a/testsuites/psxtests/psxhdrs/time/strftime.c
+++ b/testsuites/psxtests/psxhdrs/time/strftime.c
@@ -44,7 +44,7 @@ int test( void )
size_t length;
size_t max_length;
char buffer[ 80 ];
- struct tm timestruct;
+ struct tm timestruct = { 0 };
max_length = sizeof( buffer );
diff --git a/testsuites/psxtests/psxhdrs/unistd/setgroups.c b/testsuites/psxtests/psxhdrs/unistd/setgroups.c
index b40547a5e8..a29cb05978 100644
--- a/testsuites/psxtests/psxhdrs/unistd/setgroups.c
+++ b/testsuites/psxtests/psxhdrs/unistd/setgroups.c
@@ -42,7 +42,7 @@ int test( void );
int test( void )
{
- gid_t grouplist[ 20 ];
+ gid_t grouplist[ 20 ] = { 0 } ;
int gidsetsize;
int result;
diff --git a/testsuites/psxtests/psxhdrs/utime/utime.c b/testsuites/psxtests/psxhdrs/utime/utime.c
index 6236a84637..db619baecc 100644
--- a/testsuites/psxtests/psxhdrs/utime/utime.c
+++ b/testsuites/psxtests/psxhdrs/utime/utime.c
@@ -43,7 +43,7 @@ int test( void );
int test( void )
{
int result;
- const struct utimbuf buff;
+ const struct utimbuf buff = { 0 };
const char *path = "/tmp/myfile";
result = utime(path, &buff);
diff --git a/testsuites/psxtests/psxhdrs/wchar/mbsinit.c b/testsuites/psxtests/psxhdrs/wchar/mbsinit.c
index 21a39ee2ce..5432520f86 100644
--- a/testsuites/psxtests/psxhdrs/wchar/mbsinit.c
+++ b/testsuites/psxtests/psxhdrs/wchar/mbsinit.c
@@ -5,7 +5,7 @@
/*
* SPDX-License-Identifier: BSD-2-Clause
- *
+ *
* Copyright (C) 2018, Zenon
*
* Redistribution and use in source and binary forms, with or without
@@ -40,7 +40,7 @@ int test(void);
int test(void)
{
- const mbstate_t state;
+ const mbstate_t state = { 0 };
return mbsinit(&state);
}
diff --git a/testsuites/psxtests/psxintrcritical01/init.c b/testsuites/psxtests/psxintrcritical01/init.c
index deb95da994..27126e31ec 100644
--- a/testsuites/psxtests/psxintrcritical01/init.c
+++ b/testsuites/psxtests/psxintrcritical01/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+ * Copyright (C) 2020 embedded brains GmbH & Co. KG
*
* COPYRIGHT (c) 1989-2012.
* On-Line Applications Research Corporation (OAR).
diff --git a/testsuites/psxtests/psxkey07/init.c b/testsuites/psxtests/psxkey07/init.c
index d9696a0e28..ff7b3a0bd0 100644
--- a/testsuites/psxtests/psxkey07/init.c
+++ b/testsuites/psxtests/psxkey07/init.c
@@ -39,22 +39,25 @@
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);
+
+ *value_p = 123;
sc = pthread_setspecific( Key, value_p );
rtems_test_assert( !sc );
@@ -78,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;
@@ -119,7 +123,7 @@ rtems_task Init(rtems_task_argument argument)
pthread_mutex_lock( &mutex1 );
rc = rtems_task_create(
- rtems_build_name( 'T', 'E', 'S', 'T' ),
+ rtems_build_name( 'T', 'E', 'S', 'T' ),
1,
RTEMS_MINIMUM_STACK_SIZE,
RTEMS_DEFAULT_MODES,
@@ -214,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
diff --git a/testsuites/psxtests/psxkey08/init.c b/testsuites/psxtests/psxkey08/init.c
index 2bd00bc53d..ed0b6e8554 100644
--- a/testsuites/psxtests/psxkey08/init.c
+++ b/testsuites/psxtests/psxkey08/init.c
@@ -51,7 +51,7 @@ static rtems_name name1, name2;
static rtems_task test_task(rtems_task_argument arg)
{
- rtems_status_code sc;
+ rtems_status_code sc = 0;
const void *value_p;
const void *value_p2;
diff --git a/testsuites/psxtests/psxmount/test.c b/testsuites/psxtests/psxmount/test.c
index 9ce68dda59..202baed46c 100644
--- a/testsuites/psxtests/psxmount/test.c
+++ b/testsuites/psxtests/psxmount/test.c
@@ -5,7 +5,7 @@
* On-Line Applications Research Corporation (OAR).
*
* Modifications to support reference counting in the file system are
- * Copyright (c) 2012 embedded brains GmbH.
+ * Copyright (c) 2012 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/psxtests/psxmsgq01/init.c b/testsuites/psxtests/psxmsgq01/init.c
index 3c77beb038..c6b3d92464 100644
--- a/testsuites/psxtests/psxmsgq01/init.c
+++ b/testsuites/psxtests/psxmsgq01/init.c
@@ -1133,7 +1133,7 @@ void verify_with_threads(void)
void validate_mq_setattr(void)
{
- struct mq_attr attr;
+ struct mq_attr attr = { 0 };
struct mq_attr save_attr[ NUMBER_OF_TEST_QUEUES ];
int status;
int i;
diff --git a/testsuites/psxtests/psxonce01/init.c b/testsuites/psxtests/psxonce01/init.c
index dfa0204d62..033b1a02f3 100644
--- a/testsuites/psxtests/psxonce01/init.c
+++ b/testsuites/psxtests/psxonce01/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (C) 2019 embedded brains GmbH
+ * Copyright (C) 2019 embedded brains GmbH & Co. KG
* Copyright (C) 2019 Sebastian Huber
*
* COPYRIGHT (c) 1989-2009.
diff --git a/testsuites/psxtests/psxonce01/psxonce01.doc b/testsuites/psxtests/psxonce01/psxonce01.doc
index 7abbd2e037..3ca5d680c7 100644
--- a/testsuites/psxtests/psxonce01/psxonce01.doc
+++ b/testsuites/psxtests/psxonce01/psxonce01.doc
@@ -3,7 +3,7 @@
# COPYRIGHT (c) 1989-2009.
# On-Line Applications Research Corporation (OAR).
# Copyright (c) 2013 Annelies Odermann <annelies.odermann@gmail.com>
-# Copyright (c) 2014 embedded brains GmbH.
+# Copyright (c) 2014 embedded brains GmbH & Co. KG
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
diff --git a/testsuites/psxtests/psxrwlock01/test.c b/testsuites/psxtests/psxrwlock01/test.c
index 5767aa7c07..f6954007c0 100644
--- a/testsuites/psxtests/psxrwlock01/test.c
+++ b/testsuites/psxtests/psxrwlock01/test.c
@@ -454,10 +454,6 @@ int main(
status = pthread_rwlock_timedrdlock( NULL, &abstime);
rtems_test_assert( status == EINVAL );
- puts( "pthread_rwlock_timedrdlock( &rwlock, NULL) -- EINVAL" );
- status = pthread_rwlock_timedrdlock( &rwlock, NULL);
- rtems_test_assert( status == EINVAL );
-
puts( "pthread_rwlock_tryrdlock(NULL) -- EINVAL" );
status = pthread_rwlock_tryrdlock(NULL);
rtems_test_assert( status == EINVAL );
@@ -470,10 +466,6 @@ int main(
status = pthread_rwlock_timedwrlock( NULL, &abstime );
rtems_test_assert( status == EINVAL );
- puts( "pthread_rwlock_timedwrlock( &rwlock, NULL) -- EINVAL" );
- status = pthread_rwlock_timedwrlock( &rwlock, NULL);
- rtems_test_assert( status == EINVAL );
-
puts( "pthread_rwlock_trywrlock(NULL) -- EINVAL" );
status = pthread_rwlock_trywrlock(NULL);
rtems_test_assert( status == EINVAL );
@@ -482,6 +474,26 @@ int main(
status = pthread_rwlock_unlock(NULL);
rtems_test_assert( status == EINVAL );
+ status = pthread_rwlock_init( &rwlock, NULL );
+ rtems_test_assert( status == 0 );
+
+ status = pthread_rwlock_wrlock( &rwlock );
+ rtems_test_assert( status == 0 );
+
+ puts( "pthread_rwlock_timedrdlock( &rwlock, NULL) -- EINVAL" );
+ status = pthread_rwlock_timedrdlock( &rwlock, NULL);
+ rtems_test_assert( status == EINVAL );
+
+ puts( "pthread_rwlock_timedwrlock( &rwlock, NULL) -- EINVAL" );
+ status = pthread_rwlock_timedwrlock( &rwlock, NULL);
+ rtems_test_assert( status == EINVAL );
+
+ status = pthread_rwlock_unlock( &rwlock );
+ rtems_test_assert( status == 0 );
+
+ status = pthread_rwlock_destroy( &rwlock );
+ rtems_test_assert( status == 0 );
+
/*************** BAD ID CHECK *****************/
/* make a valid abstime */
puts( "clock_gettime(CLOCK_REALTIME, &abstime) -- OK" );
diff --git a/testsuites/psxtests/psxthreadname01/init.c b/testsuites/psxtests/psxthreadname01/init.c
index 3183272ce8..c5d5cef604 100644
--- a/testsuites/psxtests/psxthreadname01/init.c
+++ b/testsuites/psxtests/psxthreadname01/init.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
/*
- * Copyright (c) 2017 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2017 embedded brains GmbH & Co. KG
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/testsuites/psxtests/psxtimer01/psxtimer.c b/testsuites/psxtests/psxtimer01/psxtimer.c
index 560dc2eebd..57d23c1582 100644
--- a/testsuites/psxtests/psxtimer01/psxtimer.c
+++ b/testsuites/psxtests/psxtimer01/psxtimer.c
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
-/*
+/**
+ * @file POSIX Timer Test
*
* This is a simple real-time applications which contains 3 periodic tasks.
*
@@ -12,8 +13,10 @@
*
* The share data is protected with a POSIX mutex.
*
- * Other POSIX facilities such as timers, condition, .. is also used
- *
+ * Other POSIX facilities such as timers, condition, .. are also used.
+ */
+
+/*
* COPYRIGHT (c) 1989-2009.
* On-Line Applications Research Corporation (OAR).
*
diff --git a/testsuites/psxtests/psxtimer02/psxtimer.c b/testsuites/psxtests/psxtimer02/psxtimer.c
index 7da0f7acd1..26d1d5a67c 100644
--- a/testsuites/psxtests/psxtimer02/psxtimer.c
+++ b/testsuites/psxtests/psxtimer02/psxtimer.c
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: BSD-2-Clause */
-/*
+/**
+ * @file POSIX Timer Test #2
*
* This is a simple real-time applications which contains 3 periodic tasks.
*
@@ -12,8 +13,10 @@
*
* The share data is protected with a POSIX mutex.
*
- * Other POSIX facilities such as timers, condition, .. is also used
- *
+ * Other POSIX facilities such as timers, condition, .. are also used.
+ */
+
+/*
* COPYRIGHT (c) 1989-2009.
* On-Line Applications Research Corporation (OAR).
*
diff --git a/testsuites/psxtests/psxtimer_face01/psxtimer.c b/testsuites/psxtests/psxtimer_face01/psxtimer.c
new file mode 100644
index 0000000000..155afc5ce0
--- /dev/null
+++ b/testsuites/psxtests/psxtimer_face01/psxtimer.c
@@ -0,0 +1,123 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file POSIX Timer Test of FACE Behavior
+ */
+
+/*
+ * COPYRIGHT (c) 2022. On-Line Applications Research Corporation (OAR).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <pmacros.h>
+#include "tmacros.h"
+
+#include <unistd.h>
+#include <errno.h>
+#include <sched.h>
+#include <time.h> /* time facilities */
+#include <stdio.h> /* console facilities */
+
+const char rtems_test_name[] = "PSXTIMER FACE 1";
+
+static void *POSIX_Init (
+ void *argument
+)
+
+{
+ struct sigevent event;
+ int status;
+ timer_t timer;
+
+ /*
+ * If these are not filled in correctly, we do not execute pass the
+ * error checking for a NULL event pointer.
+ */
+ event.sigev_notify = SIGEV_SIGNAL;
+ event.sigev_signo = SIGUSR1;
+
+ TEST_BEGIN();
+
+ /*
+ * When FACE timer behavior is configured, creating a POSIX timer
+ * using CLOCK_REALTIME is not allowed.
+ */
+ puts( "timer_create - CLOCK_REALTIME forbidden - EPERM" );
+ status = timer_create( CLOCK_REALTIME, &event, &timer );
+ fatal_posix_service_status_errno( status, EPERM, "not allowed" );
+
+ /*
+ * When FACE timer behavior is configured, creating a POSIX timer
+ * on a value other than CLOCK_REALTIME or CLOCK_MONOTONIC is not allowed.
+ */
+ puts( "timer_create - CLOCK_PROCESS_CPUTIME_ID not allowed - EINVAL" );
+ status = timer_create( CLOCK_PROCESS_CPUTIME_ID, &event, &timer );
+ fatal_posix_service_status_errno( status, EINVAL, "invalid clock" );
+
+ /*
+ * When FACE timer behavior is configured, creating a POSIX timer
+ * on CLOCK_MONOTONIC allowed.
+ */
+ puts( "timer_create - OK" );
+ status = timer_create( CLOCK_MONOTONIC, &event, &timer );
+ posix_service_failed( status, "timer_create OK" );
+
+ /*
+ * Delete the previously created timer.
+ */
+ puts( "timer_delete - OK" );
+ status = timer_delete( timer );
+ posix_service_failed( status, "timer_delete ok" );
+
+ /*
+ */
+ puts( "timer_create - CLOCK_MONOTONIC is allowed - OK" );
+ status = timer_create( CLOCK_MONOTONIC, &event, &timer );
+ posix_service_failed( status, "timer_create ok" );
+
+ TEST_END();
+ rtems_test_exit (0);
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_POSIX_INIT_THREAD_TABLE
+
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
+#define CONFIGURE_MAXIMUM_POSIX_TIMERS 1
+
+#define CONFIGURE_POSIX_TIMERS_FACE_BEHAVIOR
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
+
+/* end of include file */
diff --git a/testsuites/psxtests/psxtimer_face01/psxtimer_face01.doc b/testsuites/psxtests/psxtimer_face01/psxtimer_face01.doc
new file mode 100644
index 0000000000..e975419539
--- /dev/null
+++ b/testsuites/psxtests/psxtimer_face01/psxtimer_face01.doc
@@ -0,0 +1,49 @@
+# SPDX-License-Identifier: BSD-2-Clause
+
+# COPYRIGHT (c) 1989-2009.
+# On-Line Applications Research Corporation (OAR).
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+This file describes the directives and concepts tested by this test set.
+
+test set name: psxtimer_face01
+
+directives:
+ timer_create
+ CONFIGURE_POSIX_TIMERS_FACE_BEHAVIOR
+
+concepts:
+
++ This test exercises the CONFIGURE_POSIX_TIMERS_FACE_BEHAVIOR configure
+ option which alters the behavior of timer_create().
+
+ - With CONFIGURE_POSIX_TIMERS_FACE_BEHAVIOR defined, timer_create()
+ returns EPERM to indicate this is not allowed.
+
+ - With CONFIGURE_POSIX_TIMERS_FACE_BEHAVIOR defined, timer_create()
+ for CLOCK_MONOTONIC is allowed.
+
+ - With CONFIGURE_POSIX_TIMERS_FACE_BEHAVIOR defined, timer_create()
+ for any other clock value is an error.
+
diff --git a/testsuites/psxtests/psxtimer_face01/psxtimer_face01.scn b/testsuites/psxtests/psxtimer_face01/psxtimer_face01.scn
new file mode 100644
index 0000000000..b83b41f281
--- /dev/null
+++ b/testsuites/psxtests/psxtimer_face01/psxtimer_face01.scn
@@ -0,0 +1,6 @@
+*** BEGIN OF TEST FACE 1 ***
+timer_create - CLOCK_REALTIME forbidden - EPERM
+timer_create - CLOCK_PROCESS_CPUTIME_ID not allowed - EINVAL
+timer_create - OK
+timer_delete - OK
+*** END OF TEST PSXTIMER FACE 1 ***