psxhdrs: Added POSIX API Signature Compliance Tests for threads.h (GCI 2018)

This commit is contained in:
Himanshu40
2018-12-09 17:50:13 +05:30
committed by Joel Sherrill
parent a5c0886a6d
commit b009cfb638
26 changed files with 1069 additions and 0 deletions

View File

@@ -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/c11/threads/call_once.c \
psxhdrs/c11/threads/cnd_broadcast.c \
psxhdrs/c11/threads/cnd_destroy.c \
psxhdrs/c11/threads/cnd_init.c \
psxhdrs/c11/threads/cnd_signal.c \
psxhdrs/c11/threads/cnd_timedwait.c \
psxhdrs/c11/threads/cnd_wait.c \
psxhdrs/c11/threads/mtx_init.c \
psxhdrs/c11/threads/mtx_destroy.c \
psxhdrs/c11/threads/mtx_lock.c \
psxhdrs/c11/threads/mtx_timedlock.c \
psxhdrs/c11/threads/mtx_trylock.c \
psxhdrs/c11/threads/mtx_unlock.c \
psxhdrs/c11/threads/thrd_create.c \
psxhdrs/c11/threads/thrd_current.c \
psxhdrs/c11/threads/thrd_detach.c \
psxhdrs/c11/threads/thrd_equal.c \
psxhdrs/c11/threads/thrd_exit.c \
psxhdrs/c11/threads/thrd_join.c \
psxhdrs/c11/threads/thrd_sleep.c \
psxhdrs/c11/threads/thrd_yield.c \
psxhdrs/c11/threads/tss_create.c \
psxhdrs/c11/threads/tss_delete.c \
psxhdrs/c11/threads/tss_get.c \
psxhdrs/c11/threads/tss_set.c \
psxhdrs/wchar/btowc.c \
psxhdrs/wchar/fgetwc.c \
psxhdrs/wchar/fgetws.c \

View File

@@ -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" );
}

View File

@@ -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 );
}

View File

@@ -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 );
}

View File

@@ -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 );
}

View File

@@ -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 );
}

View File

@@ -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 );
}

View File

@@ -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 );
}

View File

@@ -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 );
}

View File

@@ -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 );
}

View File

@@ -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 );
}

View File

@@ -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 );
}

View File

@@ -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 );
}

View File

@@ -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 );
}

View File

@@ -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;
}

View File

@@ -0,0 +1,37 @@
/**
* @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 test( void )
{
thrd_t th;
th = thrd_current();
return ( th != 0 );
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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 );
}

View File

@@ -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;
}

View File

@@ -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 );
}

View File

@@ -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 );
}

View File

@@ -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 );
}

View File

@@ -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 );
}