diff --git a/regress/sys/kern/ras/Makefile b/regress/sys/kern/ras/Makefile new file mode 100644 index 000000000000..4891e38a0402 --- /dev/null +++ b/regress/sys/kern/ras/Makefile @@ -0,0 +1,5 @@ +# $NetBSD: Makefile,v 1.1 2002/08/28 07:47:18 gmcgarry Exp $ + +SUBDIR+= ras1 ras2 ras3 + +.include diff --git a/regress/sys/kern/ras/ras1/Makefile b/regress/sys/kern/ras/ras1/Makefile new file mode 100644 index 000000000000..a4b240f5f5ce --- /dev/null +++ b/regress/sys/kern/ras/ras1/Makefile @@ -0,0 +1,14 @@ +# $NetBSD: Makefile,v 1.1 2002/08/28 07:47:20 gmcgarry Exp $ + +PROG= ras1 +NOMAN= #defined +WARNS= 2 + +regress: + @if ./${PROG} ; then \ + echo "PASSED"; \ + else \ + echo "FAILED"; \ + fi + +.include diff --git a/regress/sys/kern/ras/ras1/ras1.c b/regress/sys/kern/ras/ras1/ras1.c new file mode 100644 index 000000000000..2e5cac8bb6f4 --- /dev/null +++ b/regress/sys/kern/ras/ras1/ras1.c @@ -0,0 +1,48 @@ +#include +#include +#include +#include + +#define COUNT 10 + +__volatile int handled = 0; +__volatile int count = 0; +struct itimerval itv; + +void handler(int); + +void +handler(int sig) +{ + + handled++; +} + +int +main(void) +{ + + signal(SIGVTALRM, handler); + + itv.it_interval.tv_sec = 0; + itv.it_interval.tv_usec = 0; + itv.it_value.tv_sec = 10; + itv.it_value.tv_usec = 0; + setitimer(ITIMER_VIRTUAL, &itv, NULL); + + if (rasctl((caddr_t)&&start, (caddr_t)&&end - (caddr_t)&&start, + RAS_INSTALL) < 0) + return (1); + +start: + count++; + if (count > COUNT) + goto end; + + while (!handled) { + continue; + } +end: + + return (handled != 0); +} diff --git a/regress/sys/kern/ras/ras2/Makefile b/regress/sys/kern/ras/ras2/Makefile new file mode 100644 index 000000000000..28cc26ac1343 --- /dev/null +++ b/regress/sys/kern/ras/ras2/Makefile @@ -0,0 +1,14 @@ +# $NetBSD: Makefile,v 1.1 2002/08/28 07:47:24 gmcgarry Exp $ + +PROG= ras2 +NOMAN= #defined +WARNS= 2 + +regress: + @if ./${PROG} ; then \ + echo "PASSED"; \ + else \ + echo "FAILED"; \ + fi + +.include diff --git a/regress/sys/kern/ras/ras2/ras2.c b/regress/sys/kern/ras/ras2/ras2.c new file mode 100644 index 000000000000..3e007d14c1c2 --- /dev/null +++ b/regress/sys/kern/ras/ras2/ras2.c @@ -0,0 +1,56 @@ +#include +#include +#include +#include +#include +#include + +#define COUNT 10 + +__volatile int handled = 0; +__volatile int count = 0; +struct itimerval itv; + +void handler(int); + +void +handler(int sig) +{ + + handled++; +} + +int +main(void) +{ + int rv; + + signal(SIGVTALRM, handler); + + itv.it_interval.tv_sec = 0; + itv.it_interval.tv_usec = 0; + itv.it_value.tv_sec = 10; + itv.it_value.tv_usec = 0; + setitimer(ITIMER_VIRTUAL, &itv, NULL); + + if (rasctl((caddr_t)&&start, (caddr_t)&&end - (caddr_t)&&start, + RAS_INSTALL) < 0) + return (1); + + if (fork() != 0) { + wait(&rv); + return (rv); + } + +start: + count++; + if (count > COUNT) + goto end; + + while (!handled) { + continue; + } +end: + + return (handled != 0); +} diff --git a/regress/sys/kern/ras/ras3/Makefile b/regress/sys/kern/ras/ras3/Makefile new file mode 100644 index 000000000000..021b1dea4874 --- /dev/null +++ b/regress/sys/kern/ras/ras3/Makefile @@ -0,0 +1,14 @@ +# $NetBSD: Makefile,v 1.1 2002/08/28 07:47:27 gmcgarry Exp $ + +PROG= ras3 +NOMAN= #defined +WARNS= 2 + +regress: + @if ./${PROG} ; then \ + echo "PASSED"; \ + else \ + echo "FAILED"; \ + fi + +.include diff --git a/regress/sys/kern/ras/ras3/ras3.c b/regress/sys/kern/ras/ras3/ras3.c new file mode 100644 index 000000000000..f7490070f5cc --- /dev/null +++ b/regress/sys/kern/ras/ras3/ras3.c @@ -0,0 +1,62 @@ +#include +#include +#include +#include +#include +#include + +#define COUNT 10 + +__volatile int handled = 0; +__volatile int count = 0; +struct itimerval itv; + +void handler(int); + +void +handler(int sig) +{ + + handled++; +} + +int +main(int argc, char *argv[]) +{ + int rv; + char *const args[] = { argv[0], "1", NULL }; + + signal(SIGVTALRM, handler); + + itv.it_interval.tv_sec = 0; + itv.it_interval.tv_usec = 0; + itv.it_value.tv_sec = 10; + itv.it_value.tv_usec = 0; + setitimer(ITIMER_VIRTUAL, &itv, NULL); + + if (argc != 2) { + if (rasctl((caddr_t)&&start, (caddr_t)&&end - (caddr_t)&&start, + RAS_INSTALL) < 0) + return (1); + if (fork() != 0) { + wait(&rv); + return (rv == 0); + } + if (execvp(argv[0],args) < 0) { + printf("exec failed\n"); + return (0); + } + } + +start: + count++; + if (count > COUNT) + goto end; + + while (!handled) { + continue; + } +end: + + return (handled != 0); +}