From 2ce94b3cb4db55c981ee6f2cbe1d3e790e89a2b7 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Sun, 6 Nov 2016 17:48:49 +0100 Subject: allow to compile and run on musl based systems This is a first shot, more improvements required to allow to run more tests. --- test/Makefile | 4 ++++ test/argp/argp-ex4.c | 2 +- test/args/arg_test.c | 2 +- test/error.h | 22 ++++++++++++++++++++++ test/inet/gethost_r-align.c | 2 ++ test/inet/tst-res.c | 4 ++++ test/malloc/tst-mallocfork.c | 1 + test/misc/tst-statfs.c | 7 ------- test/nptl/tst-atfork1.c | 2 +- test/nptl/tst-atfork2.c | 2 +- test/nptl/tst-attr3.c | 11 +++++++++++ test/nptl/tst-basic4.c | 2 +- test/nptl/tst-basic7.c | 4 ++-- test/nptl/tst-cancel16.c | 1 + test/nptl/tst-cancel18.c | 2 +- test/nptl/tst-cancel22.c | 1 + test/nptl/tst-cancel4.c | 5 +++++ test/nptl/tst-cleanup4.c | 7 ++++++- test/nptl/tst-cleanup4aux.c | 2 ++ test/nptl/tst-clock2.c | 1 + test/nptl/tst-clock_nanosleep.c | 2 +- test/nptl/tst-cond14.c | 8 ++++++-- test/nptl/tst-cond15.c | 8 ++++++-- test/nptl/tst-cond22.c | 8 ++++++-- test/nptl/tst-cond8.c | 7 ++++++- test/nptl/tst-cond9.c | 7 ++++++- test/nptl/tst-exec2.c | 2 +- test/nptl/tst-exec3.c | 1 + test/nptl/tst-flock2.c | 3 ++- test/nptl/tst-fork1.c | 1 + test/nptl/tst-fork2.c | 2 +- test/nptl/tst-fork3.c | 1 + test/nptl/tst-getpid3.c | 2 +- test/nptl/tst-initializers1.c | 6 ++++++ test/nptl/tst-kill6.c | 2 +- test/nptl/tst-mqueue1.c | 1 + test/nptl/tst-mqueue3.c | 2 ++ test/nptl/tst-mqueue5.c | 1 + test/nptl/tst-mqueue6.c | 1 + test/nptl/tst-mqueue8.c | 3 +++ test/nptl/tst-mqueue9.c | 1 + test/nptl/tst-mutex5.c | 4 ++++ test/nptl/tst-mutex7.c | 7 ++++++- test/nptl/tst-mutex9.c | 3 ++- test/nptl/tst-rwlock12.c | 2 +- test/nptl/tst-rwlock6.c | 8 ++++++-- test/nptl/tst-rwlock7.c | 8 ++++++-- test/nptl/tst-rwlock8.c | 8 ++++++-- test/nptl/tst-rwlock9.c | 8 ++++++-- test/nptl/tst-sem1.c | 2 +- test/nptl/tst-sem10.c | 1 + test/nptl/tst-sem2.c | 1 + test/nptl/tst-sem3.c | 1 + test/nptl/tst-sem4.c | 6 +++++- test/nptl/tst-sem5.c | 2 +- test/nptl/tst-sem7.c | 4 ++++ test/nptl/tst-sem8.c | 4 ++++ test/nptl/tst-sem9.c | 4 ++++ test/nptl/tst-signal1.c | 1 + test/nptl/tst-signal2.c | 1 + test/nptl/tst-signal3.c | 1 + test/nptl/tst-timer4.c | 2 ++ test/nptl/tst-tls2.c | 1 + test/nptl/tst-tls3.c | 1 + test/nptl/tst-tsd6.c | 1 + test/nptl/tst-vfork1x.c | 1 + test/nptl/tst-vfork2x.c | 1 + test/regex/tst-regex2.c | 4 ++++ test/regex/tst-regexloc.c | 5 ++--- test/setjmp/tst-vfork-longjmp.c | 5 ----- test/stdlib/test-canon2.c | 4 ++++ test/stdlib/teston_exit.c | 4 ++++ test/stdlib/teststrtoq.c | 6 ++++++ test/string/stratcliff.c | 2 ++ test/string/tester.c | 2 ++ test/test-skeleton.c | 2 ++ test/test-skeleton.h | 8 ++++++++ 77 files changed, 226 insertions(+), 52 deletions(-) create mode 100644 test/error.h create mode 100644 test/test-skeleton.h (limited to 'test') diff --git a/test/Makefile b/test/Makefile index b66c355..5a136ea 100644 --- a/test/Makefile +++ b/test/Makefile @@ -35,6 +35,10 @@ ifeq ($(NO_LOCALE),1) DIRS := $(filter-out locale,$(DIRS)) endif +ifeq ($(NO_MATH),1) +DIRS := $(filter-out math,$(DIRS)) +endif + test check all: run run: subdirs_run diff --git a/test/argp/argp-ex4.c b/test/argp/argp-ex4.c index 97097c7..34c1322 100644 --- a/test/argp/argp-ex4.c +++ b/test/argp/argp-ex4.c @@ -24,8 +24,8 @@ current locale. */ #include -#include #if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__) +#include #include const char *argp_program_version = diff --git a/test/args/arg_test.c b/test/args/arg_test.c index 86f3157..3408a98 100644 --- a/test/args/arg_test.c +++ b/test/args/arg_test.c @@ -13,7 +13,7 @@ int main(int argc, char **argv) { int i=0; - char** index=__environ; + char** index=environ; #ifdef __powerpc__ { diff --git a/test/error.h b/test/error.h new file mode 100644 index 0000000..f6bc82d --- /dev/null +++ b/test/error.h @@ -0,0 +1,22 @@ +#include +#include +#include +#include +#include + +static unsigned int error_message_count = 0; + +static inline void error(int status, int errnum, const char* format, ...) +{ + va_list ap; + fprintf(stderr, "%s: ", program_invocation_name); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + if (errnum) + fprintf(stderr, ": %s", strerror(errnum)); + fprintf(stderr, "\n"); + error_message_count++; + if (status) + exit(status); +} diff --git a/test/inet/gethost_r-align.c b/test/inet/gethost_r-align.c index 53ce93a..9cd8dbb 100644 --- a/test/inet/gethost_r-align.c +++ b/test/inet/gethost_r-align.c @@ -27,9 +27,11 @@ int main(int argc, char *argv[]) printf("Testing misalignment of %2zi bytes: ", i); +#if defined(__GLIBC__) || defined(__UCLIBC__) memset(&hent, 0x00, sizeof(hent)); ret = gethostent_r(&hent, buf + i, sizeof(buf) - i, &hentres, &herr); printf("%sgethostent_r() ", (ret ? "!!!" : "")); +#endif memset(&hent, 0x00, sizeof(hent)); ret = gethostbyname_r("localhost", &hent, buf + i, sizeof(buf) - i, &hentres, &herr); diff --git a/test/inet/tst-res.c b/test/inet/tst-res.c index b65f30f..79a0104 100644 --- a/test/inet/tst-res.c +++ b/test/inet/tst-res.c @@ -8,6 +8,7 @@ int main(int argc, char **argv) { +#if defined(__GLIBC__) || defined(__UCLIBC__) int r; struct __res_state state; @@ -40,5 +41,8 @@ int main(int argc, char **argv) assert (state._u._ext.nscount == 0); return 0; +#else + return 23; +#endif } diff --git a/test/malloc/tst-mallocfork.c b/test/malloc/tst-mallocfork.c index 5bb1d76..edd9c39 100644 --- a/test/malloc/tst-mallocfork.c +++ b/test/malloc/tst-mallocfork.c @@ -7,6 +7,7 @@ #include #include #include +#include "../test-skeleton.h" static void sig_handler (int signum) diff --git a/test/misc/tst-statfs.c b/test/misc/tst-statfs.c index b8b4229..6b501c0 100644 --- a/test/misc/tst-statfs.c +++ b/test/misc/tst-statfs.c @@ -19,13 +19,6 @@ main(int argc, char* argv[]) ++ret; printf("statfs %s:\n\tblocks=%lld\n\tblkfree=%lld\n\tbsize=%d\n", argv[i], s.f_blocks, s.f_bfree, s.f_bsize); -#ifdef _STATFS_F_FRSIZE - printf("\tfrsize=%lld\n", s.f_frsize); -#elif defined __mips__ - printf("\tfrsize=mips, unsupported?\n"); -#else -# error no _STATFS_F_FRSIZE -#endif } exit(ret ? EXIT_SUCCESS : EXIT_FAILURE); } diff --git a/test/nptl/tst-atfork1.c b/test/nptl/tst-atfork1.c index 1298937..483f7a6 100644 --- a/test/nptl/tst-atfork1.c +++ b/test/nptl/tst-atfork1.c @@ -22,7 +22,7 @@ #include #include #include - +#include "../test-skeleton.h" static int val; diff --git a/test/nptl/tst-atfork2.c b/test/nptl/tst-atfork2.c index 594f56e..b9808ac 100644 --- a/test/nptl/tst-atfork2.c +++ b/test/nptl/tst-atfork2.c @@ -23,7 +23,7 @@ #include #include #include - +#include "../test-skeleton.h" /* Must be exported. */ int val; diff --git a/test/nptl/tst-attr3.c b/test/nptl/tst-attr3.c index 5ccf9ab..27d89f2 100644 --- a/test/nptl/tst-attr3.c +++ b/test/nptl/tst-attr3.c @@ -18,12 +18,17 @@ . */ #include +#if defined(__GLIBC__) || defined(__UCLIBC__) #include +#else +#include "../error.h" +#endif #include #include #include #include #include +#include "../test-skeleton.h" static void * tf (void *arg) @@ -164,6 +169,7 @@ tf (void *arg) } } +#if defined(__GLIBC__) || defined(__UCLIBC__) cpu_set_t c1, c2; err = pthread_getaffinity_np (pthread_self (), sizeof (c1), &c1); if (err == 0) @@ -180,6 +186,7 @@ tf (void *arg) result = tf; } } +#endif err = pthread_attr_destroy (&a); if (err) @@ -216,12 +223,14 @@ do_test (void) result = 1; } +#if defined(__GLIBC__) || defined(__UCLIBC__) err = pthread_attr_getaffinity_np (&a, sizeof (c1), &c1); if (err && err != ENOSYS) { error (0, err, "pthread_attr_getaffinity_np failed"); result = 1; } +#endif err = pthread_attr_destroy (&a); if (err) @@ -310,6 +319,7 @@ do_test (void) result = 1; } +#if defined(__GLIBC__) || defined(__UCLIBC__) err = pthread_getaffinity_np (pthread_self (), sizeof (c1), &c1); if (err == 0) { @@ -325,6 +335,7 @@ do_test (void) result = 1; } } +#endif err = pthread_attr_destroy (&a); if (err) diff --git a/test/nptl/tst-basic4.c b/test/nptl/tst-basic4.c index b69ca20..f7bdf1d 100644 --- a/test/nptl/tst-basic4.c +++ b/test/nptl/tst-basic4.c @@ -23,7 +23,7 @@ #include #include #include - +#include "../test-skeleton.h" static void final_test (void) diff --git a/test/nptl/tst-basic7.c b/test/nptl/tst-basic7.c index 15b6187..7a461a4 100644 --- a/test/nptl/tst-basic7.c +++ b/test/nptl/tst-basic7.c @@ -32,10 +32,10 @@ use_up_memory (void) setrlimit (RLIMIT_AS, &rl); char *c; - int PAGESIZE = getpagesize (); + int pagesize = getpagesize (); while (1) { - c = mmap (NULL, PAGESIZE, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0); + c = mmap (NULL, pagesize, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0); if (c == MAP_FAILED) break; } diff --git a/test/nptl/tst-cancel16.c b/test/nptl/tst-cancel16.c index 6af657c..a1e3c5a 100644 --- a/test/nptl/tst-cancel16.c +++ b/test/nptl/tst-cancel16.c @@ -24,6 +24,7 @@ #include #include #include +#include "../test-skeleton.h" static pthread_barrier_t b2; diff --git a/test/nptl/tst-cancel18.c b/test/nptl/tst-cancel18.c index e653119..4fb4357 100644 --- a/test/nptl/tst-cancel18.c +++ b/test/nptl/tst-cancel18.c @@ -22,7 +22,7 @@ #include #include #include - +#include "../test-skeleton.h" static pthread_barrier_t b; diff --git a/test/nptl/tst-cancel22.c b/test/nptl/tst-cancel22.c index 8febbf0..e2c41f1 100644 --- a/test/nptl/tst-cancel22.c +++ b/test/nptl/tst-cancel22.c @@ -21,6 +21,7 @@ #include #include #include +#include "../test-skeleton.h" pthread_barrier_t b; int seen; diff --git a/test/nptl/tst-cancel4.c b/test/nptl/tst-cancel4.c index 696a527..6eaf5b1 100644 --- a/test/nptl/tst-cancel4.c +++ b/test/nptl/tst-cancel4.c @@ -37,8 +37,13 @@ #include #include #include +#include "../test-skeleton.h" +#if defined(__GLIBC__) || defined(__UCLIBC__) #define SIGCANCEL __SIGRTMIN +#else +#define SIGCANCEL SIGRTMIN +#endif /* Since STREAMS are not supported in the standard Linux kernel and diff --git a/test/nptl/tst-cleanup4.c b/test/nptl/tst-cleanup4.c index 3fe3998..982bc3e 100644 --- a/test/nptl/tst-cleanup4.c +++ b/test/nptl/tst-cleanup4.c @@ -21,6 +21,7 @@ #include #include +#if defined(__GLIBC__) || defined(__UCLIBC__) /* LinuxThreads pthread_cleanup_{push,pop} helpers. */ extern void _pthread_cleanup_push (struct _pthread_cleanup_buffer *__buffer, void (*__routine) (void *), @@ -120,11 +121,12 @@ tf (void *a) return NULL; } - +#endif int do_test (void) { +#if defined(__GLIBC__) || defined(__UCLIBC__) int result = 0; if (pipe (fds) != 0) @@ -191,6 +193,9 @@ do_test (void) } return result; +#else + return 23; +#endif } #define TEST_FUNCTION do_test () diff --git a/test/nptl/tst-cleanup4aux.c b/test/nptl/tst-cleanup4aux.c index 029c493..1894293 100644 --- a/test/nptl/tst-cleanup4aux.c +++ b/test/nptl/tst-cleanup4aux.c @@ -21,6 +21,7 @@ #include #include +#if defined(__GLIBC__) || defined(__UCLIBC__) extern void _pthread_cleanup_push (struct _pthread_cleanup_buffer *__buffer, void (*__routine) (void *), void *__arg); @@ -118,3 +119,4 @@ fn9 (void) _pthread_cleanup_pop (&b, 1); } +#endif diff --git a/test/nptl/tst-clock2.c b/test/nptl/tst-clock2.c index df6ec00..6902c25 100644 --- a/test/nptl/tst-clock2.c +++ b/test/nptl/tst-clock2.c @@ -22,6 +22,7 @@ #include #include #include +#include "../test-skeleton.h" #if defined _POSIX_THREAD_CPUTIME && _POSIX_THREAD_CPUTIME >= 0 diff --git a/test/nptl/tst-clock_nanosleep.c b/test/nptl/tst-clock_nanosleep.c index a2d1f00..0b4ad01 100644 --- a/test/nptl/tst-clock_nanosleep.c +++ b/test/nptl/tst-clock_nanosleep.c @@ -20,7 +20,7 @@ #include #include #include - +#include "../test-skeleton.h" /* Test that clock_nanosleep() does sleep. */ static int diff --git a/test/nptl/tst-cond14.c b/test/nptl/tst-cond14.c index 8378405..f0fe4cc 100644 --- a/test/nptl/tst-cond14.c +++ b/test/nptl/tst-cond14.c @@ -22,7 +22,7 @@ #include #include - +#if defined(__GLIBC__) || defined(__UCLIBC__) static pthread_cond_t cond = PTHREAD_COND_INITIALIZER; static pthread_mutex_t mut = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; static pthread_mutex_t mut2 = PTHREAD_MUTEX_INITIALIZER; @@ -62,11 +62,12 @@ tf (void *p) return NULL; } - +#endif static int do_test (void) { +#if defined(__GLIBC__) || defined(__UCLIBC__) if (pthread_mutex_lock (&mut2) != 0) { puts ("1st mutex_lock failed"); @@ -109,6 +110,9 @@ do_test (void) puts ("done"); return 0; +#else + return 23; +#endif } diff --git a/test/nptl/tst-cond15.c b/test/nptl/tst-cond15.c index 0e8448c..e4c1d72 100644 --- a/test/nptl/tst-cond15.c +++ b/test/nptl/tst-cond15.c @@ -24,7 +24,7 @@ #include #include - +#if defined(__GLIBC__) || defined(__UCLIBC__) static pthread_cond_t cond = PTHREAD_COND_INITIALIZER; static pthread_mutex_t mut = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; static pthread_mutex_t mut2 = PTHREAD_MUTEX_INITIALIZER; @@ -87,11 +87,12 @@ tf (void *p) return NULL; } - +#endif static int do_test (void) { +#if defined(__GLIBC__) || defined(__UCLIBC__) if (pthread_mutex_lock (&mut2) != 0) { puts ("1st mutex_lock failed"); @@ -151,6 +152,9 @@ do_test (void) puts ("done"); return 0; +#else + return 23; +#endif } diff --git a/test/nptl/tst-cond22.c b/test/nptl/tst-cond22.c index bd978e5..3255cc0 100644 --- a/test/nptl/tst-cond22.c +++ b/test/nptl/tst-cond22.c @@ -2,7 +2,7 @@ #include #include - +#if defined(__GLIBC__) || defined(__UCLIBC__) static pthread_barrier_t b; static pthread_cond_t c = PTHREAD_COND_INITIALIZER; static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER; @@ -49,11 +49,12 @@ tf (void *arg) } return NULL; } - +#endif static int do_test (void) { +#if defined(__GLIBC__) || defined(__UCLIBC__) int status = 0; if (pthread_barrier_init (&b, NULL, 2) != 0) @@ -154,6 +155,9 @@ do_test (void) c.__data.__nwaiters, c.__data.__broadcast_seq); return status; +#else + return 23; +#endif } #define TEST_FUNCTION do_test () diff --git a/test/nptl/tst-cond8.c b/test/nptl/tst-cond8.c index fb13fa4..0805149 100644 --- a/test/nptl/tst-cond8.c +++ b/test/nptl/tst-cond8.c @@ -24,6 +24,7 @@ #include +#if defined(__GLIBC__) || defined(__UCLIBC__) static pthread_cond_t cond = PTHREAD_COND_INITIALIZER; static pthread_mutex_t mut = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; @@ -142,11 +143,12 @@ tf2 (void *p) return NULL; } - +#endif static int do_test (void) { +#if defined(__GLIBC__) || defined(__UCLIBC__) pthread_t th; int err; @@ -269,6 +271,9 @@ do_test (void) puts ("done"); return 0; +#else + return 23; +#endif } diff --git a/test/nptl/tst-cond9.c b/test/nptl/tst-cond9.c index dcb597d..31a6cb2 100644 --- a/test/nptl/tst-cond9.c +++ b/test/nptl/tst-cond9.c @@ -24,6 +24,7 @@ #include +#if defined(__GLIBC__) || defined(__UCLIBC__) static pthread_cond_t cond = PTHREAD_COND_INITIALIZER; static pthread_mutex_t mut = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; @@ -68,11 +69,12 @@ tf (void *arg) return (void *) 1l; } - +#endif static int do_test (void) { +#if defined(__GLIBC__) || defined(__UCLIBC__) pthread_t th; int err; @@ -142,6 +144,9 @@ do_test (void) puts ("done"); return 0; +#else + return 23; +#endif } diff --git a/test/nptl/tst-exec2.c b/test/nptl/tst-exec2.c index 061e3fc..c621b4e 100644 --- a/test/nptl/tst-exec2.c +++ b/test/nptl/tst-exec2.c @@ -26,7 +26,7 @@ #include #include #include - +#include "../test-skeleton.h" static void * tf (void *arg) diff --git a/test/nptl/tst-exec3.c b/test/nptl/tst-exec3.c index be4098b..f4a6807 100644 --- a/test/nptl/tst-exec3.c +++ b/test/nptl/tst-exec3.c @@ -26,6 +26,7 @@ #include #include #include +#include "../test-skeleton.h" static void * diff --git a/test/nptl/tst-flock2.c b/test/nptl/tst-flock2.c index 941c52f..acc6972 100644 --- a/test/nptl/tst-flock2.c +++ b/test/nptl/tst-flock2.c @@ -21,10 +21,11 @@ #include #include #include +#include #include #include #include - +#include "../test-skeleton.h" static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t lock2 = PTHREAD_MUTEX_INITIALIZER; diff --git a/test/nptl/tst-fork1.c b/test/nptl/tst-fork1.c index 0d89728..448255d 100644 --- a/test/nptl/tst-fork1.c +++ b/test/nptl/tst-fork1.c @@ -23,6 +23,7 @@ #include #include #include +#include "../test-skeleton.h" static void * thread_function (void * arg) diff --git a/test/nptl/tst-fork2.c b/test/nptl/tst-fork2.c index d85ea21..e653d7e 100644 --- a/test/nptl/tst-fork2.c +++ b/test/nptl/tst-fork2.c @@ -22,7 +22,7 @@ #include #include #include - +#include "../test-skeleton.h" static pid_t initial_pid; diff --git a/test/nptl/tst-fork3.c b/test/nptl/tst-fork3.c index 968d0ab..434aa8f 100644 --- a/test/nptl/tst-fork3.c +++ b/test/nptl/tst-fork3.c @@ -22,6 +22,7 @@ #include #include #include +#include "../test-skeleton.h" static pid_t initial_pid; diff --git a/test/nptl/tst-getpid3.c b/test/nptl/tst-getpid3.c index f1e77f6..974cd99 100644 --- a/test/nptl/tst-getpid3.c +++ b/test/nptl/tst-getpid3.c @@ -5,7 +5,7 @@ #include #include #include - +#include "../test-skeleton.h" static pid_t pid; diff --git a/test/nptl/tst-initializers1.c b/test/nptl/tst-initializers1.c index 1e35380..6a458f1 100644 --- a/test/nptl/tst-initializers1.c +++ b/test/nptl/tst-initializers1.c @@ -18,6 +18,7 @@ #include +#if defined(__GLIBC__) || defined(__UCLIBC__) pthread_mutex_t mtx_normal = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t mtx_recursive = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; pthread_mutex_t mtx_errorchk = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; @@ -26,10 +27,12 @@ pthread_rwlock_t rwl_normal = PTHREAD_RWLOCK_INITIALIZER; pthread_rwlock_t rwl_writer = PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP; pthread_cond_t cond = PTHREAD_COND_INITIALIZER; +#endif int main (void) { +#if defined(__GLIBC__) || defined(__UCLIBC__) if (mtx_normal.__data.__kind != PTHREAD_MUTEX_TIMED_NP) return 1; if (mtx_recursive.__data.__kind != PTHREAD_MUTEX_RECURSIVE_NP) @@ -44,4 +47,7 @@ main (void) != PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP) return 1; return 0; +#else + return 23; +#endif } diff --git a/test/nptl/tst-kill6.c b/test/nptl/tst-kill6.c index f530e4e..5b801c8 100644 --- a/test/nptl/tst-kill6.c +++ b/test/nptl/tst-kill6.c @@ -23,7 +23,7 @@ #include #include #include - +#include "../test-skeleton.h" static pthread_t receiver; static sem_t sem; diff --git a/test/nptl/tst-mqueue1.c b/test/nptl/tst-mqueue1.c index 5ec79cf..f07df0b 100644 --- a/test/nptl/tst-mqueue1.c +++ b/test/nptl/tst-mqueue1.c @@ -27,6 +27,7 @@ #include #include #include "tst-mqueue.h" +#include "../test-skeleton.h" static int intcmp (const void *a, const void *b) diff --git a/test/nptl/tst-mqueue3.c b/test/nptl/tst-mqueue3.c index 5686f43..2cec763 100644 --- a/test/nptl/tst-mqueue3.c +++ b/test/nptl/tst-mqueue3.c @@ -18,6 +18,7 @@ . */ #include +#include #include #include #include @@ -28,6 +29,7 @@ #include #include #include +#include "../test-skeleton.h" #if _POSIX_THREADS # include diff --git a/test/nptl/tst-mqueue5.c b/test/nptl/tst-mqueue5.c index 58e2ebf..ea6cc96 100644 --- a/test/nptl/tst-mqueue5.c +++ b/test/nptl/tst-mqueue5.c @@ -32,6 +32,7 @@ #include #include #include "tst-mqueue.h" +#include "../test-skeleton.h" #define TIMEOUT 3 diff --git a/test/nptl/tst-mqueue6.c b/test/nptl/tst-mqueue6.c index 8d84c19..5f44e52 100644 --- a/test/nptl/tst-mqueue6.c +++ b/test/nptl/tst-mqueue6.c @@ -32,6 +32,7 @@ #include #include #include "tst-mqueue.h" +#include "../test-skeleton.h" #if _POSIX_THREADS # include diff --git a/test/nptl/tst-mqueue8.c b/test/nptl/tst-mqueue8.c index b80e4e5..dd12c76 100644 --- a/test/nptl/tst-mqueue8.c +++ b/test/nptl/tst-mqueue8.c @@ -17,11 +17,14 @@ . */ #include +#include #include #include #include #include #include +#include "../test-skeleton.h" + #if _POSIX_THREADS # include diff --git a/test/nptl/tst-mqueue9.c b/test/nptl/tst-mqueue9.c index 7098b84..548157e 100644 --- a/test/nptl/tst-mqueue9.c +++ b/test/nptl/tst-mqueue9.c @@ -17,6 +17,7 @@ . */ #include +#include #include #include #include diff --git a/test/nptl/tst-mutex5.c b/test/nptl/tst-mutex5.c index 85dddef..92fd967 100644 --- a/test/nptl/tst-mutex5.c +++ b/test/nptl/tst-mutex5.c @@ -32,6 +32,7 @@ static int do_test (void) { +#if defined(__GLIBC__) || defined(__UCLIBC__) pthread_mutex_t m; struct timespec ts; struct timeval tv; @@ -178,6 +179,9 @@ do_test (void) } return 0; +#else + return 23; +#endif } #define TIMEOUT 4 diff --git a/test/nptl/tst-mutex7.c b/test/nptl/tst-mutex7.c index 29a1423..4f9cd4b 100644 --- a/test/nptl/tst-mutex7.c +++ b/test/nptl/tst-mutex7.c @@ -20,6 +20,7 @@ #include #include +#if defined(__GLIBC__) || defined(__UCLIBC__) #ifndef INIT # define INIT PTHREAD_MUTEX_INITIALIZER @@ -59,11 +60,12 @@ tf (void *arg) return NULL; } - +#endif static int do_test (void) { +#if defined(__GLIBC__) || defined(__UCLIBC__) pthread_attr_t at; pthread_t th[N]; int cnt; @@ -113,6 +115,9 @@ do_test (void) } return 0; +#else + return 23; +#endif } #define TIMEOUT 60 diff --git a/test/nptl/tst-mutex9.c b/test/nptl/tst-mutex9.c index a4bb3aa..2d5bf75 100644 --- a/test/nptl/tst-mutex9.c +++ b/test/nptl/tst-mutex9.c @@ -26,8 +26,9 @@ #include #include #include +#include "../test-skeleton.h" -int gettimeofday(struct timeval *tv, struct timezone *tz); +//int gettimeofday(struct timeval *tv, struct timezone *tz); static int diff --git a/test/nptl/tst-rwlock12.c b/test/nptl/tst-rwlock12.c index c0e5cee..695e720 100644 --- a/test/nptl/tst-rwlock12.c +++ b/test/nptl/tst-rwlock12.c @@ -25,7 +25,7 @@ #include #include #include - +#include "../test-skeleton.h" static int do_test (void) diff --git a/test/nptl/tst-rwlock6.c b/test/nptl/tst-rwlock6.c index 78d0716..c3338d0 100644 --- a/test/nptl/tst-rwlock6.c +++ b/test/nptl/tst-rwlock6.c @@ -23,7 +23,7 @@ #include #include - +#if defined(__GLIBC__) || defined(__UCLIBC__) static int kind[] = { PTHREAD_RWLOCK_PREFER_READER_NP, @@ -101,11 +101,12 @@ tf (void *arg) return NULL; } - +#endif static int do_test (void) { +#if defined(__GLIBC__) || defined(__UCLIBC__) size_t cnt; for (cnt = 0; cnt < sizeof (kind) / sizeof (kind[0]); ++cnt) { @@ -219,6 +220,9 @@ do_test (void) } return 0; +#else + return 23; +#endif } #define TEST_FUNCTION do_test () diff --git a/test/nptl/tst-rwlock7.c b/test/nptl/tst-rwlock7.c index 5189a47..1367a01 100644 --- a/test/nptl/tst-rwlock7.c +++ b/test/nptl/tst-rwlock7.c @@ -23,7 +23,7 @@ #include #include - +#if defined(__GLIBC__) || defined(__UCLIBC__) static int kind[] = { PTHREAD_RWLOCK_PREFER_READER_NP, @@ -95,11 +95,12 @@ tf (void *arg) return NULL; } - +#endif static int do_test (void) { +#if defined(__GLIBC__) || defined(__UCLIBC__) size_t cnt; for (cnt = 0; cnt < sizeof (kind) / sizeof (kind[0]); ++cnt) { @@ -172,6 +173,9 @@ do_test (void) } return 0; +#else + return 23; +#endif } #define TEST_FUNCTION do_test () diff --git a/test/nptl/tst-rwlock8.c b/test/nptl/tst-rwlock8.c index b67e55a..48034ec 100644 --- a/test/nptl/tst-rwlock8.c +++ b/test/nptl/tst-rwlock8.c @@ -24,7 +24,7 @@ #include #include - +#if defined(__GLIBC__) || defined(__UCLIBC__) #define NWRITERS 15 #define WRITETRIES 10 #define NREADERS 15 @@ -109,11 +109,12 @@ reader_thread (void *nr) return NULL; } - +#endif static int do_test (void) { +#if defined(__GLIBC__) || defined(__UCLIBC__) pthread_t thwr[NWRITERS]; pthread_t thrd[NREADERS]; int n; @@ -156,6 +157,9 @@ do_test (void) } return 0; +#else + return 23; +#endif } #define TIMEOUT 30 diff --git a/test/nptl/tst-rwlock9.c b/test/nptl/tst-rwlock9.c index e9f0151..1e4b5ca 100644 --- a/test/nptl/tst-rwlock9.c +++ b/test/nptl/tst-rwlock9.c @@ -25,7 +25,7 @@ #include #include - +#if defined(__GLIBC__) || defined(__UCLIBC__) #define NWRITERS 15 #define WRITETRIES 10 #define NREADERS 15 @@ -147,11 +147,12 @@ reader_thread (void *nr) return NULL; } - +#endif static int do_test (void) { +#if defined(__GLIBC__) || defined(__UCLIBC__) pthread_t thwr[NWRITERS]; pthread_t thrd[NREADERS]; int n; @@ -194,6 +195,9 @@ do_test (void) } return 0; +#else + return 23; +#endif } #undef TIMEOUT diff --git a/test/nptl/tst-sem1.c b/test/nptl/tst-sem1.c index 5e55dd3..4d498bd 100644 --- a/test/nptl/tst-sem1.c +++ b/test/nptl/tst-sem1.c @@ -20,7 +20,7 @@ #include #include #include - +#include "../test-skeleton.h" static int do_test (void) diff --git a/test/nptl/tst-sem10.c b/test/nptl/tst-sem10.c index ae6218a..32170bc 100644 --- a/test/nptl/tst-sem10.c +++ b/test/nptl/tst-sem10.c @@ -23,6 +23,7 @@ #include #include #include +#include "../test-skeleton.h" static int diff --git a/test/nptl/tst-sem2.c b/test/nptl/tst-sem2.c index edc553c..dfd66fb 100644 --- a/test/nptl/tst-sem2.c +++ b/test/nptl/tst-sem2.c @@ -21,6 +21,7 @@ #include #include #include +#include "../test-skeleton.h" static int diff --git a/test/nptl/tst-sem3.c b/test/nptl/tst-sem3.c index 7b75e29..1b598dc 100644 --- a/test/nptl/tst-sem3.c +++ b/test/nptl/tst-sem3.c @@ -25,6 +25,7 @@ #include #include #include +#include "../test-skeleton.h" int diff --git a/test/nptl/tst-sem4.c b/test/nptl/tst-sem4.c index 72ed97d..4293b2c 100644 --- a/test/nptl/tst-sem4.c +++ b/test/nptl/tst-sem4.c @@ -22,7 +22,7 @@ #include #include #include - +#include "../test-skeleton.h" static void remove_sem (int status, void *arg) @@ -34,6 +34,7 @@ remove_sem (int status, void *arg) int do_test (void) { +#if defined(__GLIBC__) || defined(__UCLIBC__) sem_t *s; sem_t *s2; pid_t pid; @@ -143,6 +144,9 @@ do_test (void) } return 0; +#else + return 23; +#endif } #define TEST_FUNCTION do_test () diff --git a/test/nptl/tst-sem5.c b/test/nptl/tst-sem5.c index f0b905c..396ea62 100644 --- a/test/nptl/tst-sem5.c +++ b/test/nptl/tst-sem5.c @@ -22,7 +22,7 @@ #include #include #include - +#include "../test-skeleton.h" static int do_test (void) diff --git a/test/nptl/tst-sem7.c b/test/nptl/tst-sem7.c index 34ddb40..cdf0459 100644 --- a/test/nptl/tst-sem7.c +++ b/test/nptl/tst-sem7.c @@ -34,6 +34,7 @@ remove_sem (int status, void *arg) int main (void) { +#if defined(__GLIBC__) || defined(__UCLIBC__) sem_t *s; sem_t *s2; sem_t *s3; @@ -105,4 +106,7 @@ main (void) } return 0; +#else + return 23; +#endif } diff --git a/test/nptl/tst-sem8.c b/test/nptl/tst-sem8.c index 286590f..b500e28 100644 --- a/test/nptl/tst-sem8.c +++ b/test/nptl/tst-sem8.c @@ -34,6 +34,7 @@ remove_sem (int status, void *arg) int main (void) { +#if defined(__GLIBC__) || defined(__UCLIBC__) sem_t *s; int i; @@ -70,4 +71,7 @@ main (void) } return 0; +#else + return 23; +#endif } diff --git a/test/nptl/tst-sem9.c b/test/nptl/tst-sem9.c index bdb594b..31918a9 100644 --- a/test/nptl/tst-sem9.c +++ b/test/nptl/tst-sem9.c @@ -34,6 +34,7 @@ remove_sem (int status, void *arg) int main (void) { +#if defined(__GLIBC__) || defined(__UCLIBC__) sem_t *s; int i; @@ -77,4 +78,7 @@ main (void) } return 0; +#else + return 23; +#endif } diff --git a/test/nptl/tst-signal1.c b/test/nptl/tst-signal1.c index 0f952fd..cb31108 100644 --- a/test/nptl/tst-signal1.c +++ b/test/nptl/tst-signal1.c @@ -25,6 +25,7 @@ #include #include #include +#include "../test-skeleton.h" static sigset_t ss; diff --git a/test/nptl/tst-signal2.c b/test/nptl/tst-signal2.c index 37d5611..4df0868 100644 --- a/test/nptl/tst-signal2.c +++ b/test/nptl/tst-signal2.c @@ -25,6 +25,7 @@ #include #include #include +#include "../test-skeleton.h" static sigset_t ss; diff --git a/test/nptl/tst-signal3.c b/test/nptl/tst-signal3.c index fbd9ace..155a94b 100644 --- a/test/nptl/tst-signal3.c +++ b/test/nptl/tst-signal3.c @@ -23,6 +23,7 @@ #include #include #include +#include "../test-skeleton.h" /* Number of different signalss to use. Also is the number of diff --git a/test/nptl/tst-timer4.c b/test/nptl/tst-timer4.c index fafb565..b8116ca 100644 --- a/test/nptl/tst-timer4.c +++ b/test/nptl/tst-timer4.c @@ -23,6 +23,8 @@ #include #include #include +#include "../test-skeleton.h" + #if _POSIX_THREADS # include diff --git a/test/nptl/tst-tls2.c b/test/nptl/tst-tls2.c index eb6d8a3..040aedb 100644 --- a/test/nptl/tst-tls2.c +++ b/test/nptl/tst-tls2.c @@ -23,6 +23,7 @@ #include #include #include +#include "../test-skeleton.h" #define N 10 diff --git a/test/nptl/tst-tls3.c b/test/nptl/tst-tls3.c index 3d92d91..5f54948 100644 --- a/test/nptl/tst-tls3.c +++ b/test/nptl/tst-tls3.c @@ -25,6 +25,7 @@ #include #include #include +#include "../test-skeleton.h" #define THE_SIG SIGUSR1 diff --git a/test/nptl/tst-tsd6.c b/test/nptl/tst-tsd6.c index debb1dd..ea0a481 100644 --- a/test/nptl/tst-tsd6.c +++ b/test/nptl/tst-tsd6.c @@ -4,6 +4,7 @@ #include #include #include +#include "../test-skeleton.h" #define NKEYS 100 static pthread_key_t keys[NKEYS]; diff --git a/test/nptl/tst-vfork1x.c b/test/nptl/tst-vfork1x.c index b3c9d20..02916d1 100644 --- a/test/nptl/tst-vfork1x.c +++ b/test/nptl/tst-vfork1x.c @@ -23,6 +23,7 @@ #include #include #include +#include "../test-skeleton.h" /* This test relies on non-POSIX functionality since the child processes call write and getpid. */ diff --git a/test/nptl/tst-vfork2x.c b/test/nptl/tst-vfork2x.c index 6b2d98b..a742271 100644 --- a/test/nptl/tst-vfork2x.c +++ b/test/nptl/tst-vfork2x.c @@ -27,6 +27,7 @@ #include #include #include +#include "../test-skeleton.h" int raise_fail; diff --git a/test/regex/tst-regex2.c b/test/regex/tst-regex2.c index bb47d64..5ed221c 100644 --- a/test/regex/tst-regex2.c +++ b/test/regex/tst-regex2.c @@ -15,6 +15,7 @@ static int do_test(void) { +#if defined(__GLIBC__) || defined(__UCLIBC__) static const char *pat[] = { ".?.?.?.?.?.?.?Log\\.13", "(.?)(.?)(.?)(.?)(.?)(.?)(.?)Log\\.13", @@ -243,6 +244,9 @@ do_test(void) } } return exitcode; +#else + return 23; +#endif } #define TIMEOUT 100 diff --git a/test/regex/tst-regexloc.c b/test/regex/tst-regexloc.c index d862678..e8783f0 100644 --- a/test/regex/tst-regexloc.c +++ b/test/regex/tst-regexloc.c @@ -25,7 +25,7 @@ main (int argc, char *argv[]) { /* If uclibc has extended locale, or if it's a host build * (assuming host libc always has locale): */ -#if defined __UCLIBC_HAS_XLOCALE__ || !defined __UCLIBC__ +#if defined __UCLIBC_HAS_XLOCALE__ || (defined(__GLIBC__) && !defined __UCLIBC__) regex_t re; regmatch_t mat[1]; int exitcode = 1; @@ -47,7 +47,6 @@ main (int argc, char *argv[]) return exitcode; #else - puts("Test requires locale; skipping"); - return 0; + return 23; #endif } diff --git a/test/setjmp/tst-vfork-longjmp.c b/test/setjmp/tst-vfork-longjmp.c index 2784424..0225e6e 100644 --- a/test/setjmp/tst-vfork-longjmp.c +++ b/test/setjmp/tst-vfork-longjmp.c @@ -49,11 +49,6 @@ static int check_sig_mask(void) _exit(1); } ret = memcmp(&orig_mask, &child_mask, sizeof(orig_mask)); - if (verbose) { - printf("sigmsk: %08lx%08lx ", child_mask.__val[1], child_mask.__val[0]); - printf("sigmsk: %08lx%08lx ", orig_mask.__val[1], orig_mask.__val[0]); - printf("%i\n", ret); - } _exit(ret); } else if (child == 1) return 1; diff --git a/test/stdlib/test-canon2.c b/test/stdlib/test-canon2.c index 4a03b2d..223459e 100644 --- a/test/stdlib/test-canon2.c +++ b/test/stdlib/test-canon2.c @@ -69,6 +69,7 @@ do_prepare (int argc, char *argv[]) int do_test (int argc, char *argv[]) { +#if defined(__GLIBC__) || defined(__UCLIBC__) char *canon; printf ("create symlinks from %s to %s and vice versa\n", name1, name2); @@ -83,4 +84,7 @@ do_test (int argc, char *argv[]) canon = canonicalize_file_name (name1); return canon != NULL || errno != ELOOP; +#else + return 23; +#endif } diff --git a/test/stdlib/teston_exit.c b/test/stdlib/teston_exit.c index f7e8fd0..32518d6 100644 --- a/test/stdlib/teston_exit.c +++ b/test/stdlib/teston_exit.c @@ -66,6 +66,7 @@ static efuncp func_table[] = int main ( void ) { +#if defined(__GLIBC__) || defined(__UCLIBC__) int i = 0; unsigned long count = 0; int numfuncs = sizeof(func_table)/sizeof(efuncp); @@ -78,5 +79,8 @@ main ( void ) } printf("%lu functions registered with on_exit.\n", count); exit(count); +#else + return 23; +#endif } diff --git a/test/stdlib/teststrtoq.c b/test/stdlib/teststrtoq.c index 6e1a4cb..8ae60da 100644 --- a/test/stdlib/teststrtoq.c +++ b/test/stdlib/teststrtoq.c @@ -66,6 +66,7 @@ int n_tests=sizeof(strings)/sizeof(strings[0]); void do_test(int base); void do_test(int base) { +#if defined(__GLIBC__) || defined(__UCLIBC__) int i; quad_t n; char *endptr; @@ -75,10 +76,12 @@ void do_test(int base) printf("strtoq(\"%s\",%d) len=%lu res=%qd\n", strings[i],base,(unsigned long)(endptr-strings[i]),n); } +#endif } int main(int argc,char *argv[]) { +#if defined(__GLIBC__) || defined(__UCLIBC__) do_test(0); do_test(8); do_test(10); @@ -86,4 +89,7 @@ int main(int argc,char *argv[]) do_test(36); return 0; +#else + return 23; +#endif } diff --git a/test/string/stratcliff.c b/test/string/stratcliff.c index b45be4b..8a41ee1 100644 --- a/test/string/stratcliff.c +++ b/test/string/stratcliff.c @@ -152,6 +152,7 @@ main (int argc, char *argv[]) } /* rawmemchr test */ +#if defined(__GLIBC__) || defined(__UCLIBC__) for (outer = size - 1; outer >= MAX (0, size - 128); --outer) { for (middle = MAX (outer, size - 64); middle < size; ++middle) @@ -171,6 +172,7 @@ main (int argc, char *argv[]) adr[middle] = 'T'; } } +#endif /* strcpy test */ for (outer = size - 1; outer >= MAX (0, size - 128); --outer) diff --git a/test/string/tester.c b/test/string/tester.c index 7f3ff28..6944f27 100644 --- a/test/string/tester.c +++ b/test/string/tester.c @@ -1554,7 +1554,9 @@ main (void) test_strchrnul (); /* rawmemchr. */ +#if defined(__GLIBC__) || defined(__UCLIBC__) test_rawmemchr (); +#endif /* index - just like strchr. */ test_index (); diff --git a/test/test-skeleton.c b/test/test-skeleton.c index cf136ac..557996d 100644 --- a/test/test-skeleton.c +++ b/test/test-skeleton.c @@ -32,7 +32,9 @@ #include #include #include +#include "test-skeleton.h" + /* The test function is normally called `do_test' and it is called with argc and argv as the arguments. We nevertheless provide the possibility to overwrite this name. */ diff --git a/test/test-skeleton.h b/test/test-skeleton.h new file mode 100644 index 0000000..f475868 --- /dev/null +++ b/test/test-skeleton.h @@ -0,0 +1,8 @@ +#ifndef TEMP_FAILURE_RETRY +#define TEMP_FAILURE_RETRY(expression) \ + (__extension__ \ + ({ long int __result; \ + do __result = (long int) (expression); \ + while (__result == -1L && errno == EINTR); \ + __result; })) +#endif -- cgit v1.2.3