diff options
| -rw-r--r-- | test/inet/tst-ethers-line.c | 9 | ||||
| -rw-r--r-- | test/inet/tst-ethers.c | 5 | ||||
| -rw-r--r-- | test/nptl/tst-align.c | 2 | ||||
| -rw-r--r-- | test/nptl/tst-align2.c | 2 | ||||
| -rw-r--r-- | test/nptl/tst-clock2.c | 2 | ||||
| -rw-r--r-- | test/nptl/tst-mqueue1.c | 12 | ||||
| -rw-r--r-- | test/nptl/tst-tls5mod.c | 2 | ||||
| -rw-r--r-- | test/nptl/tst-tls5moda.c | 2 | ||||
| -rw-r--r-- | test/nptl/tst-tls5modb.c | 2 | ||||
| -rw-r--r-- | test/nptl/tst-tls5modc.c | 2 | ||||
| -rw-r--r-- | test/nptl/tst-tls5modd.c | 2 | ||||
| -rw-r--r-- | test/nptl/tst-tls5mode.c | 2 | ||||
| -rw-r--r-- | test/nptl/tst-tls5modf.c | 2 | ||||
| -rw-r--r-- | test/signal/Makefile | 4 | ||||
| -rw-r--r-- | test/stdlib/test-canon.c | 31 | ||||
| -rw-r--r-- | test/test-skeleton.c | 2 | ||||
| -rw-r--r-- | test/tls/Makefile | 2 | ||||
| -rw-r--r-- | test/tls/tst-tls1.c | 1 | ||||
| -rw-r--r-- | test/tls/tst-tls6.c | 18 | ||||
| -rw-r--r-- | test/unistd/exec-null.c | 13 |
20 files changed, 82 insertions, 35 deletions
diff --git a/test/inet/tst-ethers-line.c b/test/inet/tst-ethers-line.c index d4835b546..3b3387455 100644 --- a/test/inet/tst-ethers-line.c +++ b/test/inet/tst-ethers-line.c @@ -6,8 +6,17 @@ #include <fcntl.h> #include <stdlib.h> +/* glibc 2.4 has no ETHER_FILE_NAME, host compile fails without this */ +#ifndef ETHER_FILE_NAME +#define ETHER_FILE_NAME "/etc/ethers" +#endif + #define ETHER_LINE_LEN 256 +/* This test requires /etc/ethers to exist + * and to have nonzero length + */ + int main(void) { struct ether_addr addr; diff --git a/test/inet/tst-ethers.c b/test/inet/tst-ethers.c index eb6280c3f..14b5a4378 100644 --- a/test/inet/tst-ethers.c +++ b/test/inet/tst-ethers.c @@ -3,6 +3,11 @@ #define ETHER_LINE_LEN 256 +/* This test requires /etc/ethers to exist + * and to have host "teeth". For example: + * 00:11:22:33:44:55 teeth + */ + int main(void) { struct ether_addr addr; diff --git a/test/nptl/tst-align.c b/test/nptl/tst-align.c index 2de9d7a10..381db8f4e 100644 --- a/test/nptl/tst-align.c +++ b/test/nptl/tst-align.c @@ -21,7 +21,7 @@ #include <stdbool.h> #include <stdint.h> #include <stdio.h> -#include <tst-stack-align.h> +#include "tst-stack-align.h" static void * tf (void *arg) diff --git a/test/nptl/tst-align2.c b/test/nptl/tst-align2.c index ec85f435b..7d8be53da 100644 --- a/test/nptl/tst-align2.c +++ b/test/nptl/tst-align2.c @@ -23,7 +23,7 @@ #include <string.h> #include <sys/wait.h> #include <unistd.h> -#include <tst-stack-align.h> +#include "tst-stack-align.h" static int f (void *arg) diff --git a/test/nptl/tst-clock2.c b/test/nptl/tst-clock2.c index bca40956e..49a769bf4 100644 --- a/test/nptl/tst-clock2.c +++ b/test/nptl/tst-clock2.c @@ -62,7 +62,7 @@ do_test (void) if (sysconf (_SC_THREAD_CPUTIME) < 0) { puts ("_POSIX_THREAD_CPUTIME option not available"); - return 0; + return 1; } # endif diff --git a/test/nptl/tst-mqueue1.c b/test/nptl/tst-mqueue1.c index f95292cee..8a9c23cb8 100644 --- a/test/nptl/tst-mqueue1.c +++ b/test/nptl/tst-mqueue1.c @@ -72,7 +72,7 @@ do_one_test (mqd_t q, const char *name, int nonblock) { int result = 0; - char v [] + unsigned char v [] = { 0x32, 0x62, 0x22, 0x31, 0x11, 0x73, 0x61, 0x21, 0x72, 0x71, 0x81 }; struct mq_attr attr; @@ -208,9 +208,9 @@ do_one_test (mqd_t q, const char *name, int nonblock) for (int i = 0; i < 10; ++i) { if (i & 1) - rets = mq_receive (q, (char *) &vr[i], 1, &prio); + rets = mq_receive (q, &vr[i], 1, &prio); else - rets = mq_timedreceive (q, (char *) &vr[i], 1, &prio, &ts); + rets = mq_timedreceive (q, &vr[i], 1, &prio, &ts); if (rets != 1) { @@ -236,7 +236,7 @@ do_one_test (mqd_t q, const char *name, int nonblock) result = 1; } - rets = mq_timedreceive (q, (char *) &vr[10], 1, &prio, &ts); + rets = mq_timedreceive (q, &vr[10], 1, &prio, &ts); if (rets != -1) { puts ("mq_timedreceive on empty queue did not fail"); @@ -251,7 +251,7 @@ do_one_test (mqd_t q, const char *name, int nonblock) if (nonblock) { - ret = mq_receive (q, (char *) &vr[10], 1, &prio); + ret = mq_receive (q, &vr[10], 1, &prio); if (ret != -1) { puts ("mq_receive on empty non-blocking queue did not fail"); @@ -414,4 +414,4 @@ do_test (void) return result; } -#include "../test-skeleton.c" +#include "../test-skeleton.c"
\ No newline at end of file diff --git a/test/nptl/tst-tls5mod.c b/test/nptl/tst-tls5mod.c index b308bd60e..4616a20e9 100644 --- a/test/nptl/tst-tls5mod.c +++ b/test/nptl/tst-tls5mod.c @@ -1,4 +1,4 @@ -#include <tst-tls5.h> +#include "tst-tls5.h" #ifdef TLS_REGISTER /* Ensure tls_registry is exported from the binary. */ diff --git a/test/nptl/tst-tls5moda.c b/test/nptl/tst-tls5moda.c index a035c96cd..4644d763a 100644 --- a/test/nptl/tst-tls5moda.c +++ b/test/nptl/tst-tls5moda.c @@ -1,4 +1,4 @@ -#include <tst-tls5.h> +#include "tst-tls5.h" #ifdef TLS_REGISTER static __thread char a [32] __attribute__ ((aligned (64))); diff --git a/test/nptl/tst-tls5modb.c b/test/nptl/tst-tls5modb.c index 848a80363..09b439670 100644 --- a/test/nptl/tst-tls5modb.c +++ b/test/nptl/tst-tls5modb.c @@ -1,4 +1,4 @@ -#include <tst-tls5.h> +#include "tst-tls5.h" #ifdef TLS_REGISTER static __thread int b; diff --git a/test/nptl/tst-tls5modc.c b/test/nptl/tst-tls5modc.c index d63ceff8d..bbd89633d 100644 --- a/test/nptl/tst-tls5modc.c +++ b/test/nptl/tst-tls5modc.c @@ -1,4 +1,4 @@ -#include <tst-tls5.h> +#include "tst-tls5.h" #ifdef TLS_REGISTER static __thread int c; diff --git a/test/nptl/tst-tls5modd.c b/test/nptl/tst-tls5modd.c index 202a66a15..8b54d168c 100644 --- a/test/nptl/tst-tls5modd.c +++ b/test/nptl/tst-tls5modd.c @@ -1,4 +1,4 @@ -#include <tst-tls5.h> +#include "tst-tls5.h" #ifdef TLS_REGISTER static __thread int d; diff --git a/test/nptl/tst-tls5mode.c b/test/nptl/tst-tls5mode.c index 3e53ee1a6..d30b06752 100644 --- a/test/nptl/tst-tls5mode.c +++ b/test/nptl/tst-tls5mode.c @@ -1,4 +1,4 @@ -#include <tst-tls5.h> +#include "tst-tls5.h" #ifdef TLS_REGISTER static __thread int e1 = 24; diff --git a/test/nptl/tst-tls5modf.c b/test/nptl/tst-tls5modf.c index 8e50962de..52dcb9495 100644 --- a/test/nptl/tst-tls5modf.c +++ b/test/nptl/tst-tls5modf.c @@ -1,4 +1,4 @@ -#include <tst-tls5.h> +#include "tst-tls5.h" #ifdef TLS_REGISTER char tst_tls5modf[60] attribute_hidden = { 26 }; diff --git a/test/signal/Makefile b/test/signal/Makefile index a0b14a6c9..2ff96fa73 100644 --- a/test/signal/Makefile +++ b/test/signal/Makefile @@ -1,4 +1,8 @@ # uClibc signal tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +ifeq ($(UCLIBC_HAS_OBSOLETE_BSD_SIGNAL),) +TESTS_DISABLED := tst-sigsimple +endif + include ../Test.mak diff --git a/test/stdlib/test-canon.c b/test/stdlib/test-canon.c index dd2f9bce3..9770a948d 100644 --- a/test/stdlib/test-canon.c +++ b/test/stdlib/test-canon.c @@ -52,8 +52,12 @@ struct { }; struct { - const char * in, * out, * resolved; - int error; + const char * in; + const char * retval; /* what realpath should return */ + const char * retbuf; /* what realpath should store in buf */ + /* if both of the above are NULL, we won't check for result, + * it's undefined */ + int error; /* expected errno value */ } tests[] = { /* 0 */ {"/", "/"}, @@ -72,17 +76,9 @@ struct { {"foobar", 0, "./foobar", ENOENT}, {".", "."}, {"./foobar", 0, "./foobar", ENOENT}, -#ifdef __UCLIBC__ - /* we differ from glibc here, but POSIX allows it as it says that if we did - * not successfuly complete, the value of resolved_path is undefined */ - {"SYMLINK_LOOP", 0, "", ELOOP}, + {"SYMLINK_LOOP", 0, 0, ELOOP}, /* 15 */ - {"./SYMLINK_LOOP", 0, "", ELOOP}, -#else - {"SYMLINK_LOOP", 0, "./SYMLINK_LOOP", ELOOP}, - /* 15 */ - {"./SYMLINK_LOOP", 0, "./SYMLINK_LOOP", ELOOP}, -#endif + {"./SYMLINK_LOOP", 0, 0, ELOOP}, {"SYMLINK_1", "."}, {"SYMLINK_1/foobar", 0, "./foobar", ENOENT}, {"SYMLINK_2", "/etc"}, @@ -180,27 +176,28 @@ do_test (int argc, char ** argv) for (i = 0; i < (int) (sizeof (tests) / sizeof (tests[0])); ++i) { buf[0] = '\0'; + errno = 0; result = realpath (tests[i].in, buf); - if (!check_path (result, tests[i].out)) + if (!check_path (result, tests[i].retval)) { printf ("%s: flunked test %d (expected `%s', got `%s')\n", - argv[0], i, tests[i].out ? tests[i].out : "NULL", + argv[0], i, tests[i].retval ? tests[i].retval : "NULL", result ? result : "NULL"); ++errors; continue; } - if (!check_path (buf, tests[i].out ? tests[i].out : tests[i].resolved)) + if (result && !check_path (buf, tests[i].retval ? tests[i].retval : tests[i].retbuf)) { printf ("%s: flunked test %d (expected resolved `%s', got `%s')\n", - argv[0], i, tests[i].out ? tests[i].out : tests[i].resolved, + argv[0], i, tests[i].retval ? tests[i].retval : tests[i].retbuf, buf); ++errors; continue; } - if (!tests[i].out && errno != tests[i].error) + if (errno != tests[i].error) { printf ("%s: flunked test %d (expected errno %d, got %d)\n", argv[0], i, tests[i].error, errno); diff --git a/test/test-skeleton.c b/test/test-skeleton.c index 22fdd8f98..adfc8b75b 100644 --- a/test/test-skeleton.c +++ b/test/test-skeleton.c @@ -135,7 +135,7 @@ static void __attribute__ ((noreturn)) timeout_handler (int sig __attribute__ ((unused))) { - int killed; + int killed = 0; int status; /* Send signal. */ diff --git a/test/tls/Makefile b/test/tls/Makefile index 94c45d99f..00fcb0064 100644 --- a/test/tls/Makefile +++ b/test/tls/Makefile @@ -12,7 +12,7 @@ include ../Test.mak TARGET_ARCH := $(strip $(subst ",, $(strip $(TARGET_ARCH)))) PTDIR := $(top_builddir)libpthread/nptl -EXTRA_CFLAGS := -DNOT_IN_libc=1 -DIS_IN_libpthread=1 -D_LIBC \ +EXTRA_CFLAGS := -DNOT_IN_libc=1 \ -std=gnu99 -I. -I$(PTDIR) \ -I$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH) \ -I$(PTDIR)/sysdeps/$(TARGET_ARCH) \ diff --git a/test/tls/tst-tls1.c b/test/tls/tst-tls1.c index 478f5bbdc..f5ac6d2bc 100644 --- a/test/tls/tst-tls1.c +++ b/test/tls/tst-tls1.c @@ -1,4 +1,5 @@ /* glibc test for TLS in ld.so. */ +#undef _LIBC #include <stdio.h> #include <tls.h> diff --git a/test/tls/tst-tls6.c b/test/tls/tst-tls6.c index 68d706538..2f58ea6ad 100644 --- a/test/tls/tst-tls6.c +++ b/test/tls/tst-tls6.c @@ -4,6 +4,10 @@ #include <link.h> #include <tls.h> +#ifdef __UCLIBC__ +#include "dl-elf.h" +#include "dl-hash.h" +#endif #define TEST_FUNCTION do_test () @@ -32,6 +36,19 @@ do_test (void) /* Dirty test code here: we peek into a private data structure. We make sure that the module gets assigned the same ID every time. The value of the first round is used. */ +#ifdef __UCLIBC__ + if (modid == -1) + modid = ((struct link_map *)((struct dyn_elf *)h)->dyn)->l_tls_modid; + else if (((struct link_map *)((struct dyn_elf *)h)->dyn)->l_tls_modid + != (size_t) modid) + { + printf ("round %d: modid now %zu, initially %d\n", + i, + ((struct link_map *)((struct dyn_elf *)h)->dyn)->l_tls_modid, + modid); + result = 1; + } +#else if (modid == -1) modid = ((struct link_map *) h)->l_tls_modid; else if (((struct link_map *) h)->l_tls_modid != modid) @@ -40,6 +57,7 @@ do_test (void) i, ((struct link_map *) h)->l_tls_modid, modid); result = 1; } +#endif foop = dlsym (h, "foo"); if (foop == NULL) diff --git a/test/unistd/exec-null.c b/test/unistd/exec-null.c new file mode 100644 index 000000000..3df99f3ce --- /dev/null +++ b/test/unistd/exec-null.c @@ -0,0 +1,13 @@ +/* make sure we handle argv[0] == NULL */ + +#include <unistd.h> + +int main(int argc, char *argv[]) +{ + if (argc == 0) + return 0; + + char *exec_argv[1], *exec_envp[1]; + exec_argv[0] = exec_envp[0] = NULL; + return execve("./exec-null", exec_argv, exec_envp); +} |
