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 | gdb-1654a6f72803b321cfe3d7ac28ea1abed5d26fd9.zip gdb-1654a6f72803b321cfe3d7ac28ea1abed5d26fd9.tar.gz gdb-1654a6f72803b321cfe3d7ac28ea1abed5d26fd9.tar.bz2 |
* 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 34a29c6..c7c0acc 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 0000000..75ddb44 --- /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 0000000..e0bc691 --- /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 b642a2f..3444b56 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 0000000..586b5c6 --- /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 e180841..184fd64 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 0000000..fc9f95b --- /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 ef249ec..01d9519 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 0000000..4d83945 --- /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 0000000..05a332f --- /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 5a0d878..e5e9d94 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 0eee768..7cc7c5c 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 0000000..5026908 --- /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 4a5ee3f..0e00cc1 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 0000000..9ce165d --- /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 0000000..4d71752 --- /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 2e70a43..0991ff0 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 ddb0d02..09989f5 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 f0157f0..d0305cb 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 0000000..f5ed90f --- /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 0000000..456e312 --- /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 5b8cfda..150f297 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 4497588..43462ec 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 0000000..9ba9635 --- /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 0000000..757099f --- /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 0000000..2eac900 --- /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 0000000..91375df --- /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 0000000..0f1daf1 --- /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 0000000..c579436 --- /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 482e546..b6752a8 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 0000000..747e784 --- /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" |