Added compile only tests for the following POSIX standard APIs: 1) pthread_rwlock_clockrdlock() 2) pthread_rwlock_clockwrlock() 3) pthread_cond_clockwait() 4) pthread_mutex_clocklock()
All four were added to Issue 8 POSIX Standard and were added to testsuites/psxtests/psxhdrs/pthread. --- spec/build/testsuites/psxtests/libpsxhdrs.yml | 4 ++ .../psxhdrs/pthread/pthread_cond_clockwait.c | 59 +++++++++++++++++ .../psxhdrs/pthread/pthread_mutex_clocklock.c | 61 ++++++++++++++++++ .../pthread/pthread_rwlock_clockrdlock.c | 64 +++++++++++++++++++ .../pthread/pthread_rwlock_clockwrlock.c | 64 +++++++++++++++++++ 5 files changed, 252 insertions(+) create mode 100644 testsuites/psxtests/psxhdrs/pthread/pthread_cond_clockwait.c create mode 100644 testsuites/psxtests/psxhdrs/pthread/pthread_mutex_clocklock.c create mode 100644 testsuites/psxtests/psxhdrs/pthread/pthread_rwlock_clockrdlock.c create mode 100644 testsuites/psxtests/psxhdrs/pthread/pthread_rwlock_clockwrlock.c diff --git a/spec/build/testsuites/psxtests/libpsxhdrs.yml b/spec/build/testsuites/psxtests/libpsxhdrs.yml index 6a0ab6d4f7..d7fc430a36 100644 --- a/spec/build/testsuites/psxtests/libpsxhdrs.yml +++ b/spec/build/testsuites/psxtests/libpsxhdrs.yml @@ -432,6 +432,7 @@ source: - testsuites/psxtests/psxhdrs/pthread/pthread_cond_signal.c - testsuites/psxtests/psxhdrs/pthread/pthread_cond_timedwait.c - testsuites/psxtests/psxhdrs/pthread/pthread_cond_wait.c +- testsuites/psxtests/psxhdrs/pthread/pthread_cond_clockwait.c - testsuites/psxtests/psxhdrs/pthread/pthread_condattr_destroy.c - testsuites/psxtests/psxhdrs/pthread/pthread_condattr_getpshared.c - testsuites/psxtests/psxhdrs/pthread/pthread_condattr_init.c @@ -453,6 +454,7 @@ source: - testsuites/psxtests/psxhdrs/pthread/pthread_mutex_lock.c - testsuites/psxtests/psxhdrs/pthread/pthread_mutex_setprioceiling.c - testsuites/psxtests/psxhdrs/pthread/pthread_mutex_timedlock.c +- testsuites/psxtests/psxhdrs/pthread/pthread_mutex_clocklock.c - testsuites/psxtests/psxhdrs/pthread/pthread_mutex_trylock.c - testsuites/psxtests/psxhdrs/pthread/pthread_mutex_unlock.c - testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_destroy.c @@ -464,6 +466,8 @@ source: - testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_setprotocol.c - testsuites/psxtests/psxhdrs/pthread/pthread_mutexattr_setpshared.c - testsuites/psxtests/psxhdrs/pthread/pthread_once.c +- testsuites/psxtests/psxhdrs/pthread/pthread_rwlock_clockrdlock.c +- testsuites/psxtests/psxhdrs/pthread/pthread_rwlock_clockwrlock.c - testsuites/psxtests/psxhdrs/pthread/pthread_self.c - testsuites/psxtests/psxhdrs/pthread/pthread_setcancelstate.c - testsuites/psxtests/psxhdrs/pthread/pthread_setcanceltype.c diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_cond_clockwait.c b/testsuites/psxtests/psxhdrs/pthread/pthread_cond_clockwait.c new file mode 100644 index 0000000000..15485eb587 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/pthread/pthread_cond_clockwait.c @@ -0,0 +1,59 @@ +/* +* @file +* @brief pthread_cond_clockwait() API Conformance Test +*/ + +/* +* Copyright (C) 2021 Matthew Joyce +* +* 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. +*/ + +/* Defining to have access to function prototype in libc/include/pthread.h */ +#define _GNU_SOURCE + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <pthread.h> + +#ifndef _POSIX_THREADS +#error "rtems is supposed to have pthread_cond_clockwait" +#endif + +int test( void ); + +int test( void ) +{ + pthread_cond_t cond = PTHREAD_COND_INITIALIZER; + pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; + clockid_t clock_id = CLOCK_REALTIME; + struct timespec abstime; + abstime.tv_sec = 2; + int result; + + /* This method appeared in the Issue 8 POSIX Standard */ + result = pthread_cond_clockwait( &cond, &mutex, clock_id, &abstime ); + + return result; +} diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_mutex_clocklock.c b/testsuites/psxtests/psxhdrs/pthread/pthread_mutex_clocklock.c new file mode 100644 index 0000000000..d5bae8c645 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/pthread/pthread_mutex_clocklock.c @@ -0,0 +1,61 @@ +/* +* @file +* @brief pthread_mutex_clocklock() API Conformance Test +*/ + +/* +* Copyright (C) 2021 Matthew Joyce +* +* 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. +*/ + +/* Defining to have access to function prototype in libc/include/pthread.h */ +#define _GNU_SOURCE + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <pthread.h> + +#ifndef _POSIX_THREADS +#error "rtems is supposed to have pthread_mutex_clocklock" +#endif +#ifndef _POSIX_TIMEOUTS +#error "rtems is supposed to have pthread_mutex_clocklock" +#endif + +int test( void ); + +int test( void ) +{ + pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; + clockid_t clock_id = CLOCK_REALTIME; + struct timespec abstime; + abstime.tv_sec = 2; + int result; + + /* This method appeared in the Issue 8 POSIX Standard */ + result = pthread_mutex_clocklock( &mutex, clock_id, &abstime ); + + return result; +} diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_rwlock_clockrdlock.c b/testsuites/psxtests/psxhdrs/pthread/pthread_rwlock_clockrdlock.c new file mode 100644 index 0000000000..3807f4bbf9 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/pthread/pthread_rwlock_clockrdlock.c @@ -0,0 +1,64 @@ +/* +* @file +* @brief pthread_rwlock_clockrdlock() API Conformance Test +*/ + +/* +* Copyright (C) 2021 Matthew Joyce +* +* 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. +*/ + +/* Defining to have access to function prototype in libc/include/pthread.h */ +#define _GNU_SOURCE + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <pthread.h> + +#ifndef _POSIX_THREADS +#error "rtems is supposed to have pthread_rwlock_clockrdlock" +#endif +#ifndef _POSIX_TIMEOUTS +#error "rtems is supposed to have pthread_rwlock_clockrdlock" +#endif +#ifndef _POSIX_READER_WRITER_LOCKS +#error "rtems is supposed to have pthread_rwlock_clockrdlock" +#endif + +int test( void ); + +int test( void ) +{ + pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER; + clockid_t clock_id = CLOCK_REALTIME; + struct timespec abstime; + abstime.tv_sec = 2; + int result; + + /* This method appeared in the Issue 8 POSIX Standard */ + result = pthread_rwlock_clockrdlock( &rwlock, clock_id, &abstime ); + + return result; +} diff --git a/testsuites/psxtests/psxhdrs/pthread/pthread_rwlock_clockwrlock.c b/testsuites/psxtests/psxhdrs/pthread/pthread_rwlock_clockwrlock.c new file mode 100644 index 0000000000..e75212a3c3 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/pthread/pthread_rwlock_clockwrlock.c @@ -0,0 +1,64 @@ +/* +* @file +* @brief pthread_rwlock_clockwrlock() API Conformance Test +*/ + +/* +* Copyright (C) 2021 Matthew Joyce +* +* 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. +*/ + +/* Defining to have access to function prototype in libc/include/pthread.h */ +#define _GNU_SOURCE + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <pthread.h> + +#ifndef _POSIX_THREADS +#error "rtems is supposed to have pthread_rwlock_clockwrlock" +#endif +#ifndef _POSIX_TIMEOUTS +#error "rtems is supposed to have pthread_rwlock_clockwrlock" +#endif +#ifndef _POSIX_READER_WRITER_LOCKS +#error "rtems is supposed to have pthread_rwlock_clockwrlock" +#endif + +int test( void ); + +int test( void ) +{ + pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER; + clockid_t clock_id = CLOCK_REALTIME; + struct timespec abstime; + abstime.tv_sec = 2; + int result; + + /* This method appeared in the Issue 8 POSIX Standard */ + result = pthread_rwlock_clockwrlock( &rwlock, clock_id, &abstime ); + + return result; +} -- 2.31.1 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel