* sim/cris/c/clone5.c, sim/cris/c/mprotect1.c,
authorHans-Peter Nilsson <hp@axis.com>
Mon, 2 Oct 2006 03:18:51 +0000 (03:18 +0000)
committerHans-Peter Nilsson <hp@axis.com>
Mon, 2 Oct 2006 03:18:51 +0000 (03:18 +0000)
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.

31 files changed:
sim/testsuite/ChangeLog
sim/testsuite/sim/cris/asm/option3.ms [new file with mode: 0644]
sim/testsuite/sim/cris/asm/option4.ms [new file with mode: 0644]
sim/testsuite/sim/cris/c/clone5.c
sim/testsuite/sim/cris/c/clone6.c [new file with mode: 0644]
sim/testsuite/sim/cris/c/fcntl1.c
sim/testsuite/sim/cris/c/fcntl2.c [new file with mode: 0644]
sim/testsuite/sim/cris/c/mprotect1.c
sim/testsuite/sim/cris/c/mprotect2.c [new file with mode: 0644]
sim/testsuite/sim/cris/c/readlink11.c [new file with mode: 0644]
sim/testsuite/sim/cris/c/readlink2.c
sim/testsuite/sim/cris/c/rtsigprocmask1.c
sim/testsuite/sim/cris/c/rtsigprocmask2.c [new file with mode: 0644]
sim/testsuite/sim/cris/c/rtsigsuspend1.c
sim/testsuite/sim/cris/c/rtsigsuspend2.c [new file with mode: 0644]
sim/testsuite/sim/cris/c/sig13.c [new file with mode: 0644]
sim/testsuite/sim/cris/c/sig7.c
sim/testsuite/sim/cris/c/sigreturn1.c
sim/testsuite/sim/cris/c/sigreturn2.c
sim/testsuite/sim/cris/c/sigreturn3.c [new file with mode: 0644]
sim/testsuite/sim/cris/c/sigreturn4.c [new file with mode: 0644]
sim/testsuite/sim/cris/c/syscall1.c
sim/testsuite/sim/cris/c/syscall2.c
sim/testsuite/sim/cris/c/syscall3.c [new file with mode: 0644]
sim/testsuite/sim/cris/c/syscall4.c [new file with mode: 0644]
sim/testsuite/sim/cris/c/syscall5.c [new file with mode: 0644]
sim/testsuite/sim/cris/c/syscall6.c [new file with mode: 0644]
sim/testsuite/sim/cris/c/syscall7.c [new file with mode: 0644]
sim/testsuite/sim/cris/c/syscall8.c [new file with mode: 0644]
sim/testsuite/sim/cris/c/sysctl2.c
sim/testsuite/sim/cris/c/sysctl3.c [new file with mode: 0644]

index 34a29c6fe06cb391804facc38a4bca0e98818606..c7c0acca51a1a91882533e20177ecedd41355ec4 100644 (file)
@@ -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 (file)
index 0000000..75ddb44
--- /dev/null
@@ -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 (file)
index 0000000..e0bc691
--- /dev/null
@@ -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
index b642a2f1a3544212b397fbd541980fa54d402840..3444b56ebd4dfcc38de7c2d14c545188c86fcf09 100644 (file)
@@ -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 (file)
index 0000000..586b5c6
--- /dev/null
@@ -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"
index e180841645acdabcfe79196b514bb28f8be149e2..184fd6452173c75ee2b399155baed93b7e57a684 100644 (file)
@@ -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 (file)
index 0000000..fc9f95b
--- /dev/null
@@ -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"
index ef249ec691fdfb64d32dbad87bf3ff1124980b5c..01d9519da3c479fc8970de4882763704949e8a38 100644 (file)
@@ -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 (file)
index 0000000..4d83945
--- /dev/null
@@ -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 (file)
index 0000000..05a332f
--- /dev/null
@@ -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"
index 5a0d8785caf27045eda07b21a7aa468bbf392f7f..e5e9d94121c62afe66ab41844ca5ca1686f3c39c 100644 (file)
@@ -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
index 0eee76845ef58139bc487b4bf4a87897134e0f2d..7cc7c5c5e5c1079be0e7a2204c41d32a26b02d9c 100644 (file)
@@ -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 (file)
index 0000000..5026908
--- /dev/null
@@ -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"
index 4a5ee3fd9c44a80d050abe86afe9fa24edc02afd..0e00cc17b1e4b64a40ade98b5dbb3dadd0a97896 100644 (file)
@@ -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 (file)
index 0000000..9ce165d
--- /dev/null
@@ -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 (file)
index 0000000..4d71752
--- /dev/null
@@ -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"
index 2e70a430431176e1a5c75514306d46f7211fc4e4..0991ff0968a9c78879237275b52a1db8ec88ac82 100644 (file)
@@ -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);
index ddb0d02d719cef2933e2bbb22f5c7b2d31decd46..09989f5ee0c30330a2edc414de21553ea20dd26d 100644 (file)
@@ -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);
 }
index f0157f0488d240671724f781eb439ba07de27980..d0305cb5073e7d7543a1fe488e66bf1c56980f25 100644 (file)
@@ -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 (file)
index 0000000..f5ed90f
--- /dev/null
@@ -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 (file)
index 0000000..456e312
--- /dev/null
@@ -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"
index 5b8cfda7b5102f6f5a0699d6a165c0b372496cc5..150f297c3f45aeed77129e5314bb7b3e593fdb78 100644 (file)
@@ -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);
 }
index 4497588dd248b13ab3740b39db5dc1dd9e52b87a..43462ec22d06614668b0a75b6d6f7941d2d3ace2 100644 (file)
@@ -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 (file)
index 0000000..9ba9635
--- /dev/null
@@ -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 (file)
index 0000000..757099f
--- /dev/null
@@ -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 (file)
index 0000000..2eac900
--- /dev/null
@@ -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 (file)
index 0000000..91375df
--- /dev/null
@@ -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 (file)
index 0000000..0f1daf1
--- /dev/null
@@ -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 (file)
index 0000000..c579436
--- /dev/null
@@ -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"
index 482e5463f813af3365e6a5e4dc3053fbc595fcdb..b6752a8bc87b8caf003d64e47c93269df7b05a1c 100644 (file)
@@ -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 (file)
index 0000000..747e784
--- /dev/null
@@ -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"