Hi guys, Here is the patch for threads.h file.
Thanks Himanshu
From 739b444af181ee86985d7e040f5d7a619e84c7c9 Mon Sep 17 00:00:00 2001 From: Himanshu40 <himanshuwindows...@gmail.com> Date: Sun, 9 Dec 2018 17:50:13 +0530 Subject: [PATCH] psxhdrs: Added POSIX API Signature Compliance Tests for threads.h File (GCI 2018) --- testsuites/psxtests/Makefile.am | 25 ++++++++++ .../psxtests/psxhdrs/threads/call_once.c | 43 ++++++++++++++++ .../psxtests/psxhdrs/threads/cnd_broadcast.c | 39 +++++++++++++++ .../psxtests/psxhdrs/threads/cnd_destroy.c | 39 +++++++++++++++ .../psxtests/psxhdrs/threads/cnd_init.c | 38 ++++++++++++++ .../psxtests/psxhdrs/threads/cnd_signal.c | 39 +++++++++++++++ .../psxtests/psxhdrs/threads/cnd_timedwait.c | 44 ++++++++++++++++ .../psxtests/psxhdrs/threads/cnd_wait.c | 41 +++++++++++++++ .../psxtests/psxhdrs/threads/mtx_destroy.c | 39 +++++++++++++++ .../psxtests/psxhdrs/threads/mtx_init.c | 38 ++++++++++++++ .../psxtests/psxhdrs/threads/mtx_lock.c | 39 +++++++++++++++ .../psxtests/psxhdrs/threads/mtx_timedlock.c | 42 ++++++++++++++++ .../psxtests/psxhdrs/threads/mtx_trylock.c | 39 +++++++++++++++ .../psxtests/psxhdrs/threads/mtx_unlock.c | 39 +++++++++++++++ .../psxtests/psxhdrs/threads/thrd_create.c | 46 +++++++++++++++++ .../psxtests/psxhdrs/threads/thrd_current.c | 46 +++++++++++++++++ .../psxtests/psxhdrs/threads/thrd_detach.c | 47 +++++++++++++++++ .../psxtests/psxhdrs/threads/thrd_equal.c | 50 +++++++++++++++++++ .../psxtests/psxhdrs/threads/thrd_exit.c | 47 +++++++++++++++++ .../psxtests/psxhdrs/threads/thrd_join.c | 48 ++++++++++++++++++ .../psxtests/psxhdrs/threads/thrd_sleep.c | 43 ++++++++++++++++ .../psxtests/psxhdrs/threads/thrd_yield.c | 47 +++++++++++++++++ .../psxtests/psxhdrs/threads/tss_create.c | 39 +++++++++++++++ .../psxtests/psxhdrs/threads/tss_delete.c | 40 +++++++++++++++ testsuites/psxtests/psxhdrs/threads/tss_get.c | 40 +++++++++++++++ testsuites/psxtests/psxhdrs/threads/tss_set.c | 41 +++++++++++++++ 26 files changed, 1078 insertions(+) create mode 100644 testsuites/psxtests/psxhdrs/threads/call_once.c create mode 100644 testsuites/psxtests/psxhdrs/threads/cnd_broadcast.c create mode 100644 testsuites/psxtests/psxhdrs/threads/cnd_destroy.c create mode 100644 testsuites/psxtests/psxhdrs/threads/cnd_init.c create mode 100644 testsuites/psxtests/psxhdrs/threads/cnd_signal.c create mode 100644 testsuites/psxtests/psxhdrs/threads/cnd_timedwait.c create mode 100644 testsuites/psxtests/psxhdrs/threads/cnd_wait.c create mode 100644 testsuites/psxtests/psxhdrs/threads/mtx_destroy.c create mode 100644 testsuites/psxtests/psxhdrs/threads/mtx_init.c create mode 100644 testsuites/psxtests/psxhdrs/threads/mtx_lock.c create mode 100644 testsuites/psxtests/psxhdrs/threads/mtx_timedlock.c create mode 100644 testsuites/psxtests/psxhdrs/threads/mtx_trylock.c create mode 100644 testsuites/psxtests/psxhdrs/threads/mtx_unlock.c create mode 100644 testsuites/psxtests/psxhdrs/threads/thrd_create.c create mode 100644 testsuites/psxtests/psxhdrs/threads/thrd_current.c create mode 100644 testsuites/psxtests/psxhdrs/threads/thrd_detach.c create mode 100644 testsuites/psxtests/psxhdrs/threads/thrd_equal.c create mode 100644 testsuites/psxtests/psxhdrs/threads/thrd_exit.c create mode 100644 testsuites/psxtests/psxhdrs/threads/thrd_join.c create mode 100644 testsuites/psxtests/psxhdrs/threads/thrd_sleep.c create mode 100644 testsuites/psxtests/psxhdrs/threads/thrd_yield.c create mode 100644 testsuites/psxtests/psxhdrs/threads/tss_create.c create mode 100644 testsuites/psxtests/psxhdrs/threads/tss_delete.c create mode 100644 testsuites/psxtests/psxhdrs/threads/tss_get.c create mode 100644 testsuites/psxtests/psxhdrs/threads/tss_set.c diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am index 044aac93d2..b4b307234c 100644 --- a/testsuites/psxtests/Makefile.am +++ b/testsuites/psxtests/Makefile.am @@ -1614,6 +1614,31 @@ lib_a_SOURCES = psxhdrs/devctl/posix_devctl.c \ psxhdrs/syslog/openlog.c \ psxhdrs/syslog/setlogmask.c \ psxhdrs/syslog/syslog.c \ + psxhdrs/threads/call_once.c \ + psxhdrs/threads/cnd_broadcast.c \ + psxhdrs/threads/cnd_destroy.c \ + psxhdrs/threads/cnd_init.c \ + psxhdrs/threads/cnd_signal.c \ + psxhdrs/threads/cnd_timedwait.c \ + psxhdrs/threads/cnd_wait.c \ + psxhdrs/threads/mtx_init.c \ + psxhdrs/threads/mtx_destroy.c \ + psxhdrs/threads/mtx_lock.c \ + psxhdrs/threads/mtx_timedlock.c \ + psxhdrs/threads/mtx_trylock.c \ + psxhdrs/threads/mtx_unlock.c \ + psxhdrs/threads/thrd_create.c \ + psxhdrs/threads/thrd_current.c \ + psxhdrs/threads/thrd_detach.c \ + psxhdrs/threads/thrd_equal.c \ + psxhdrs/threads/thrd_exit.c \ + psxhdrs/threads/thrd_join.c \ + psxhdrs/threads/thrd_sleep.c \ + psxhdrs/threads/thrd_yield.c \ + psxhdrs/threads/tss_create.c \ + psxhdrs/threads/tss_delete.c \ + psxhdrs/threads/tss_get.c \ + psxhdrs/threads/tss_set.c \ psxhdrs/wchar/btowc.c \ psxhdrs/wchar/fgetwc.c \ psxhdrs/wchar/fgetws.c \ diff --git a/testsuites/psxtests/psxhdrs/threads/call_once.c b/testsuites/psxtests/psxhdrs/threads/call_once.c new file mode 100644 index 0000000000..9d697d756f --- /dev/null +++ b/testsuites/psxtests/psxhdrs/threads/call_once.c @@ -0,0 +1,43 @@ +/** + * @file + * @brief call_once() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <stdio.h> +#include <threads.h> + +int test( void ); +void do_once( void ); + +int test( void ) +{ + once_flag flag = ONCE_FLAG_INIT; + + call_once( &flag, do_once ); + + return 0; +} + +void do_once(void) { + puts( "called once" ); +} diff --git a/testsuites/psxtests/psxhdrs/threads/cnd_broadcast.c b/testsuites/psxtests/psxhdrs/threads/cnd_broadcast.c new file mode 100644 index 0000000000..febc96c05e --- /dev/null +++ b/testsuites/psxtests/psxhdrs/threads/cnd_broadcast.c @@ -0,0 +1,39 @@ +/** + * @file + * @brief cnd_broadcast() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <threads.h> + +int test( void ); + +int test( void ) +{ + cnd_t cv; + int result; + + cnd_init( &cv ); + result = cnd_broadcast( &cv ); + + return ( result != -1 ); +} diff --git a/testsuites/psxtests/psxhdrs/threads/cnd_destroy.c b/testsuites/psxtests/psxhdrs/threads/cnd_destroy.c new file mode 100644 index 0000000000..afeaf1c633 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/threads/cnd_destroy.c @@ -0,0 +1,39 @@ +/** + * @file + * @brief cnd_destroy() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <threads.h> + +int test( void ); + +int test( void ) +{ + cnd_t cv; + int result; + + result = cnd_init( &cv ); + cnd_destroy( &cv ); + + return ( result != -1 ); +} diff --git a/testsuites/psxtests/psxhdrs/threads/cnd_init.c b/testsuites/psxtests/psxhdrs/threads/cnd_init.c new file mode 100644 index 0000000000..5afcd1b92f --- /dev/null +++ b/testsuites/psxtests/psxhdrs/threads/cnd_init.c @@ -0,0 +1,38 @@ +/** + * @file + * @brief cnd_init() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <threads.h> + +int test( void ); + +int test( void ) +{ + cnd_t cv; + int result; + + result = cnd_init( &cv ); + + return ( result != -1 ); +} diff --git a/testsuites/psxtests/psxhdrs/threads/cnd_signal.c b/testsuites/psxtests/psxhdrs/threads/cnd_signal.c new file mode 100644 index 0000000000..0d2f20e3fd --- /dev/null +++ b/testsuites/psxtests/psxhdrs/threads/cnd_signal.c @@ -0,0 +1,39 @@ +/** + * @file + * @brief cnd_signal() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <threads.h> + +int test( void ); + +int test( void ) +{ + cnd_t cv; + int result; + + cnd_init( &cv ); + result = cnd_signal( &cv ); + + return ( result != -1 ); +} diff --git a/testsuites/psxtests/psxhdrs/threads/cnd_timedwait.c b/testsuites/psxtests/psxhdrs/threads/cnd_timedwait.c new file mode 100644 index 0000000000..74761318d5 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/threads/cnd_timedwait.c @@ -0,0 +1,44 @@ +/** + * @file + * @brief cnd_timedwait() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <threads.h> + +int test( void ); + +int test( void ) +{ + cnd_t cv; + mtx_t mtx; + struct timespec ts; + int result; + + ts.tv_nsec = 0; + + cnd_init( &cv ); + mtx_init( &mtx, mtx_plain ); + result = cnd_timedwait( &cv, &mtx, &ts ); + + return ( result != -1 ); +} diff --git a/testsuites/psxtests/psxhdrs/threads/cnd_wait.c b/testsuites/psxtests/psxhdrs/threads/cnd_wait.c new file mode 100644 index 0000000000..672eef1bdc --- /dev/null +++ b/testsuites/psxtests/psxhdrs/threads/cnd_wait.c @@ -0,0 +1,41 @@ +/** + * @file + * @brief cnd_wait() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <threads.h> + +int test( void ); + +int test( void ) +{ + cnd_t cv; + mtx_t mtx; + int result; + + cnd_init( &cv ); + mtx_init( &mtx, mtx_plain ); + result = cnd_wait( &cv, &mtx ); + + return ( result != -1 ); +} diff --git a/testsuites/psxtests/psxhdrs/threads/mtx_destroy.c b/testsuites/psxtests/psxhdrs/threads/mtx_destroy.c new file mode 100644 index 0000000000..dc621c9d96 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/threads/mtx_destroy.c @@ -0,0 +1,39 @@ +/** + * @file + * @brief mtx_destroy() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <threads.h> + +int test( void ); + +int test( void ) +{ + mtx_t mtx; + int result; + + result = mtx_init( &mtx, mtx_plain ); + mtx_destroy( &mtx ); + + return ( result != -1 ); +} diff --git a/testsuites/psxtests/psxhdrs/threads/mtx_init.c b/testsuites/psxtests/psxhdrs/threads/mtx_init.c new file mode 100644 index 0000000000..4f4d0e3394 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/threads/mtx_init.c @@ -0,0 +1,38 @@ +/** + * @file + * @brief mtx_init() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <threads.h> + +int test( void ); + +int test( void ) +{ + mtx_t mtx; + int result; + + result = mtx_init( &mtx, mtx_plain ); + + return ( result != -1 ); +} diff --git a/testsuites/psxtests/psxhdrs/threads/mtx_lock.c b/testsuites/psxtests/psxhdrs/threads/mtx_lock.c new file mode 100644 index 0000000000..c336c07fa4 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/threads/mtx_lock.c @@ -0,0 +1,39 @@ +/** + * @file + * @brief mtx_lock() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <threads.h> + +int test( void ); + +int test( void ) +{ + mtx_t mtx; + int result; + + mtx_init( &mtx, mtx_plain ); + result = mtx_lock( &mtx ); + + return ( result != -1 ); +} diff --git a/testsuites/psxtests/psxhdrs/threads/mtx_timedlock.c b/testsuites/psxtests/psxhdrs/threads/mtx_timedlock.c new file mode 100644 index 0000000000..677b2d1715 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/threads/mtx_timedlock.c @@ -0,0 +1,42 @@ +/** + * @file + * @brief mtx_timedlock() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <threads.h> + +int test( void ); + +int test( void ) +{ + mtx_t mtx; + struct timespec time_point; + int result; + + time_point.tv_nsec = 0; + + mtx_init( &mtx, mtx_plain ); + result = mtx_timedlock( &mtx, &time_point ); + + return ( result != -1 ); +} diff --git a/testsuites/psxtests/psxhdrs/threads/mtx_trylock.c b/testsuites/psxtests/psxhdrs/threads/mtx_trylock.c new file mode 100644 index 0000000000..314ce38052 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/threads/mtx_trylock.c @@ -0,0 +1,39 @@ +/** + * @file + * @brief mtx_trylock() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <threads.h> + +int test( void ); + +int test( void ) +{ + mtx_t mtx; + int result; + + mtx_init( &mtx, mtx_plain ); + result = mtx_trylock( &mtx ); + + return ( result != -1 ); +} diff --git a/testsuites/psxtests/psxhdrs/threads/mtx_unlock.c b/testsuites/psxtests/psxhdrs/threads/mtx_unlock.c new file mode 100644 index 0000000000..7b10c149d8 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/threads/mtx_unlock.c @@ -0,0 +1,39 @@ +/** + * @file + * @brief mtx_unlock() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <threads.h> + +int test( void ); + +int test( void ) +{ + mtx_t mtx; + int result; + + mtx_init( &mtx, mtx_plain ); + result = mtx_unlock( &mtx ); + + return ( result != -1 ); +} diff --git a/testsuites/psxtests/psxhdrs/threads/thrd_create.c b/testsuites/psxtests/psxhdrs/threads/thrd_create.c new file mode 100644 index 0000000000..397b186113 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/threads/thrd_create.c @@ -0,0 +1,46 @@ +/** + * @file + * @brief thrd_create() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <threads.h> + +int test( void ); +int th_func( void *arg ); + +int test( void ) +{ + thrd_t th; + int n = 1; + int result; + + result = thrd_create( &th, th_func, &n ); + + return ( result != -1 ); +} + +int th_func( void *arg ) +{ + ++*(int*)arg; + return 0; +} diff --git a/testsuites/psxtests/psxhdrs/threads/thrd_current.c b/testsuites/psxtests/psxhdrs/threads/thrd_current.c new file mode 100644 index 0000000000..83f4aaec9a --- /dev/null +++ b/testsuites/psxtests/psxhdrs/threads/thrd_current.c @@ -0,0 +1,46 @@ +/** + * @file + * @brief thrd_current() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <threads.h> + +int test( void ); +int th_func( void *arg ); + +int test( void ) +{ + thrd_t th; + int n = 1; + + thrd_create( &th, th_func, &n ); + th = thrd_current(); + + return ( th != -1 ); +} + +int th_func( void *arg ) +{ + ++*(int*)arg; + return 0; +} diff --git a/testsuites/psxtests/psxhdrs/threads/thrd_detach.c b/testsuites/psxtests/psxhdrs/threads/thrd_detach.c new file mode 100644 index 0000000000..c5d41db2d2 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/threads/thrd_detach.c @@ -0,0 +1,47 @@ +/** + * @file + * @brief thrd_detach() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <threads.h> + +int test( void ); +int th_func( void *arg ); + +int test( void ) +{ + thrd_t th; + int n = 1; + int result; + + thrd_create( &th, th_func, &n ); + result = thrd_detach( th ); + + return ( result != -1 ); +} + +int th_func( void *arg ) +{ + ++*(int*)arg; + return 0; +} diff --git a/testsuites/psxtests/psxhdrs/threads/thrd_equal.c b/testsuites/psxtests/psxhdrs/threads/thrd_equal.c new file mode 100644 index 0000000000..a89df70299 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/threads/thrd_equal.c @@ -0,0 +1,50 @@ +/** + * @file + * @brief thrd_equal() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <threads.h> + +int test( void ); +int th_func( void *arg ); + +int test( void ) +{ + thrd_t lhs; + thrd_t rhs; + int ln = 1; + int rn = 1; + int result; + + thrd_create( &lhs, th_func, &ln ); + thrd_create( &rhs, th_func, &rn ); + result = thrd_equal( lhs, rhs ); + + return ( result != -1 ); +} + +int th_func( void *arg ) +{ + ++*(int*)arg; + return 0; +} diff --git a/testsuites/psxtests/psxhdrs/threads/thrd_exit.c b/testsuites/psxtests/psxhdrs/threads/thrd_exit.c new file mode 100644 index 0000000000..59a1f97fa5 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/threads/thrd_exit.c @@ -0,0 +1,47 @@ +/** + * @file + * @brief thrd_exit() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <threads.h> + +int test( void ); +int th_func( void *arg ); + +int test( void ) +{ + thrd_t th; + int n = 1; + int result; + + result = thrd_create( &th, th_func, &n ); + thrd_exit( 1 ); + + return ( result != -1 ); +} + +int th_func( void *arg ) +{ + ++*(int*)arg; + return 0; +} diff --git a/testsuites/psxtests/psxhdrs/threads/thrd_join.c b/testsuites/psxtests/psxhdrs/threads/thrd_join.c new file mode 100644 index 0000000000..4d40c136db --- /dev/null +++ b/testsuites/psxtests/psxhdrs/threads/thrd_join.c @@ -0,0 +1,48 @@ +/** + * @file + * @brief thrd_join() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <threads.h> + +int test( void ); +int th_func( void *arg ); + +int test( void ) +{ + thrd_t th; + int n = 1; + int res = 1; + int result; + + thrd_create( &th, th_func, &n ); + result = thrd_join( th, &res ); + + return ( result != -1 ); +} + +int th_func( void *arg ) +{ + ++*(int*)arg; + return 0; +} diff --git a/testsuites/psxtests/psxhdrs/threads/thrd_sleep.c b/testsuites/psxtests/psxhdrs/threads/thrd_sleep.c new file mode 100644 index 0000000000..f0040dd3c4 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/threads/thrd_sleep.c @@ -0,0 +1,43 @@ +/** + * @file + * @brief thrd_sleep() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <threads.h> + +int test( void ); +int th_func( void *arg ); + +int test( void ) +{ + struct timespec duration; + struct timespec remaining; + int result; + + duration.tv_nsec = 0; + remaining.tv_nsec = 1; + + result = thrd_sleep( &duration, &remaining ); + + return ( result != -1 ); +} diff --git a/testsuites/psxtests/psxhdrs/threads/thrd_yield.c b/testsuites/psxtests/psxhdrs/threads/thrd_yield.c new file mode 100644 index 0000000000..11c2d79214 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/threads/thrd_yield.c @@ -0,0 +1,47 @@ +/** + * @file + * @brief thrd_yield() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <threads.h> + +int test( void ); +int th_func( void *arg ); + +int test( void ) +{ + thrd_t th; + int n = 1; + int result; + + result = thrd_create( &th, th_func, &n ); + thrd_yield(); + + return ( result != -1 ); +} + +int th_func( void *arg ) +{ + ++*(int*)arg; + return 0; +} diff --git a/testsuites/psxtests/psxhdrs/threads/tss_create.c b/testsuites/psxtests/psxhdrs/threads/tss_create.c new file mode 100644 index 0000000000..e9a3ef31cc --- /dev/null +++ b/testsuites/psxtests/psxhdrs/threads/tss_create.c @@ -0,0 +1,39 @@ +/** + * @file + * @brief tss_create() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <threads.h> + +int test( void ); + +int test( void ) +{ + tss_t key; + tss_dtor_t destructor = NULL; + int result; + + result = tss_create( &key, destructor ); + + return ( result != -1 ); +} diff --git a/testsuites/psxtests/psxhdrs/threads/tss_delete.c b/testsuites/psxtests/psxhdrs/threads/tss_delete.c new file mode 100644 index 0000000000..4ceb1ae148 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/threads/tss_delete.c @@ -0,0 +1,40 @@ +/** + * @file + * @brief tss_delete() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <threads.h> + +int test( void ); + +int test( void ) +{ + tss_t key; + tss_dtor_t destructor = NULL; + int result; + + result = tss_create( &key, destructor ); + tss_delete( key ); + + return ( result != -1 ); +} diff --git a/testsuites/psxtests/psxhdrs/threads/tss_get.c b/testsuites/psxtests/psxhdrs/threads/tss_get.c new file mode 100644 index 0000000000..9630a63d57 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/threads/tss_get.c @@ -0,0 +1,40 @@ +/** + * @file + * @brief tss_get() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <threads.h> + +int test( void ); + +int test( void ) +{ + tss_t key; + tss_dtor_t destructor = NULL; + void *get; + + tss_create( &key, destructor ); + get = tss_get( key ); + + return ( get != NULL ); +} diff --git a/testsuites/psxtests/psxhdrs/threads/tss_set.c b/testsuites/psxtests/psxhdrs/threads/tss_set.c new file mode 100644 index 0000000000..7b0ac3dff1 --- /dev/null +++ b/testsuites/psxtests/psxhdrs/threads/tss_set.c @@ -0,0 +1,41 @@ +/** + * @file + * @brief tss_set() API Conformance Test + */ + +/* + * COPYRIGHT (c) 2018. + * Himanshu Sekhar Nayak + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR + * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES + * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, + * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, + * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <stdlib.h> +#include <threads.h> + +int test( void ); + +int test( void ) +{ + tss_t key; + tss_dtor_t destructor = NULL; + int result; + + tss_create( &key, destructor ); + result = tss_set( key, malloc( 4 ) ); + + return ( result != -1 ); +} -- 2.17.2
_______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel