diff options
Diffstat (limited to 'test')
77 files changed, 226 insertions, 52 deletions
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 <stdlib.h> -#include <error.h> #if (defined(__GLIBC__) && !defined(__UCLIBC__)) || defined(__UCLIBC_HAS_ARGP__) +#include <error.h> #include <argp.h> 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 <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> + +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 <unistd.h> #include <sys/types.h> #include <sys/wait.h> +#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 <stdlib.h> #include <unistd.h> #include <sys/wait.h> - +#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 <stdlib.h> #include <unistd.h> #include <sys/wait.h> - +#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 @@ <http://www.gnu.org/licenses/>. */ #include <errno.h> +#if defined(__GLIBC__) || defined(__UCLIBC__) #include <error.h> +#else +#include "../error.h" +#endif #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> +#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 <stdlib.h> #include <unistd.h> #include <sys/wait.h> - +#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 <unistd.h> #include <sys/mman.h> #include <sys/wait.h> +#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 <stdlib.h> #include <time.h> #include <unistd.h> - +#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 <stdio.h> #include <stdlib.h> #include <unistd.h> +#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 <sys/uio.h> #include <sys/un.h> #include <sys/wait.h> +#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 <stdlib.h> #include <unistd.h> +#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 <stdlib.h> #include <unistd.h> +#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 <stdlib.h> #include <time.h> #include <unistd.h> +#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 <unistd.h> #include <sys/time.h> #include <time.h> - +#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 <string.h> #include <unistd.h> - +#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 <unistd.h> #include <sys/time.h> - +#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 <stdio.h> #include <stdlib.h> - +#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 <sys/time.h> |