diff options
author | Hans-Peter Nilsson <hp@axis.com> | 2006-10-02 03:18:51 +0000 |
---|---|---|
committer | Hans-Peter Nilsson <hp@axis.com> | 2006-10-02 03:18:51 +0000 |
commit | 1654a6f72803b321cfe3d7ac28ea1abed5d26fd9 (patch) | |
tree | 4408a9d45d32c4934f41cf98d5e5a32c250c0ba6 /sim/testsuite | |
parent | 28d9ed440abaea539b9571dfe8ad2ec6f834a890 (diff) | |
download | binutils-1654a6f72803b321cfe3d7ac28ea1abed5d26fd9.tar.gz binutils-1654a6f72803b321cfe3d7ac28ea1abed5d26fd9.tar.bz2 binutils-1654a6f72803b321cfe3d7ac28ea1abed5d26fd9.zip |
* sim/cris/c/clone5.c, sim/cris/c/mprotect1.c,
sim/cris/c/rtsigprocmask1.c, sim/cris/c/rtsigsuspend1.c,
sim/cris/c/sig7.c, sim/cris/c/sigreturn1.c,
sim/cris/c/sigreturn2.c, sim/cris/c/syscall1.c,
sim/cris/c/syscall2.c, sim/cris/c/sysctl2.c, sim/cris/c/fcntl1.c,
sim/cris/c/readlink2.c: Add code to print ENOSYS if syscall being
tested returns ENOSYS. Add early exit where needed. Change any
existing code to print "xyzzy", not "pass".
* sim/cris/asm/option3.ms, sim/cris/asm/option4.ms,
sim/cris/c/clone6.c, sim/cris/c/fcntl2.c,
sim/cris/c/mprotect2.c, sim/cris/c/readlink11.c,
sim/cris/c/rtsigprocmask2.c, sim/cris/c/rtsigsuspend2.c,
sim/cris/c/sig13.c, sim/cris/c/sigreturn3.c,
sim/cris/c/sigreturn4.c, sim/cris/c/syscall3.c,
sim/cris/c/syscall4.c, sim/cris/c/syscall5.c,
sim/cris/c/syscall6.c, sim/cris/c/syscall7.c,
sim/cris/c/syscall8.c, sim/cris/c/sysctl3.c: New tests.
Diffstat (limited to 'sim/testsuite')
31 files changed, 233 insertions, 16 deletions
diff --git a/sim/testsuite/ChangeLog b/sim/testsuite/ChangeLog index 34a29c6fe06..c7c0acca51a 100644 --- a/sim/testsuite/ChangeLog +++ b/sim/testsuite/ChangeLog @@ -1,3 +1,24 @@ +2006-10-02 Hans-Peter Nilsson <hp@axis.com> + Edgar E. Iglesias <edgar@axis.com> + + * sim/cris/c/clone5.c, sim/cris/c/mprotect1.c, + sim/cris/c/rtsigprocmask1.c, sim/cris/c/rtsigsuspend1.c, + sim/cris/c/sig7.c, sim/cris/c/sigreturn1.c, + sim/cris/c/sigreturn2.c, sim/cris/c/syscall1.c, + sim/cris/c/syscall2.c, sim/cris/c/sysctl2.c, sim/cris/c/fcntl1.c, + sim/cris/c/readlink2.c: Add code to print ENOSYS if syscall being + tested returns ENOSYS. Add early exit where needed. Change any + existing code to print "xyzzy", not "pass". + * sim/cris/asm/option3.ms, sim/cris/asm/option4.ms, + sim/cris/c/clone6.c, sim/cris/c/fcntl2.c, + sim/cris/c/mprotect2.c, sim/cris/c/readlink11.c, + sim/cris/c/rtsigprocmask2.c, sim/cris/c/rtsigsuspend2.c, + sim/cris/c/sig13.c, sim/cris/c/sigreturn3.c, + sim/cris/c/sigreturn4.c, sim/cris/c/syscall3.c, + sim/cris/c/syscall4.c, sim/cris/c/syscall5.c, + sim/cris/c/syscall6.c, sim/cris/c/syscall7.c, + sim/cris/c/syscall8.c, sim/cris/c/sysctl3.c: New tests. + 2006-09-30 Hans-Peter Nilsson <hp@axis.com> * sim/cris/c/pipe2.c: Adjust expected output. diff --git a/sim/testsuite/sim/cris/asm/option3.ms b/sim/testsuite/sim/cris/asm/option3.ms new file mode 100644 index 00000000000..75ddb446318 --- /dev/null +++ b/sim/testsuite/sim/cris/asm/option3.ms @@ -0,0 +1,7 @@ +#mach: crisv0 crisv3 crisv8 crisv10 crisv32 +#sim: --cris-cycles=foo +#xerror: +#output: Unknown option `--cris-cycles=foo'\n + .include "testutils.inc" + start + fail diff --git a/sim/testsuite/sim/cris/asm/option4.ms b/sim/testsuite/sim/cris/asm/option4.ms new file mode 100644 index 00000000000..e0bc6917854 --- /dev/null +++ b/sim/testsuite/sim/cris/asm/option4.ms @@ -0,0 +1,7 @@ +#mach: crisv0 crisv3 crisv8 crisv10 crisv32 +#sim: --cris-unknown-syscall=foo +#xerror: +#output: Unknown option `--cris-unknown-syscall=foo'\n + .include "testutils.inc" + start + fail diff --git a/sim/testsuite/sim/cris/c/clone5.c b/sim/testsuite/sim/cris/c/clone5.c index b642a2f1a35..3444b56ebd4 100644 --- a/sim/testsuite/sim/cris/c/clone5.c +++ b/sim/testsuite/sim/cris/c/clone5.c @@ -11,6 +11,7 @@ #include <signal.h> #include <sys/types.h> #include <sys/wait.h> +#include <errno.h> int pip[2]; @@ -26,7 +27,9 @@ main (void) int retcode; long stack[16384]; - clone (process, (char *) stack + sizeof (stack) - 64, 0, "cba"); + retcode = clone (process, (char *) stack + sizeof (stack) - 64, 0, "cba"); + if (retcode == -1 && errno == ENOSYS) + printf ("ENOSYS\n"); printf ("xyzzy\n"); return 0; } diff --git a/sim/testsuite/sim/cris/c/clone6.c b/sim/testsuite/sim/cris/c/clone6.c new file mode 100644 index 00000000000..586b5c67378 --- /dev/null +++ b/sim/testsuite/sim/cris/c/clone6.c @@ -0,0 +1,8 @@ +/* As the included file, but specifying silent ENOSYS. +#notarget: cris*-*-elf +#sim: --cris-unknown-syscall=enosys-quiet +#output: ENOSYS\n +#output: xyzzy\n +*/ + +#include "clone5.c" diff --git a/sim/testsuite/sim/cris/c/fcntl1.c b/sim/testsuite/sim/cris/c/fcntl1.c index e180841645a..184fd645217 100644 --- a/sim/testsuite/sim/cris/c/fcntl1.c +++ b/sim/testsuite/sim/cris/c/fcntl1.c @@ -7,10 +7,13 @@ #include <fcntl.h> #include <stdio.h> #include <stdlib.h> +#include <errno.h> int main (void) { - fcntl (1, 42); - printf ("pass\n"); + int err = fcntl (1, 42); + if (err == -1 && errno == ENOSYS) + printf ("ENOSYS\n"); + printf ("xyzzy\n"); exit (0); } diff --git a/sim/testsuite/sim/cris/c/fcntl2.c b/sim/testsuite/sim/cris/c/fcntl2.c new file mode 100644 index 00000000000..fc9f95b688d --- /dev/null +++ b/sim/testsuite/sim/cris/c/fcntl2.c @@ -0,0 +1,8 @@ +/* As the included file, but specifying silent ENOSYS. +#notarget: cris*-*-elf +#sim: --cris-unknown-syscall=enosys-quiet +#output: ENOSYS\n +#output: xyzzy\n +*/ + +#include "fcntl1.c" diff --git a/sim/testsuite/sim/cris/c/mprotect1.c b/sim/testsuite/sim/cris/c/mprotect1.c index ef249ec691f..01d9519da3c 100644 --- a/sim/testsuite/sim/cris/c/mprotect1.c +++ b/sim/testsuite/sim/cris/c/mprotect1.c @@ -7,10 +7,13 @@ #include <stdlib.h> #include <stdio.h> #include <sys/mman.h> +#include <errno.h> int main (int argc, char *argv[]) { - mprotect (0, 8193, PROT_EXEC); + int err = mprotect (0, 8193, PROT_EXEC); + if (err == -1 && errno == ENOSYS) + printf ("ENOSYS\n"); printf ("xyzzy\n"); exit (0); } diff --git a/sim/testsuite/sim/cris/c/mprotect2.c b/sim/testsuite/sim/cris/c/mprotect2.c new file mode 100644 index 00000000000..4d839452435 --- /dev/null +++ b/sim/testsuite/sim/cris/c/mprotect2.c @@ -0,0 +1,8 @@ +/* As the included file, but specifying silent ENOSYS. +#notarget: cris*-*-elf +#sim: --cris-unknown-syscall=enosys-quiet +#output: ENOSYS\n +#output: xyzzy\n +*/ + +#include "mprotect1.c" diff --git a/sim/testsuite/sim/cris/c/readlink11.c b/sim/testsuite/sim/cris/c/readlink11.c new file mode 100644 index 00000000000..05a332f65ec --- /dev/null +++ b/sim/testsuite/sim/cris/c/readlink11.c @@ -0,0 +1,9 @@ +/* As readlink5.c (sic), but specifying silent ENOSYS. +#notarget: cris*-*-elf +#dest: ./readlink11.c.x +#sim: --cris-unknown-syscall=enosys-quiet +#output: ENOSYS\n +#output: xyzzy\n +*/ + +#include "readlink2.c" diff --git a/sim/testsuite/sim/cris/c/readlink2.c b/sim/testsuite/sim/cris/c/readlink2.c index 5a0d8785caf..e5e9d94121c 100644 --- a/sim/testsuite/sim/cris/c/readlink2.c +++ b/sim/testsuite/sim/cris/c/readlink2.c @@ -12,11 +12,18 @@ int main (int argc, char *argv[]) { char buf[1024]; char buf2[1024]; + int err; /* This is a special feature handled in the simulator. The "42" should be formed from getpid () if this was a real program. */ - if (readlink ("/proc/42/exe", buf, sizeof (buf)) < 0) - abort (); + err = readlink ("/proc/42/exe", buf, sizeof (buf)); + if (err < 0) + { + if (err == -1 && errno == ENOSYS) + printf ("ENOSYS\n"); + printf ("xyzzy\n"); + exit (0); + } /* Don't use an abort in the following; it might cause the printf to not make it all the way to output and make debugging more diff --git a/sim/testsuite/sim/cris/c/rtsigprocmask1.c b/sim/testsuite/sim/cris/c/rtsigprocmask1.c index 0eee76845ef..7cc7c5c5e5c 100644 --- a/sim/testsuite/sim/cris/c/rtsigprocmask1.c +++ b/sim/testsuite/sim/cris/c/rtsigprocmask1.c @@ -13,6 +13,7 @@ #include <unistd.h> #include <signal.h> #include <pthread.h> +#include <errno.h> static void * process (void *arg) @@ -38,8 +39,13 @@ main (void) abort (); /* An invalid parameter 1 should cause this to halt the simulator. */ - pthread_sigmask (SIG_BLOCK + SIG_UNBLOCK + SIG_SETMASK, - NULL, &sigs); + retcode + = pthread_sigmask (SIG_BLOCK + SIG_UNBLOCK + SIG_SETMASK, NULL, &sigs); + /* Direct return of the error number; i.e. not using -1 and errno, + is the actual documented behavior. */ + if (retcode == ENOSYS) + printf ("ENOSYS\n"); + printf ("xyzzy\n"); return 0; } diff --git a/sim/testsuite/sim/cris/c/rtsigprocmask2.c b/sim/testsuite/sim/cris/c/rtsigprocmask2.c new file mode 100644 index 00000000000..5026908fe16 --- /dev/null +++ b/sim/testsuite/sim/cris/c/rtsigprocmask2.c @@ -0,0 +1,9 @@ +/* As the included file, but specifying silent ENOSYS. +#notarget: cris*-*-elf +#cc: additional_flags=-pthread +#sim: --cris-unknown-syscall=enosys-quiet +#output: ENOSYS\n +#output: xyzzy\n +*/ + +#include "rtsigprocmask1.c" diff --git a/sim/testsuite/sim/cris/c/rtsigsuspend1.c b/sim/testsuite/sim/cris/c/rtsigsuspend1.c index 4a5ee3fd9c4..0e00cc17b1e 100644 --- a/sim/testsuite/sim/cris/c/rtsigsuspend1.c +++ b/sim/testsuite/sim/cris/c/rtsigsuspend1.c @@ -9,10 +9,13 @@ #include <sys/syscall.h> #include <stdio.h> #include <stdlib.h> +#include <errno.h> int main (void) { - syscall (SYS_rt_sigsuspend, 1, 2); + int err = syscall (SYS_rt_sigsuspend, 1, 2); + if (err == -1 && errno == ENOSYS) + printf ("ENOSYS\n"); printf ("xyzzy\n"); exit (0); } diff --git a/sim/testsuite/sim/cris/c/rtsigsuspend2.c b/sim/testsuite/sim/cris/c/rtsigsuspend2.c new file mode 100644 index 00000000000..9ce165db552 --- /dev/null +++ b/sim/testsuite/sim/cris/c/rtsigsuspend2.c @@ -0,0 +1,8 @@ +/* As the included file, but specifying silent ENOSYS. +#notarget: cris*-*-elf +#sim: --cris-unknown-syscall=enosys-quiet +#output: ENOSYS\n +#output: xyzzy\n +*/ + +#include "rtsigsuspend1.c" diff --git a/sim/testsuite/sim/cris/c/sig13.c b/sim/testsuite/sim/cris/c/sig13.c new file mode 100644 index 00000000000..4d71752a257 --- /dev/null +++ b/sim/testsuite/sim/cris/c/sig13.c @@ -0,0 +1,8 @@ +/* As the included file, but specifying silent ENOSYS. +#notarget: cris*-*-elf +#sim: --cris-unknown-syscall=enosys-quiet +#output: ENOSYS\n +#output: xyzzy\n +*/ + +#include "sig7.c" diff --git a/sim/testsuite/sim/cris/c/sig7.c b/sim/testsuite/sim/cris/c/sig7.c index 2e70a430431..0991ff0968a 100644 --- a/sim/testsuite/sim/cris/c/sig7.c +++ b/sim/testsuite/sim/cris/c/sig7.c @@ -7,17 +7,20 @@ #include <stdio.h> #include <signal.h> #include <stdlib.h> +#include <errno.h> int main (void) { struct sigaction sa; + int err; sa.sa_sigaction = NULL; sa.sa_flags = SA_RESTART | SA_SIGINFO; sigemptyset (&sa.sa_mask); - if (sigaction (SIGFPE, &sa, NULL) != 0) - abort (); + err = sigaction (SIGFPE, &sa, NULL); + if (err == -1 && errno == ENOSYS) + printf ("ENOSYS\n"); printf ("xyzzy\n"); exit (0); diff --git a/sim/testsuite/sim/cris/c/sigreturn1.c b/sim/testsuite/sim/cris/c/sigreturn1.c index ddb0d02d719..09989f5ee0c 100644 --- a/sim/testsuite/sim/cris/c/sigreturn1.c +++ b/sim/testsuite/sim/cris/c/sigreturn1.c @@ -9,10 +9,13 @@ #include <sys/syscall.h> #include <stdio.h> #include <stdlib.h> +#include <errno.h> int main (void) { - syscall (SYS_sigreturn, 1, 2, 3, 4, 5, 6); + int err = syscall (SYS_sigreturn, 1, 2, 3, 4, 5, 6); + if (err == -1 && errno == ENOSYS) + printf ("ENOSYS\n"); printf ("xyzzy\n"); exit (0); } diff --git a/sim/testsuite/sim/cris/c/sigreturn2.c b/sim/testsuite/sim/cris/c/sigreturn2.c index f0157f0488d..d0305cb5073 100644 --- a/sim/testsuite/sim/cris/c/sigreturn2.c +++ b/sim/testsuite/sim/cris/c/sigreturn2.c @@ -14,6 +14,7 @@ #include <sys/types.h> #include <sys/syscall.h> #include <signal.h> +#include <errno.h> static void * process (void *arg) @@ -27,7 +28,11 @@ int main (void) { pthread_t th_a; if (pthread_create (&th_a, NULL, process, (void *) "a") == 0) - syscall (SYS_sigreturn, 1, 2, 3, 4, 5, 6); + { + int err = syscall (SYS_sigreturn, 1, 2, 3, 4, 5, 6); + if (err == -1 && errno == ENOSYS) + printf ("ENOSYS\n"); + } printf ("xyzzy\n"); exit (0); } diff --git a/sim/testsuite/sim/cris/c/sigreturn3.c b/sim/testsuite/sim/cris/c/sigreturn3.c new file mode 100644 index 00000000000..f5ed90f2432 --- /dev/null +++ b/sim/testsuite/sim/cris/c/sigreturn3.c @@ -0,0 +1,8 @@ +/* As the included file, but specifying silent ENOSYS. +#notarget: cris*-*-elf +#sim: --cris-unknown-syscall=enosys-quiet +#output: ENOSYS\n +#output: xyzzy\n +*/ + +#include "sigreturn1.c" diff --git a/sim/testsuite/sim/cris/c/sigreturn4.c b/sim/testsuite/sim/cris/c/sigreturn4.c new file mode 100644 index 00000000000..456e312c568 --- /dev/null +++ b/sim/testsuite/sim/cris/c/sigreturn4.c @@ -0,0 +1,9 @@ +/* As the included file, but specifying silent ENOSYS. +#notarget: cris*-*-elf +#cc: additional_flags=-pthread +#sim: --cris-unknown-syscall=enosys-quiet +#output: ENOSYS\n +#output: xyzzy\n +*/ + +#include "sigreturn2.c" diff --git a/sim/testsuite/sim/cris/c/syscall1.c b/sim/testsuite/sim/cris/c/syscall1.c index 5b8cfda7b51..150f297c3f4 100644 --- a/sim/testsuite/sim/cris/c/syscall1.c +++ b/sim/testsuite/sim/cris/c/syscall1.c @@ -8,12 +8,15 @@ #include <unistd.h> #include <stdio.h> #include <stdlib.h> +#include <errno.h> int main (void) { /* The number 166 is chosen because there's a gap for that number in the CRIS asm/unistd.h. */ - syscall (166, 1, 2, 3, 4, 5, 6); + int err = syscall (166, 1, 2, 3, 4, 5, 6); + if (err == -1 && errno == ENOSYS) + printf ("ENOSYS\n"); printf ("xyzzy\n"); exit (0); } diff --git a/sim/testsuite/sim/cris/c/syscall2.c b/sim/testsuite/sim/cris/c/syscall2.c index 4497588dd24..43462ec22d0 100644 --- a/sim/testsuite/sim/cris/c/syscall2.c +++ b/sim/testsuite/sim/cris/c/syscall2.c @@ -8,11 +8,16 @@ #include <unistd.h> #include <stdio.h> #include <stdlib.h> +#include <errno.h> int main (void) { + int err; + /* Check special case of number 0 syscall. */ - syscall (0, 3, 2, 1, 4, 6, 5); + err = syscall (0, 3, 2, 1, 4, 6, 5); + if (err == -1 && errno == ENOSYS) + printf ("ENOSYS\n"); printf ("xyzzy\n"); exit (0); } diff --git a/sim/testsuite/sim/cris/c/syscall3.c b/sim/testsuite/sim/cris/c/syscall3.c new file mode 100644 index 00000000000..9ba96359ef0 --- /dev/null +++ b/sim/testsuite/sim/cris/c/syscall3.c @@ -0,0 +1,9 @@ +/* As the included file, just actually specifying the default. +#notarget: cris*-*-elf +#sim: --cris-unknown-syscall=stop +#xerror: +#output: Unimplemented syscall: 166 (0x1, 0x2, 0x3, 0x4, 0x5, 0x6)\n +#output: program stopped with signal 4.\n +*/ + +#include "syscall1.c" diff --git a/sim/testsuite/sim/cris/c/syscall4.c b/sim/testsuite/sim/cris/c/syscall4.c new file mode 100644 index 00000000000..757099fcf90 --- /dev/null +++ b/sim/testsuite/sim/cris/c/syscall4.c @@ -0,0 +1,9 @@ +/* As the included file, just actually specifying the default. +#notarget: cris*-*-elf +#sim: --cris-unknown-syscall=stop +#xerror: +#output: Unimplemented syscall: 0 (0x3, 0x2, 0x1, 0x4, 0x6, 0x5)\n +#output: program stopped with signal 4.\n +*/ + +#include "syscall2.c" diff --git a/sim/testsuite/sim/cris/c/syscall5.c b/sim/testsuite/sim/cris/c/syscall5.c new file mode 100644 index 00000000000..2eac9008972 --- /dev/null +++ b/sim/testsuite/sim/cris/c/syscall5.c @@ -0,0 +1,9 @@ +/* As the included file, but specifying ENOSYS with message. +#notarget: cris*-*-elf +#sim: --cris-unknown-syscall=enosys +#output: Unimplemented syscall: 166 (0x1, 0x2, 0x3, 0x4, 0x5, 0x6)\n +#output: ENOSYS\n +#output: xyzzy\n +*/ + +#include "syscall1.c" diff --git a/sim/testsuite/sim/cris/c/syscall6.c b/sim/testsuite/sim/cris/c/syscall6.c new file mode 100644 index 00000000000..91375df6d34 --- /dev/null +++ b/sim/testsuite/sim/cris/c/syscall6.c @@ -0,0 +1,9 @@ +/* As the included file, but specifying ENOSYS with message. +#notarget: cris*-*-elf +#sim: --cris-unknown-syscall=enosys +#output: Unimplemented syscall: 0 (0x3, 0x2, 0x1, 0x4, 0x6, 0x5)\n +#output: ENOSYS\n +#output: xyzzy\n +*/ + +#include "syscall2.c" diff --git a/sim/testsuite/sim/cris/c/syscall7.c b/sim/testsuite/sim/cris/c/syscall7.c new file mode 100644 index 00000000000..0f1daf1653f --- /dev/null +++ b/sim/testsuite/sim/cris/c/syscall7.c @@ -0,0 +1,8 @@ +/* As the included file, but specifying silent ENOSYS. +#notarget: cris*-*-elf +#sim: --cris-unknown-syscall=enosys-quiet +#output: ENOSYS\n +#output: xyzzy\n +*/ + +#include "syscall1.c" diff --git a/sim/testsuite/sim/cris/c/syscall8.c b/sim/testsuite/sim/cris/c/syscall8.c new file mode 100644 index 00000000000..c579436d0ef --- /dev/null +++ b/sim/testsuite/sim/cris/c/syscall8.c @@ -0,0 +1,8 @@ +/* As the included file, but specifying silent ENOSYS. +#notarget: cris*-*-elf +#sim: --cris-unknown-syscall=enosys-quiet +#output: ENOSYS\n +#output: xyzzy\n +*/ + +#include "syscall2.c" diff --git a/sim/testsuite/sim/cris/c/sysctl2.c b/sim/testsuite/sim/cris/c/sysctl2.c index 482e5463f81..b6752a8bc87 100644 --- a/sim/testsuite/sim/cris/c/sysctl2.c +++ b/sim/testsuite/sim/cris/c/sysctl2.c @@ -10,6 +10,7 @@ #include <errno.h> #include <stdio.h> #include <stdlib.h> +#include <errno.h> int main (void) { @@ -32,7 +33,9 @@ int main (void) (void *) -1, &x, NULL, 0 }; - syscall (SYS__sysctl, &scargs); + int err = syscall (SYS__sysctl, &scargs); + if (err == -1 && errno == ENOSYS) + printf ("ENOSYS\n"); printf ("xyzzy\n"); exit (0); } diff --git a/sim/testsuite/sim/cris/c/sysctl3.c b/sim/testsuite/sim/cris/c/sysctl3.c new file mode 100644 index 00000000000..747e78410f4 --- /dev/null +++ b/sim/testsuite/sim/cris/c/sysctl3.c @@ -0,0 +1,8 @@ +/* As the included file, but specifying silent ENOSYS. +#notarget: cris*-*-elf +#sim: --cris-unknown-syscall=enosys-quiet +#output: ENOSYS\n +#output: xyzzy\n +*/ + +#include "sysctl2.c" |