summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/psxtests')
-rw-r--r--testsuites/psxtests/psx08/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.c2
-rw-r--r--testsuites/psxtests/psxclockrealtime01/init.c2
-rw-r--r--testsuites/psxtests/psxconfig01/init.c2
-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/psxintrcritical01/init.c2
-rw-r--r--testsuites/psxtests/psxkey07/init.c31
-rw-r--r--testsuites/psxtests/psxmount/test.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
28 files changed, 263 insertions, 104 deletions
diff --git a/testsuites/psxtests/psx08/init.c b/testsuites/psxtests/psx08/init.c
index f4af45b5a4..3af6f83d7f 100644
--- a/testsuites/psxtests/psx08/init.c
+++ b/testsuites/psxtests/psx08/init.c
@@ -4,7 +4,7 @@
* COPYRIGHT (c) 1989-2009.
* On-Line Applications Research Corporation (OAR).
*
- * Copyright (C) 2022 embedded brains GmbH
+ * 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
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 743cfa6d78..eb2f1d130c 100644
--- a/testsuites/psxtests/psxclock/init.c
+++ b/testsuites/psxtests/psxclock/init.c
@@ -115,7 +115,7 @@ static void test_clock_check( clock_context* ctx, const rtems_interval ticks_per
(((ctx->tspec.tv_sec * 1000000000LLU) + ctx->tspec.tv_nsec) / tick_period_nsec) + 1;
rtems_test_assert( ctx->result == 0 );
printf(
- "clock: %s: sec=%llu nsec=%li ticks=%u expected-ticks=%u\n",
+ "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 );
}
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 3a0e5b3049..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
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/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 593df739db..ff7b3a0bd0 100644
--- a/testsuites/psxtests/psxkey07/init.c
+++ b/testsuites/psxtests/psxkey07/init.c
@@ -39,23 +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 );
@@ -79,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;
@@ -215,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/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/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 ***