diff options
43 files changed, 1039 insertions, 16 deletions
diff --git a/test/Rules.mak b/test/Rules.mak index 4e76ed3..b81eb19 100644 --- a/test/Rules.mak +++ b/test/Rules.mak @@ -21,6 +21,7 @@ TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \ -e 's/sun.*/sparc/' -e 's/sparc.*/sparc/' \ -e 's/sa110/arm/' -e 's/arm.*/arm/g' \ -e 's/m68k.*/m68k/' \ + -e 's/nds32.*/nds32/' \ -e 's/parisc.*/hppa/' \ -e 's/ppc/powerpc/g' \ -e 's/sh[234].*/sh/' \ diff --git a/test/math/libm-test-ulps-csky b/test/math/libm-test-ulps-csky new file mode 100644 index 0000000..46b2ac5 --- /dev/null +++ b/test/math/libm-test-ulps-csky @@ -0,0 +1,145 @@ +# Begin of automatic generation + +# cos +Test "cos (M_PI_6l * 2.0) == 0.5": +double: 1 +idouble: 1 +Test "cos (M_PI_6l * 4.0) == -0.5": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +# erf +Test "erf (0.75) == 0.711155633653515131598937834591410777": +double: 1 +idouble: 1 +Test "erf (1.25) == 0.922900128256458230136523481197281140": +double: 1 +idouble: 1 + +# erfc +Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8": +double: 1 +idouble: 1 + +# exp +Test "exp (1) == e": +double: 1 +idouble: 1 + +# expm1 +Test "expm1 (0.75) == 1.11700001661267466854536981983709561": +double: 1 +idouble: 1 + +# hypot +Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 + +# lgamma +Test "lgamma (0.7) == 0.260867246531666514385732417016759578": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +# log10 +Test "log10 (0.75) == -0.124938736608299953132449886193870744": +double: 1 +idouble: 1 +Test "log10 (e) == log10(e)": +float: 1 +ifloat: 1 + +# tgamma +Test "tgamma (-0.5) == -2 sqrt (pi)": +double: 1 +idouble: 1 +Test "tgamma (0.7) == 1.29805533264755778568117117915281162": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# Maximal error of functions: +Function: "cos": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +Function: "erf": +double: 1 +idouble: 1 + +Function: "erfc": +double: 1 +idouble: 1 + +Function: "exp": +double: 1 +idouble: 1 + +Function: "expm1": +double: 1 +idouble: 1 + +Function: "hypot": +float: 1 +ifloat: 1 + +Function: "lgamma": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: "log": +float: 1 +ifloat: 1 + +Function: "log10": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "tan": +double: 1 +idouble: 1 + +Function: "tgamma": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# end of automatic generation diff --git a/test/math/libm-test-ulps-nds32 b/test/math/libm-test-ulps-nds32 new file mode 100644 index 0000000..46b2ac5 --- /dev/null +++ b/test/math/libm-test-ulps-nds32 @@ -0,0 +1,145 @@ +# Begin of automatic generation + +# cos +Test "cos (M_PI_6l * 2.0) == 0.5": +double: 1 +idouble: 1 +Test "cos (M_PI_6l * 4.0) == -0.5": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +# erf +Test "erf (0.75) == 0.711155633653515131598937834591410777": +double: 1 +idouble: 1 +Test "erf (1.25) == 0.922900128256458230136523481197281140": +double: 1 +idouble: 1 + +# erfc +Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8": +double: 1 +idouble: 1 + +# exp +Test "exp (1) == e": +double: 1 +idouble: 1 + +# expm1 +Test "expm1 (0.75) == 1.11700001661267466854536981983709561": +double: 1 +idouble: 1 + +# hypot +Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 +Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271": +float: 1 +ifloat: 1 + +# lgamma +Test "lgamma (0.7) == 0.260867246531666514385732417016759578": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 +Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +# log10 +Test "log10 (0.75) == -0.124938736608299953132449886193870744": +double: 1 +idouble: 1 +Test "log10 (e) == log10(e)": +float: 1 +ifloat: 1 + +# tgamma +Test "tgamma (-0.5) == -2 sqrt (pi)": +double: 1 +idouble: 1 +Test "tgamma (0.7) == 1.29805533264755778568117117915281162": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# Maximal error of functions: +Function: "cos": +double: 2 +float: 1 +idouble: 2 +ifloat: 1 + +Function: "erf": +double: 1 +idouble: 1 + +Function: "erfc": +double: 1 +idouble: 1 + +Function: "exp": +double: 1 +idouble: 1 + +Function: "expm1": +double: 1 +idouble: 1 + +Function: "hypot": +float: 1 +ifloat: 1 + +Function: "lgamma": +double: 1 +float: 2 +idouble: 1 +ifloat: 2 + +Function: "log": +float: 1 +ifloat: 1 + +Function: "log10": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +Function: "tan": +double: 1 +idouble: 1 + +Function: "tgamma": +double: 1 +float: 1 +idouble: 1 +ifloat: 1 + +# end of automatic generation diff --git a/test/misc/Makefile.in b/test/misc/Makefile.in index 96c1fd9..31bb7e1 100644 --- a/test/misc/Makefile.in +++ b/test/misc/Makefile.in @@ -6,6 +6,12 @@ TESTS_DISABLED := outb tst-fnmatch bug-glob1 tst-gnuglob ifeq ($(TARGET_ARCH),avr32) TESTS_DISABLED += tst-inotify endif +ifeq ($(TARGET_ARCH),bfin) +TESTS_DISABLED += tst-rlimit tst-rlimit64 +endif +ifeq ($(TARGET_ARCH),m68k) +TESTS_DISABLED += tst-rlimit tst-rlimit64 +endif CFLAGS_dirent64 := -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 CFLAGS_tst-rlimit64 := -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 diff --git a/test/misc/tst-msgctl.c b/test/misc/tst-msgctl.c new file mode 100755 index 0000000..ac6ae34 --- /dev/null +++ b/test/misc/tst-msgctl.c @@ -0,0 +1,126 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/ipc.h> +#include <sys/msg.h> +#include <sys/sem.h> +#include <sys/shm.h> +#include <sys/types.h> +#include <time.h> +#include <unistd.h> + +// Define the message structure +struct message { + long mtype; // Message Type + char mtext[100]; // Message body +}; + +struct timespec ts = { + .tv_sec = 3468960000, // 2075-12-05 Destination timestamp + .tv_nsec = 0 +}; + +void print_msqid_ds(struct msqid_ds *buf) { + printf("perms: %o\n", buf->msg_perm.mode); + printf("UID: %d\n", buf->msg_perm.uid); + printf("GID: %d\n", buf->msg_perm.gid); + printf("Current number of bytes in the queue: %d\n", buf->msg_cbytes); + printf("Number of messages in the queue: %d\n", buf->msg_qnum); + printf("Maximum number of bytes allowed in the queue: %d\n", buf->msg_qbytes); + printf("Last sent time: %s", buf->msg_stime ? ctime(&buf->msg_stime) + 4 : "Not set \n"); + printf("Last received time: %s", buf->msg_rtime ? ctime(&buf->msg_rtime) + 4 : "Not set \n"); +} + + +int main() { + + struct timespec ts_init, ts_final; + + // Save system time + if (clock_gettime(CLOCK_REALTIME, &ts_init) == -1) { + perror("Error getting time"); + return 1; + } + + if (clock_settime(CLOCK_REALTIME, &ts) == -1) { // Set the time to after 2038 + perror("Error setting time"); + return 1; + } + + key_t key = ftok(".", 123); + if (key == -1) { + perror("ftok"); + return 1; + } + + int msqid = msgget(key, 0644 | IPC_CREAT); // Set to write/read only (not full permissions) + if (msqid == -1) { + perror("msgget"); + return 1; + } + + // Get message queue status + struct msqid_ds buf; + memset(&buf, 0, sizeof(buf)); // Clear the structure + if (msgctl(msqid, IPC_STAT, &buf) == -1) { + perror("msgctl"); + return 1; + } + + // Print message queue information + printf("=== Initial queue status ===\n"); + printf("key: %x\n", key); + printf("msqid: %d\n", msqid); + print_msqid_ds(&buf); + + // Prepare the message to be sent + struct message msg = {0}; + msg.mtype = 1; // Set the message type to 1 + int i =0; + + for(i =0; i< 2; i++) + { + snprintf(msg.mtext, sizeof(msg.mtext), "Hello, Message Queue %d!", i); + msg.mtext[sizeof(msg.mtext) - 1] = '\0'; // Ensure the message ends with a '\0' + + // Send the message + if (msgsnd(msqid, &msg, strlen(msg.mtext) + 1, 0) == -1) { + perror("msgsnd"); + return 1; + } + printf("Message sent: %s\n", msg.mtext); + + // Check the queue status again + memset(&buf, 0, sizeof(buf)); // Clear the structure + if (msgctl(msqid, IPC_STAT, &buf) == -1) { + perror("msgctl"); + return 1; + } + + printf("\n=== Queue status after the message is sent ===\n"); + print_msqid_ds(&buf); + } + + // Change permissions + buf.msg_perm.mode = 0600; // New permissions + + if (msgctl(msqid, IPC_SET, &buf) == -1) { + perror("msgctl IPC_SET failed"); + msgctl(msqid, IPC_RMID, NULL); + exit(EXIT_FAILURE); + } + + if ((buf.msg_stime - ts.tv_sec > 60) || (ts.tv_sec - buf.msg_stime > 60)) { + printf("\nMsgctl get a error time! \n"); + exit(EXIT_FAILURE); + } + + msgctl(msqid, IPC_RMID, NULL); + + // Restore system time + clock_gettime(CLOCK_REALTIME, &ts_final); + ts_init.tv_sec = ts_init.tv_sec + ts_final.tv_sec - ts.tv_sec; + clock_settime(CLOCK_REALTIME, &ts_init); + + return 0; +} diff --git a/test/misc/tst-semctl.c b/test/misc/tst-semctl.c new file mode 100644 index 0000000..99647d1 --- /dev/null +++ b/test/misc/tst-semctl.c @@ -0,0 +1,97 @@ +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> +#include <sys/ipc.h> +#include <sys/sem.h> +#include <time.h> +#include <unistd.h> + +union semun { + int val; + struct semid_ds *buf; + unsigned short *array; +}; + +struct timespec ts = { + .tv_sec = 3468960000, // 3468960000 2075-12-05 Destination timestamp + .tv_nsec = 0 +}; + +void print_semid_ds(struct semid_ds *ds) { + printf("sem_perm.uid: %d\n", ds->sem_perm.uid); + printf("sem_perm.gid: %d\n", ds->sem_perm.gid); + printf("sem_perm.cuid: %d\n", ds->sem_perm.cuid); + printf("sem_perm.cgid: %d\n", ds->sem_perm.cgid); + printf("sem_perm.mode: %o\n", ds->sem_perm.mode); + printf("sem_nsems: %d\n", ds->sem_nsems); + printf("sem_otime: %s", ctime(&ds->sem_otime)); + printf("sem_ctime: %s \n", ctime(&ds->sem_ctime)); +} + +int main() { + int semid; + union semun arg; + struct semid_ds ds; + struct timespec ts_init, ts_final; + + // Save system time + if (clock_gettime(CLOCK_REALTIME, &ts_init) == -1) { + perror("Error getting time"); + return 1; + } + + + if (clock_settime(CLOCK_REALTIME, &ts) == -1) { // Set the time to after 2038 + perror("Error setting time"); + return 1; + } + + // Create a semaphore set + if ((semid = semget(IPC_PRIVATE, 1, 0666 | IPC_CREAT)) == -1) { + perror("semget failed"); + exit(1); + } + + // Get the semid_ds structure + arg.buf = &ds; + if (semctl(semid, 0, IPC_STAT, arg) == -1) { + perror("semctl IPC_STAT failed"); + exit(1); + } + + // Print the structure contents + printf("=== semid_ds structure values ===\n"); + print_semid_ds(&ds); + + + // Change permissions + ds.sem_perm.mode = 0600; // Change to new permissions + + if (semctl(semid, 0, IPC_SET, arg) == -1) { + perror("semctl IPC_SET failed"); + semctl(semid, 0, IPC_RMID); + exit(EXIT_FAILURE); + } + + // Print the structure contents + printf("=== semid_ds structure values ===\n"); + print_semid_ds(&ds); + + if ((ds.sem_ctime - ts.tv_sec > 60) || (ts.tv_sec - ds.sem_ctime > 60)) { + printf("\nSemctl get a error time! \n"); + exit(EXIT_FAILURE); + } + + // Delete a semaphore + if (semctl(semid, 0, IPC_RMID) == -1) { + perror("semctl IPC_RMID failed"); + exit(1); + } + + // Restore system time + clock_gettime(CLOCK_REALTIME, &ts_final); + ts_init.tv_sec = ts_init.tv_sec + ts_final.tv_sec - ts.tv_sec; + clock_settime(CLOCK_REALTIME, &ts_init); + + return 0; +} diff --git a/test/misc/tst-shmctl.c b/test/misc/tst-shmctl.c new file mode 100644 index 0000000..36dda83 --- /dev/null +++ b/test/misc/tst-shmctl.c @@ -0,0 +1,84 @@ +#include <stdio.h> +#include <stdlib.h> +#include <sys/ipc.h> +#include <sys/shm.h> +#include <time.h> +#include <unistd.h> + +struct timespec ts = { + .tv_sec = 3468960000, // 2075-12-05 Destination timestamp + .tv_nsec = 0 +}; + +void print_shmid_ds(struct shmid_ds *buf) { + printf("shm_perm.uid: %d \n", buf->shm_perm.uid); + printf("shm_perm.gid: %d \n", buf->shm_perm.gid); + printf("shm_perm.cuid: %d \n", buf->shm_perm.cuid); + printf("shm_perm.cgid: %d \n", buf->shm_perm.cgid); + printf("shm_perm.mode: %o \n", buf->shm_perm.mode); + printf("shm_segsz: %lu \n", buf->shm_segsz); + printf("shm_lpid: %d \n", buf->shm_lpid); + printf("shm_cpid: %d \n", buf->shm_cpid); + printf("shm_nattch: %lu \n", buf->shm_nattch); + printf("shm_atime: %s", buf->shm_atime ? ctime(&buf->shm_atime) : "Not set\n"); + printf("shm_dtime: %s", buf->shm_dtime ? ctime(&buf->shm_dtime) : "Not set\n"); + printf("shm_ctime: %s\n", ctime(&buf->shm_ctime)); +} + +int main() { + + struct timespec ts_init, ts_final; + + // Save system time + if (clock_gettime(CLOCK_REALTIME, &ts_init) == -1) { + perror("Error getting time"); + return 1; + } + + if (clock_settime(CLOCK_REALTIME, &ts) == -1) { // Set the time to after 2038 + perror("Error setting time"); + return 1; + } + + key_t key = ftok(".", 'S'); + int shmid = shmget(key, 1024, IPC_CREAT | 0666); + if (shmid == -1) { + perror("shmget"); + exit(1); + } + + struct shmid_ds buf; + if (shmctl(shmid, IPC_STAT, &buf) == -1) { + perror("shmctl"); + exit(1); + } + + printf("Shared Memory Segment Info:\n"); + print_shmid_ds(&buf); + + // Change to new permissions + buf.shm_perm.mode = 0600; + + if (shmctl(shmid, IPC_SET, &buf) == -1) { + perror("shmctl IPC_SET failed"); + shmctl(shmid, IPC_RMID, NULL); + exit(EXIT_FAILURE); + } + + if ((buf.shm_ctime - ts.tv_sec > 60) || (ts.tv_sec - buf.shm_ctime > 60)) { + printf("\nShmctl get a error time! \n"); + exit(EXIT_FAILURE); + } + + printf("Shared Memory Segment Info:\n"); + print_shmid_ds(&buf); + + shmctl(shmid, IPC_RMID, NULL); + + // Restore system time + clock_gettime(CLOCK_REALTIME, &ts_final); + ts_init.tv_sec = ts_init.tv_sec + ts_final.tv_sec - ts.tv_sec; + clock_settime(CLOCK_REALTIME, &ts_init); + + return 0; +} diff --git a/test/nptl/Makefile.in b/test/nptl/Makefile.in index 6f33342..5c14e36 100644 --- a/test/nptl/Makefile.in +++ b/test/nptl/Makefile.in @@ -23,7 +23,7 @@ ifeq ($(TARGET_ARCH),sh) TESTS_DISABLED := tst-cond1 tst-cond4 tst-cond6 tst-cond7 tst-cond10 \ tst-cond13 tst-cond14 tst-cond15 tst-cond18 tst-cond20 \ tst-cond21 tst-cond22 tst-cputimer1 tst-cputimer2 tst-cputimer3 \ - tst-mutex8 tst-timer4 tst-timer5 + tst-mutex8 tst-timer4 tst-timer5 tst-spin3 endif TESTS := tst-align tst-align2 tst-atfork1 tst-attr1 tst-attr2 tst-attr3 \ diff --git a/test/nptl/tst-atfork1.c b/test/nptl/tst-atfork1.c index 483f7a6..2537fc2 100644 --- a/test/nptl/tst-atfork1.c +++ b/test/nptl/tst-atfork1.c @@ -24,6 +24,8 @@ #include <sys/wait.h> #include "../test-skeleton.h" +#ifdef __ARCH_USE_MMU__ + static int val; @@ -118,3 +120,13 @@ do_test (void) #define TEST_FUNCTION do_test () #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-atfork2.c b/test/nptl/tst-atfork2.c index b9808ac..00e96ed 100644 --- a/test/nptl/tst-atfork2.c +++ b/test/nptl/tst-atfork2.c @@ -25,6 +25,8 @@ #include <sys/wait.h> #include "../test-skeleton.h" +#ifdef __ARCH_USE_MMU__ + /* Must be exported. */ int val; @@ -154,3 +156,13 @@ do_test (void) #define TEST_FUNCTION do_test () #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-barrier2.c b/test/nptl/tst-barrier2.c index 8ffcda0..35a74b1 100644 --- a/test/nptl/tst-barrier2.c +++ b/test/nptl/tst-barrier2.c @@ -26,6 +26,7 @@ #include <sys/mman.h> #include <sys/wait.h> +#ifdef __ARCH_USE_MMU__ static int do_test (void) @@ -182,3 +183,13 @@ do_test (void) #define TEST_FUNCTION do_test () #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-basic4.c b/test/nptl/tst-basic4.c index f7bdf1d..02ddf93 100644 --- a/test/nptl/tst-basic4.c +++ b/test/nptl/tst-basic4.c @@ -25,6 +25,8 @@ #include <sys/wait.h> #include "../test-skeleton.h" +#ifdef __ARCH_USE_MMU__ + static void final_test (void) { @@ -98,3 +100,13 @@ do_test (void) #define TEST_FUNCTION do_test () #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-cancel16.c b/test/nptl/tst-cancel16.c index a1e3c5a..9a53e99 100644 --- a/test/nptl/tst-cancel16.c +++ b/test/nptl/tst-cancel16.c @@ -26,6 +26,7 @@ #include <sys/wait.h> #include "../test-skeleton.h" +#ifdef __ARCH_USE_MMU__ static pthread_barrier_t b2; static int fd; @@ -229,3 +230,13 @@ do_test (void) #define TEST_FUNCTION do_test () #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-cancel21.c b/test/nptl/tst-cancel21.c index 489c18a..db2d8ae 100644 --- a/test/nptl/tst-cancel21.c +++ b/test/nptl/tst-cancel21.c @@ -24,6 +24,7 @@ #include <sys/wait.h> #include <unistd.h> +#ifdef __ARCH_USE_MMU__ static int fd[4]; static pthread_barrier_t b; @@ -291,3 +292,13 @@ do_test (void) #define TIMEOUT 40 #define TEST_FUNCTION do_test () #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-cancel4.c b/test/nptl/tst-cancel4.c index 6eaf5b1..a5fc2ff 100644 --- a/test/nptl/tst-cancel4.c +++ b/test/nptl/tst-cancel4.c @@ -39,6 +39,8 @@ #include <sys/wait.h> #include "../test-skeleton.h" +#ifdef __ARCH_USE_MMU__ + #if defined(__GLIBC__) || defined(__UCLIBC__) #define SIGCANCEL __SIGRTMIN #else @@ -2396,3 +2398,13 @@ do_test (void) #define TIMEOUT 60 #define TEST_FUNCTION do_test () #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-cond12.c b/test/nptl/tst-cond12.c index b38d9d5..2f41bcb 100644 --- a/test/nptl/tst-cond12.c +++ b/test/nptl/tst-cond12.c @@ -25,6 +25,7 @@ #include <sys/mman.h> #include <sys/wait.h> +#ifdef __ARCH_USE_MMU__ static char fname[] = "/tmp/tst-cond12-XXXXXX"; static int fd; @@ -193,3 +194,13 @@ do_test (void) return 0; } + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-cond4.c b/test/nptl/tst-cond4.c index 47a7380..25bfa82 100644 --- a/test/nptl/tst-cond4.c +++ b/test/nptl/tst-cond4.c @@ -26,6 +26,7 @@ #include <sys/wait.h> #include <stdint.h> +#ifdef __ARCH_USE_MMU__ int *condition; @@ -261,3 +262,13 @@ do_test (void) #define TEST_FUNCTION do_test () #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-cond6.c b/test/nptl/tst-cond6.c index f28d4c1..9189989 100644 --- a/test/nptl/tst-cond6.c +++ b/test/nptl/tst-cond6.c @@ -28,6 +28,7 @@ #include <sys/wait.h> #include <stdint.h> +#ifdef __ARCH_USE_MMU__ int *condition; @@ -231,3 +232,13 @@ do_test (void) #define TEST_FUNCTION do_test () #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-cpuclock1.c b/test/nptl/tst-cpuclock1.c index 9d68ec5..a7e76be 100644 --- a/test/nptl/tst-cpuclock1.c +++ b/test/nptl/tst-cpuclock1.c @@ -26,6 +26,8 @@ #include <signal.h> #include <sys/wait.h> +#ifdef __ARCH_USE_MMU__ + /* This function is intended to rack up both user and system time. */ static void chew_cpu (void) @@ -304,3 +306,13 @@ do_test (void) #define TIMEOUT 5 #define TEST_FUNCTION do_test () #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-cputimer3.c b/test/nptl/tst-cputimer3.c index 056766a..335c9f4 100644 --- a/test/nptl/tst-cputimer3.c +++ b/test/nptl/tst-cputimer3.c @@ -13,6 +13,8 @@ #include <signal.h> #include <sys/wait.h> +#ifdef __ARCH_USE_MMU__ + static clockid_t child_clock; #define TEST_CLOCK child_clock @@ -128,3 +130,13 @@ setup_test (void) #endif #include "tst-timer4.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-exec2.c b/test/nptl/tst-exec2.c index c621b4e..e916fec 100644 --- a/test/nptl/tst-exec2.c +++ b/test/nptl/tst-exec2.c @@ -28,6 +28,8 @@ #include <sys/wait.h> #include "../test-skeleton.h" +#ifdef __ARCH_USE_MMU__ + static void * tf (void *arg) { @@ -151,3 +153,13 @@ do_test (void) #define TEST_FUNCTION do_test () #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-exec3.c b/test/nptl/tst-exec3.c index f4a6807..c4683f2 100644 --- a/test/nptl/tst-exec3.c +++ b/test/nptl/tst-exec3.c @@ -28,6 +28,7 @@ #include <sys/wait.h> #include "../test-skeleton.h" +#ifdef __ARCH_USE_MMU__ static void * tf (void *arg) @@ -150,3 +151,13 @@ do_test (void) #define TEST_FUNCTION do_test () #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-flock2.c b/test/nptl/tst-flock2.c index acc6972..dac6c2c 100644 --- a/test/nptl/tst-flock2.c +++ b/test/nptl/tst-flock2.c @@ -27,6 +27,8 @@ #include <sys/wait.h> #include "../test-skeleton.h" +#ifdef __ARCH_USE_MMU__ + static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t lock2 = PTHREAD_MUTEX_INITIALIZER; static int fd; @@ -258,3 +260,13 @@ do_test (void) #define TEST_FUNCTION do_test () #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-fork1.c b/test/nptl/tst-fork1.c index 448255d..8c603b9 100644 --- a/test/nptl/tst-fork1.c +++ b/test/nptl/tst-fork1.c @@ -25,6 +25,8 @@ #include <sys/wait.h> #include "../test-skeleton.h" +#ifdef __ARCH_USE_MMU__ + static void * thread_function (void * arg) { @@ -118,3 +120,13 @@ main (void) return result; } + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-fork2.c b/test/nptl/tst-fork2.c index e653d7e..1c4bc2f 100644 --- a/test/nptl/tst-fork2.c +++ b/test/nptl/tst-fork2.c @@ -24,6 +24,8 @@ #include <sys/wait.h> #include "../test-skeleton.h" +#ifdef __ARCH_USE_MMU__ + static pid_t initial_pid; @@ -87,3 +89,13 @@ main (void) return status; } + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-fork3.c b/test/nptl/tst-fork3.c index 434aa8f..defac30 100644 --- a/test/nptl/tst-fork3.c +++ b/test/nptl/tst-fork3.c @@ -24,6 +24,7 @@ #include <sys/wait.h> #include "../test-skeleton.h" +#ifdef __ARCH_USE_MMU__ static pid_t initial_pid; @@ -105,3 +106,13 @@ main (void) return 1; } + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-fork4.c b/test/nptl/tst-fork4.c index ee87108..5a86fe2 100644 --- a/test/nptl/tst-fork4.c +++ b/test/nptl/tst-fork4.c @@ -24,6 +24,7 @@ #include <sys/wait.h> #include <string.h> +#ifdef __ARCH_USE_MMU__ static int do_test (void) @@ -62,3 +63,13 @@ do_test (void) #define TEST_FUNCTION do_test () #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-getpid3.c b/test/nptl/tst-getpid3.c index 974cd99..01d1e46 100644 --- a/test/nptl/tst-getpid3.c +++ b/test/nptl/tst-getpid3.c @@ -7,6 +7,8 @@ #include <sys/wait.h> #include "../test-skeleton.h" +#ifdef __ARCH_USE_MMU__ + static pid_t pid; static void * @@ -112,3 +114,13 @@ do_test (void) #define TEST_FUNCTION do_test () #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-mqueue1.c b/test/nptl/tst-mqueue1.c index f07df0b..1ce364e 100644 --- a/test/nptl/tst-mqueue1.c +++ b/test/nptl/tst-mqueue1.c @@ -29,6 +29,8 @@ #include "tst-mqueue.h" #include "../test-skeleton.h" +#ifdef __ARCH_USE_MMU__ + static int intcmp (const void *a, const void *b) { @@ -415,3 +417,13 @@ do_test (void) } #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-mqueue3.c b/test/nptl/tst-mqueue3.c index 2cec763..f7bee31 100644 --- a/test/nptl/tst-mqueue3.c +++ b/test/nptl/tst-mqueue3.c @@ -34,6 +34,8 @@ #if _POSIX_THREADS # include <pthread.h> +#ifdef __ARCH_USE_MMU__ + static pid_t pid; static mqd_t m; static const char message[] = "hello"; @@ -243,3 +245,13 @@ do_test (void) #endif #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-mqueue5.c b/test/nptl/tst-mqueue5.c index ea6cc96..c17cfb3 100644 --- a/test/nptl/tst-mqueue5.c +++ b/test/nptl/tst-mqueue5.c @@ -34,6 +34,8 @@ #include "tst-mqueue.h" #include "../test-skeleton.h" +#ifdef __ARCH_USE_MMU__ + #define TIMEOUT 3 #if _POSIX_THREADS @@ -1012,3 +1014,13 @@ do_test (void) #endif #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-mutex4.c b/test/nptl/tst-mutex4.c index f66abc0..c18883f 100644 --- a/test/nptl/tst-mutex4.c +++ b/test/nptl/tst-mutex4.c @@ -26,6 +26,7 @@ #include <sys/mman.h> #include <sys/wait.h> +#ifdef __ARCH_USE_MMU__ static int do_test (void) @@ -188,3 +189,13 @@ do_test (void) #define TIMEOUT 4 #define TEST_FUNCTION do_test () #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-mutex9.c b/test/nptl/tst-mutex9.c index 2d5bf75..687a474 100644 --- a/test/nptl/tst-mutex9.c +++ b/test/nptl/tst-mutex9.c @@ -28,6 +28,8 @@ #include <sys/time.h> #include "../test-skeleton.h" +#ifdef __ARCH_USE_MMU__ + //int gettimeofday(struct timeval *tv, struct timezone *tz); @@ -189,3 +191,13 @@ do_test (void) #define TIMEOUT 3 #define TEST_FUNCTION do_test () #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-rwlock12.c b/test/nptl/tst-rwlock12.c index 695e720..123a918 100644 --- a/test/nptl/tst-rwlock12.c +++ b/test/nptl/tst-rwlock12.c @@ -27,6 +27,8 @@ #include <sys/wait.h> #include "../test-skeleton.h" +#ifdef __ARCH_USE_MMU__ + static int do_test (void) { @@ -205,3 +207,13 @@ do_test (void) #define TEST_FUNCTION do_test () #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-rwlock4.c b/test/nptl/tst-rwlock4.c index 0bbf083..5067462 100644 --- a/test/nptl/tst-rwlock4.c +++ b/test/nptl/tst-rwlock4.c @@ -26,6 +26,7 @@ #include <sys/mman.h> #include <sys/wait.h> +#ifdef __ARCH_USE_MMU__ static int do_test (void) @@ -187,3 +188,13 @@ do_test (void) #define TEST_FUNCTION do_test () #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-sem3.c b/test/nptl/tst-sem3.c index 1b598dc..3969bc7 100644 --- a/test/nptl/tst-sem3.c +++ b/test/nptl/tst-sem3.c @@ -27,6 +27,7 @@ #include <sys/wait.h> #include "../test-skeleton.h" +#ifdef __ARCH_USE_MMU__ int do_test (void) @@ -143,3 +144,13 @@ do_test (void) #define TEST_FUNCTION do_test () #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-sem4.c b/test/nptl/tst-sem4.c index 4293b2c..1ef1428 100644 --- a/test/nptl/tst-sem4.c +++ b/test/nptl/tst-sem4.c @@ -24,6 +24,8 @@ #include <unistd.h> #include "../test-skeleton.h" +#ifdef __ARCH_USE_MMU__ + static void remove_sem (int status, void *arg) { @@ -151,3 +153,13 @@ do_test (void) #define TEST_FUNCTION do_test () #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-signal1.c b/test/nptl/tst-signal1.c index cb31108..54c9a3b 100644 --- a/test/nptl/tst-signal1.c +++ b/test/nptl/tst-signal1.c @@ -27,6 +27,7 @@ #include <sys/wait.h> #include "../test-skeleton.h" +#ifdef __ARCH_USE_MMU__ static sigset_t ss; static pthread_barrier_t *b; @@ -187,3 +188,13 @@ do_test (void) #define TEST_FUNCTION do_test () #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-signal2.c b/test/nptl/tst-signal2.c index 4df0868..3db8ab2 100644 --- a/test/nptl/tst-signal2.c +++ b/test/nptl/tst-signal2.c @@ -27,6 +27,7 @@ #include <string.h> #include "../test-skeleton.h" +#ifdef __ARCH_USE_MMU__ static sigset_t ss; static pthread_barrier_t *b; @@ -196,3 +197,13 @@ do_test (void) #define TEST_FUNCTION do_test () #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-spin2.c b/test/nptl/tst-spin2.c index 6119a3b..af3ec05 100644 --- a/test/nptl/tst-spin2.c +++ b/test/nptl/tst-spin2.c @@ -26,6 +26,7 @@ #include <sys/mman.h> #include <sys/wait.h> +#ifdef __ARCH_USE_MMU__ static int do_test (void) @@ -156,3 +157,13 @@ do_test (void) #define TEST_FUNCTION do_test () #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/nptl/tst-tsd6.c b/test/nptl/tst-tsd6.c index ea0a481..7605745 100644 --- a/test/nptl/tst-tsd6.c +++ b/test/nptl/tst-tsd6.c @@ -6,6 +6,8 @@ #include <sys/wait.h> #include "../test-skeleton.h" +#ifdef __ARCH_USE_MMU__ + #define NKEYS 100 static pthread_key_t keys[NKEYS]; static pthread_barrier_t b; @@ -88,3 +90,13 @@ do_test (void) #define TEST_FUNCTION do_test () #include "../test-skeleton.c" + +#else + +int main(void) +{ + printf("Skipping test on non-mmu host!\n"); + return 23; +} + +#endif diff --git a/test/pthread/Makefile.in b/test/pthread/Makefile.in index b989334..c989b58 100644 --- a/test/pthread/Makefile.in +++ b/test/pthread/Makefile.in @@ -6,6 +6,9 @@ TESTS_DISABLED += cancellation-points ifeq ($(TARGET_ARCH),microblaze) TESTS_DISABLED += ex3 endif +ifeq ($(TARGET_ARCH),nds32) +TESTS_DISABLED += ex3 +endif ifeq ($(TARGET_ARCH),sh) TESTS_DISABLED += ex2 ex7 endif diff --git a/test/test-skeleton.c b/test/test-skeleton.c index 557996d..323a9c6 100644 --- a/test/test-skeleton.c +++ b/test/test-skeleton.c @@ -222,18 +222,15 @@ handler_killpid(int sig) /* We provide the entry point here. */ int -main (int argc, char *argv[]) +main (int argc, char *argv[], char *envp[]) { -#ifdef __ARCH_USE_MMU__ int direct = 0; /* Directly call the test function? */ -#else - int direct = 1; -#endif int status; int opt; unsigned int timeoutfactor = 1; pid_t termpid; char *envstr_timeoutfactor; + char **argv1; /* Make uses of freed and uninitialized memory known. */ #ifdef __MALLOC_STANDARD__ @@ -303,19 +300,21 @@ main (int argc, char *argv[]) /* make sure temporary files are deleted. */ atexit (delete_temp_files); - /* Correct for the possible parameters. */ - argv[optind - 1] = argv[0]; - argv += optind - 1; - argc -= optind - 1; + /* If we are not expected to fork run the function immediately. */ + if (direct) + { + /* Correct for the possible parameters. */ + argv[optind - 1] = argv[0]; + argv += optind - 1; + argc -= optind - 1; - /* Call the initializing function, if one is available. */ + /* Call the initializing function, if one is available. */ #ifdef PREPARE - PREPARE (argc, argv); + PREPARE (argc, argv); #endif - /* If we are not expected to fork run the function immediately. */ - if (direct) - return TEST_FUNCTION; + return TEST_FUNCTION; + } /* Set up the test environment: - prevent core dumps @@ -340,15 +339,51 @@ main (int argc, char *argv[]) if (setpgid (0, 0) != 0) printf ("Failed to set the process group ID: %m\n"); + /* Correct for the possible parameters. */ + argv[optind - 1] = argv[0]; + argv += optind - 1; + argc -= optind - 1; + + /* Call the initializing function, if one is available. */ +#ifdef PREPARE + PREPARE (argc, argv); +#endif + /* Execute the test function and exit with the return value. */ exit (TEST_FUNCTION); } else if (pid < 0) -#endif { perror ("Cannot fork test program"); exit (1); } +#else + argv1 = malloc ((argc + 2) * sizeof(void *)); + argv1[0] = argv[0]; + argv1[1] = "-d"; + memcpy(argv1 + 2, argv + 1, argc * sizeof(void *)); + + pid = vfork (); + if (pid == 0) + { + /* This is the child. */ + /* We put the test process in its own pgrp so that if it bogusly + generates any job control signals, they won't hit the whole build. */ + if (setpgid (0, 0) != 0) + printf ("Failed to set the process group ID: %m\n"); + + if (execve (argv1[0], argv1, envp) < 0) + { + perror ("Cannot exec test program"); + _exit (1); + } + } + else if (pid < 0) + { + perror ("Cannot vfork test program"); + exit (1); + } +#endif #ifdef __XXX_HANDLE_CTRL_C signal (SIGTERM, handler_killpid); |
