* 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 34a29c6..c7c0acc 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 b642a2f..3444b56 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 e180841..184fd64 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 ef249ec..01d9519 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 5a0d878..e5e9d94 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 0eee768..7cc7c5c 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 4a5ee3f..0e00cc1 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 2e70a43..0991ff0 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 ddb0d02..09989f5 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 f0157f0..d0305cb 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 5b8cfda..150f297 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 4497588..43462ec 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 482e546..b6752a8 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"