* 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.
This commit is contained in:
Hans-Peter Nilsson 2006-10-02 03:18:51 +00:00
parent 28d9ed440a
commit 1654a6f728
31 changed files with 233 additions and 16 deletions

View 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.

View File

@ -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

View File

@ -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

View 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;
}

View File

@ -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"

View 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);
}

View File

@ -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"

View 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);
}

View File

@ -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"

View File

@ -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"

View 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

View 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;
}

View File

@ -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"

View 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);
}

View File

@ -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"

View File

@ -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"

View 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);

View 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);
}

View 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);
}

View File

@ -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"

View File

@ -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"

View 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);
}

View 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);
}

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View 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);
}

View File

@ -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"