update api tests with options
authorSzabolcs Nagy <nsz@port70.net>
Fri, 26 Jul 2013 23:34:07 +0000 (23:34 +0000)
committerSzabolcs Nagy <nsz@port70.net>
Fri, 26 Jul 2013 23:34:07 +0000 (23:34 +0000)
so far ifdefs were only added for options that musl does not support

Makefile
src/api/fcntl.c
src/api/limits.c
src/api/mqueue.c
src/api/pthread.c
src/api/sched.c
src/api/spawn.c
src/api/sys_mman.c
src/api/sys_stat.c
src/api/unistd.c

index 8baa9a8..d27eb2d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -107,12 +107,11 @@ $(B)/api/main: $(api.OBJS)
 api/main.OBJS:=$(api.OBJS)
 $(api.OBJS):$(B)/common/options.h
 $(api.OBJS):CFLAGS+=-pedantic-errors -Werror -Wno-unused -D_XOPEN_SOURCE=700
-$(api.OBJS):CFLAGS+=-DX_PS -DX_TPS -DX_SS
 
 all:$(B)/REPORT
 run:$(B)/REPORT
 clean:
-       rm -f $(OBJS) $(BINS) $(LIBS) $(B)/common/libtest.a $(B)/common/runtest $(B)/*/*.err
+       rm -f $(OBJS) $(BINS) $(LIBS) $(B)/common/libtest.a $(B)/common/runtest $(B)/common/options.h $(B)/*/*.err
 cleanall: clean
        rm -f $(B)/REPORT $(B)/*/REPORT
 $(B)/REPORT:
index 4c25cdc..bd1d8dd 100644 (file)
@@ -1,4 +1,5 @@
 #include <fcntl.h>
+#include "options.h"
 #define T(t) (t*)0;
 #define F(t,n) {t *y = &x.n;}
 #define C(n) switch(n){case n:;}
@@ -28,9 +29,11 @@ C(O_NOCTTY)
 C(O_TRUNC)
 C(O_TTY_INIT)
 C(O_APPEND)
-C(O_DSYNC)
 C(O_NONBLOCK)
+#ifdef POSIX_SYNCHRONIZED_IO
+C(O_DSYNC)
 C(O_RSYNC)
+#endif
 C(O_SYNC)
 C(O_ACCMODE)
 C(O_EXEC)
index cbe88f8..b26cbbe 100644 (file)
@@ -1,4 +1,5 @@
 #include <limits.h>
+#include "options.h"
 #define C(n) switch(n){case n:;}
 static void f()
 {
@@ -23,8 +24,10 @@ C(_POSIX_LINK_MAX)
 C(_POSIX_LOGIN_NAME_MAX)
 C(_POSIX_MAX_CANON)
 C(_POSIX_MAX_INPUT)
+#ifdef POSIX_MESSAGE_PASSING
 C(_POSIX_MQ_OPEN_MAX)
 C(_POSIX_MQ_PRIO_MAX)
+#endif
 C(_POSIX_NAME_MAX)
 C(_POSIX_NGROUPS_MAX)
 C(_POSIX_OPEN_MAX)
@@ -36,7 +39,9 @@ C(_POSIX_SEM_NSEMS_MAX)
 C(_POSIX_SEM_VALUE_MAX)
 C(_POSIX_SIGQUEUE_MAX)
 C(_POSIX_SSIZE_MAX)
+#if defined(POSIX_SPORADIC_SERVER) || defined(POSIX_THREAD_SPORADIC_SERVER)
 C(_POSIX_SS_REPL_MAX)
+#endif
 C(_POSIX_STREAM_MAX)
 C(_POSIX_SYMLINK_MAX)
 C(_POSIX_SYMLOOP_MAX)
index d9f754c..d16faf1 100644 (file)
@@ -1,3 +1,5 @@
+#include "options.h"
+#ifdef POSIX_MESSAGE_PASSING
 #include <mqueue.h>
 #define T(t) (t*)0;
 #define F(t,n) {t *y = &x.n;}
@@ -31,3 +33,5 @@ static void g()
 {ssize_t(*p)(mqd_t,char*restrict,size_t,unsigned*restrict,const struct timespec*restrict) = mq_timedreceive;}
 {int(*p)(mqd_t,const char*,size_t,unsigned,const struct timespec*) = mq_timedsend;}
 }
+#endif
+
index 0501380..fa2b2fc 100644 (file)
@@ -31,14 +31,19 @@ C(PTHREAD_MUTEX_RECURSIVE)
 C(PTHREAD_MUTEX_ROBUST)
 C(PTHREAD_MUTEX_STALLED)
 C(PTHREAD_ONCE_INIT)
+#if defined(POSIX_THREAD_ROBUST_PRIO_INHERIT) || defined(POSIX_THREAD_PRIO_INHERIT)
 C(PTHREAD_PRIO_INHERIT)
+#endif
+#if defined(POSIX_THREAD_ROBUST_PRIO_INHERIT) || defined(POSIX_THREAD_PRIO_INHERIT) \
+ || defined(POSIX_THREAD_ROBUST_PRIO_PROTECT) || defined(POSIX_THREAD_PRIO_PROTECT)
 C(PTHREAD_PRIO_NONE)
-#ifdef X_RPP_TPP
+#endif
+#if defined(POSIX_THREAD_ROBUST_PRIO_PROTECT) || defined(POSIX_THREAD_PRIO_PROTECT)
 C(PTHREAD_PRIO_PROTECT)
 #endif
 C(PTHREAD_PROCESS_SHARED)
 C(PTHREAD_PROCESS_PRIVATE)
-#ifdef X_TPS
+#ifdef POSIX_THREAD_PRIORITY_SCHEDULING
 C(PTHREAD_EXPLICIT_SCHED)
 C(PTHREAD_INHERIT_SCHED)
 C(PTHREAD_SCOPE_PROCESS)
@@ -101,12 +106,15 @@ C(PTHREAD_SCOPE_SYSTEM)
 {int(*p)(pthread_mutex_t*) = pthread_mutex_trylock;}
 {int(*p)(pthread_mutex_t*) = pthread_mutex_unlock;}
 {int(*p)(pthread_mutexattr_t*) = pthread_mutexattr_destroy;}
+#if defined(POSIX_THREAD_ROBUST_PRIO_INHERIT) || defined(POSIX_THREAD_PRIO_INHERIT) \
+ || defined(POSIX_THREAD_ROBUST_PRIO_PROTECT) || defined(POSIX_THREAD_PRIO_PROTECT)
 {int(*p)(const pthread_mutexattr_t*restrict,int*restrict) = pthread_mutexattr_getprotocol;}
+{int(*p)(pthread_mutexattr_t*,int) = pthread_mutexattr_setprotocol;}
+#endif
 {int(*p)(const pthread_mutexattr_t*restrict,int*restrict) = pthread_mutexattr_getpshared;}
 {int(*p)(const pthread_mutexattr_t*restrict,int*restrict) = pthread_mutexattr_getrobust;}
 {int(*p)(const pthread_mutexattr_t*restrict,int*restrict) = pthread_mutexattr_gettype;}
 {int(*p)(pthread_mutexattr_t*) = pthread_mutexattr_init;}
-{int(*p)(pthread_mutexattr_t*,int) = pthread_mutexattr_setprotocol;}
 {int(*p)(pthread_mutexattr_t*,int) = pthread_mutexattr_setpshared;}
 {int(*p)(pthread_mutexattr_t*,int) = pthread_mutexattr_setrobust;}
 {int(*p)(pthread_mutexattr_t*,int) = pthread_mutexattr_settype;}
@@ -133,15 +141,13 @@ C(PTHREAD_SCOPE_SYSTEM)
 {int(*p)(pthread_spinlock_t*) = pthread_spin_trylock;}
 {int(*p)(pthread_spinlock_t*) = pthread_spin_unlock;}
 {void(*p)(void) = pthread_testcancel;}
-
-#ifdef X_RPP_TPP
+#if defined(POSIX_THREAD_ROBUST_PRIO_PROTECT) || defined(POSIX_THREAD_PRIO_PROTECT)
 {int(*p)(const pthread_mutex_t*restrict,int*restrict) = pthread_mutex_getprioceiling;}
 {int(*p)(pthread_mutex_t*restrict,int,int*restrict) = pthread_mutex_setprioceiling;}
 {int(*p)(const pthread_mutexattr_t*restrict,int*restrict) = pthread_mutexattr_getprioceiling;}
 {int(*p)(pthread_mutexattr_t*,int) = pthread_mutexattr_setprioceiling;}
 #endif
-
-#ifdef X_TPS
+#ifdef POSIX_THREAD_PRIORITY_SCHEDULING
 {int(*p)(const pthread_attr_t*restrict,int*restrict) = pthread_attr_getinheritsched;}
 {int(*p)(const pthread_attr_t*restrict,int*restrict) = pthread_attr_getschedpolicy;}
 {int(*p)(const pthread_attr_t*restrict,int*restrict) = pthread_attr_getscope;}
index 365b01f..def5b35 100644 (file)
@@ -1,4 +1,5 @@
 #include <sched.h>
+#include "options.h"
 #define T(t) (t*)0;
 #define F(t,n) {t *y = &x.n;}
 #define C(n) switch(n){case n:;}
@@ -8,7 +9,7 @@ T(struct timespec)
 {
 struct sched_param x;
 F(int,sched_priority)
-#ifdef X_SS
+#if defined(POSIX_SPORADIC_SERVER) || defined(POSIX_THREAD_SPORADIC_SERVER)
 F(int,sched_ss_low_priority)
 F(struct timespec,sched_ss_repl_period)
 F(struct timespec,sched_ss_init_budget)
@@ -17,18 +18,18 @@ T(time_t)
 C(SCHED_SPORADIC)
 #endif
 }
-#ifdef X_PS
+#ifdef POSIX_PRIORITY_SCHEDULING
 T(pid_t)
+{int(*p)(pid_t,struct sched_param*) = sched_getparam;}
+{int(*p)(pid_t) = sched_getscheduler;}
+{int(*p)(pid_t,const struct sched_param*) = sched_setparam;}
+{int(*p)(pid_t,int,const struct sched_param*) = sched_setscheduler;}
+#endif
 C(SCHED_FIFO)
 C(SCHED_RR)
 C(SCHED_OTHER)
-{int(*p)(pid_t,struct sched_param*) = sched_getparam;}
-{int(*p)(pid_t) = sched_getscheduler;}
 {int(*p)(int) = sched_get_priority_max;}
 {int(*p)(int) = sched_get_priority_min;}
 {int(*p)(pid_t,struct timespec*) = sched_rr_get_interval;}
-{int(*p)(pid_t,const struct sched_param*) = sched_setparam;}
-{int(*p)(pid_t,int,const struct sched_param*) = sched_setscheduler;}
-#endif
 {int(*p)(void) = sched_yield;}
 }
index 6cd91ce..94511ea 100644 (file)
@@ -1,4 +1,5 @@
 #include <spawn.h>
+#include "options.h"
 #define T(t) (t*)0;
 #define C(n) switch(n){case n:;}
 static void f()
@@ -11,7 +12,7 @@ T(sigset_t)
 T(struct sched_param)
 C(POSIX_SPAWN_RESETIDS)
 C(POSIX_SPAWN_SETPGROUP)
-#ifdef X_PS
+#ifdef POSIX_PRIORITY_SCHEDULING
 C(POSIX_SPAWN_SETSCHEDPARAM)
 C(POSIX_SPAWN_SETSCHEDULER)
 #endif
@@ -39,7 +40,7 @@ static void g()
 {int(*p)(posix_spawnattr_t*restrict,const sigset_t*restrict) = posix_spawnattr_setsigdefault;}
 {int(*p)(posix_spawnattr_t*restrict,const sigset_t*restrict) = posix_spawnattr_setsigmask;}
 }
-#ifdef X_PS
+#ifdef POSIX_PRIORITY_SCHEDULING
 #include <sched.h>
 static void h()
 {
index 73e53c6..62b1722 100644 (file)
@@ -1,4 +1,5 @@
 #include <sys/mman.h>
+#include "options.h"
 #define T(t) (t*)0;
 #define F(t,n) {t *y = &x.n;}
 #define C(n) switch(n){case n:;}
@@ -29,7 +30,7 @@ C(POSIX_MADV_RANDOM)
 C(POSIX_MADV_SEQUENTIAL)
 C(POSIX_MADV_WILLNEED)
 
-#ifdef X_TYM
+#ifdef POSIX_TYPED_MEMORY_OBJECTS
 C(POSIX_TYPED_MEM_ALLOCATE)
 C(POSIX_TYPED_MEM_ALLOCATE_CONTIG)
 C(POSIX_TYPED_MEM_MAP_ALLOCATABLE)
@@ -53,6 +54,8 @@ int(*p)(const char*,int,int) = posix_typed_mem_open;
 {int(*p)(void) = munlockall;}
 {int(*p)(void*,size_t) = munmap;}
 {int(*p)(void*,size_t,int) = posix_madvise;}
+#ifdef POSIX_SHARED_MEMORY_OBJECTS
 {int(*p)(const char*,int,mode_t) = shm_open;}
 {int(*p)(const char*) = shm_unlink;}
+#endif
 }
index b51b1e1..75477a0 100644 (file)
@@ -1,4 +1,5 @@
 #include <sys/stat.h>
+#include "options.h"
 #define T(t) (t*)0;
 #define F(t,n) {t *y = &x.n;}
 #define C(n) switch(n){case n:;}
@@ -73,7 +74,9 @@ struct stat x = {0};
 {int i = S_TYPEISMQ(&x);}
 {int i = S_TYPEISSEM(&x);}
 {int i = S_TYPEISSHM(&x);}
+#ifdef POSIX_TYPED_MEMORY_OBJECTS
 {int i = S_TYPEISTMO(&x);}
+#endif
 }
 C(UTIME_NOW)
 C(UTIME_OMIT)
index d63da54..93355a6 100644 (file)
@@ -1,14 +1,72 @@
 #include <unistd.h>
+#include "options.h"
 #define T(t) (t*)0;
 #define F(t,n) {t *y = &x.n;}
 #define C(n) switch(n){case n:;}
+#define A(n) {char p[n];}
 static void f()
 {
-C(_POSIX_VERSION)
-C(_POSIX2_VERSION)
+A(_POSIX_VERSION >= 200809L)
+A(_POSIX2_VERSION >= 200809L)
 #ifdef _XOPEN_SOURCE
-C(_XOPEN_VERSION)
+A(_XOPEN_VERSION >= 700)
+// A(_XOPEN_CRYPT >= 0)
+ A(_XOPEN_ENH_I18N > 0)
+// A(_XOPEN_REALTIME >= 0)
+// A(_XOPEN_REALTIME_THREADS >= 0)
+// A(_XOPEN_SHM >= 0)
+ A(_XOPEN_UNIX >= 0)
 #endif
+A(_POSIX_ASYNCHRONOUS_IO >= 200809L)
+A(_POSIX_BARRIERS >= 200809L)
+A(_POSIX_CHOWN_RESTRICTED >= 0)
+A(_POSIX_CLOCK_SELECTION >= 200809L)
+A(_POSIX_JOB_CONTROL > 0)
+A(_POSIX_MAPPED_FILES >= 200809L)
+A(_POSIX_MEMORY_PROTECTION >= 200809L)
+A(_POSIX_NO_TRUNC >= 0)
+A(_POSIX_READER_WRITER_LOCKS >= 200809L)
+A(_POSIX_REALTIME_SIGNALS >= 200809L)
+A(_POSIX_REGEXP > 0)
+A(_POSIX_SAVED_IDS > 0)
+A(_POSIX_SEMAPHORES >= 200809L)
+A(_POSIX_SHELL > 0)
+A(_POSIX_SPIN_LOCKS >= 200809L)
+A(_POSIX_THREAD_SAFE_FUNCTIONS >= 200809L)
+A(_POSIX_THREADS >= 200809L)
+A(_POSIX_TIMEOUTS >= 200809L)
+A(_POSIX_TIMERS >= 200809L)
+#if _POSIX_V7_ILP32_OFFBIG<=0 && _POSIX_V7_LP64_OFF64<=0 && _POSIX_V7_LPBIG_OFFBIG<=0
+#error _POSIX_V7_ILP32_OFFBIG<=0 && _POSIX_V7_LP64_OFF64<=0 && _POSIX_V7_LPBIG_OFFBIG<=0
+#endif
+A(_POSIX2_C_BIND >= 200809L)
+// not required by the standard
+ A(_POSIX_ADVISORY_INFO >= 0)
+ A(_POSIX_CPUTIME >= 0)
+ A(_POSIX_FSYNC >= 0)
+ A(_POSIX_IPV6 >= 0)
+ A(_POSIX_MEMLOCK >= 0)
+ A(_POSIX_MEMLOCK_RANGE >= 0)
+ A(_POSIX_MESSAGE_PASSING >= 0)
+ A(_POSIX_MONOTONIC_CLOCK >= 0)
+// A(_POSIX_PRIORITIZED_IO >= 0)
+// A(_POSIX_PRIORITY_SCHEDULING >= 0)
+ A(_POSIX_RAW_SOCKETS >= 0)
+// A(_POSIX_SHARED_MEMORY_OBJECTS >= 0)
+ A(_POSIX_SPAWN >= 0)
+// A(_POSIX_SPORADIC_SERVER >= 0)
+// A(_POSIX_SYNCHRONIZED_IO >= 0)
+ A(_POSIX_THREAD_ATTR_STACKADDR >= 0)
+ A(_POSIX_THREAD_ATTR_STACKSIZE >= 0)
+ A(_POSIX_THREAD_CPUTIME >= 0)
+// A(_POSIX_THREAD_PRIO_INHERIT >= 0)
+// A(_POSIX_THREAD_PRIO_PROTECT >= 0)
+ A(_POSIX_THREAD_PRIORITY_SCHEDULING >= 0)
+ A(_POSIX_THREAD_PROCESS_SHARED >= 0)
+// A(_POSIX_THREAD_ROBUST_PRIO_INHERIT >= 0)
+// A(_POSIX_THREAD_ROBUST_PRIO_PROTECT >= 0)
+// A(_POSIX_THREAD_SPORADIC_SERVER >= 0)
+// A(_POSIX_TYPED_MEMORY_OBJECTS >= 0)
 C(F_OK)
 C(R_OK)
 C(W_OK)
@@ -211,7 +269,9 @@ T(intptr_t)
 {int(*p)(int) = fchdir;}
 {int(*p)(int,uid_t,gid_t) = fchown;}
 {int(*p)(int,const char*,uid_t,gid_t,int) = fchownat;}
+#ifdef POSIX_SYNCHRONIZED_IO
 {int(*p)(int) = fdatasync;}
+#endif
 {int(*p)(int,char*const[],char*const[]) = fexecve;}
 {pid_t(*p)(void) = fork;}
 {long(*p)(int,int) = fpathconf;}