summaryrefslogtreecommitdiff
path: root/regress/sys/kern
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1995-10-18 08:53:40 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1995-10-18 08:53:40 +0000
commitd6583bb2a13f329cf0332ef2570eb8bb8fc0e39c (patch)
treeece253b876159b39c620e62b6c9b1174642e070e /regress/sys/kern
initial import of NetBSD tree
Diffstat (limited to 'regress/sys/kern')
-rw-r--r--regress/sys/kern/Makefile9
-rw-r--r--regress/sys/kern/execve/Makefile60
-rw-r--r--regress/sys/kern/execve/doexec.c52
-rw-r--r--regress/sys/kern/execve/good/badinterplen1
-rw-r--r--regress/sys/kern/execve/good/devnullscript1
-rw-r--r--regress/sys/kern/execve/good/empty1
-rw-r--r--regress/sys/kern/execve/good/goodaout1
-rw-r--r--regress/sys/kern/execve/good/goodscript1
-rw-r--r--regress/sys/kern/execve/good/nonexistent1
-rw-r--r--regress/sys/kern/execve/good/nonexistshell1
-rw-r--r--regress/sys/kern/execve/good/scriptarg2
-rw-r--r--regress/sys/kern/execve/good/scriptarg-nospace2
-rw-r--r--regress/sys/kern/execve/good/truncaout1
-rw-r--r--regress/sys/kern/execve/tests/badinterplen3
-rw-r--r--regress/sys/kern/execve/tests/devnullscript3
-rw-r--r--regress/sys/kern/execve/tests/empty0
-rw-r--r--regress/sys/kern/execve/tests/goodaout.c43
-rw-r--r--regress/sys/kern/execve/tests/goodscript3
-rw-r--r--regress/sys/kern/execve/tests/nonexistshell3
-rw-r--r--regress/sys/kern/execve/tests/scriptarg3
-rw-r--r--regress/sys/kern/execve/tests/scriptarg-nospace3
21 files changed, 194 insertions, 0 deletions
diff --git a/regress/sys/kern/Makefile b/regress/sys/kern/Makefile
new file mode 100644
index 00000000000..07b1104b15a
--- /dev/null
+++ b/regress/sys/kern/Makefile
@@ -0,0 +1,9 @@
+# $NetBSD: Makefile,v 1.2 1995/04/20 22:42:51 cgd Exp $
+
+SUBDIR+= execve
+
+regress: _SUBDIRUSE
+
+install:
+
+.include <bsd.subdir.mk>
diff --git a/regress/sys/kern/execve/Makefile b/regress/sys/kern/execve/Makefile
new file mode 100644
index 00000000000..e11439cca18
--- /dev/null
+++ b/regress/sys/kern/execve/Makefile
@@ -0,0 +1,60 @@
+# $NetBSD: Makefile,v 1.4 1995/04/20 22:43:03 cgd Exp $
+
+PROG= doexec
+NOMAN= noman, no way, man
+
+LDSTATIC= -static
+
+RP= ${.OBJDIR}/${PROG}
+TD= ${.CURDIR}/tests
+OD= ${.CURDIR}/good
+
+all: ${PROG} goodaout truncaout
+CLEANFILES+= goodaout truncaout
+
+install:
+
+regress: test-empty test-nonexist \
+ test-nonexistshell test-devnullscript test-badinterplen \
+ test-goodscript test-scriptarg test-scriptarg-nospace \
+ test-goodaout test-truncaout
+
+test-empty: ${PROG} ${TD}/empty
+ ${RP} ${TD}/empty | diff - ${OD}/empty
+
+test-nonexist: ${PROG}
+ ${RP} ${TD}/nonexistent | diff - ${OD}/nonexistent
+
+test-nonexistshell: ${PROG} ${TD}/nonexistshell
+ ${RP} ${TD}/nonexistshell | diff - ${OD}/nonexistshell
+
+test-devnullscript: ${PROG} ${TD}/devnullscript
+ ${RP} ${TD}/devnullscript | diff - ${OD}/devnullscript
+
+test-badinterplen: ${PROG} ${TD}/badinterplen
+ ${RP} ${TD}/badinterplen | diff - ${OD}/badinterplen
+
+test-goodscript: ${PROG} ${TD}/goodscript
+ ${RP} ${TD}/goodscript | diff - ${OD}/goodscript
+
+test-scriptarg: ${PROG} ${TD}/scriptarg
+ ${RP} ${TD}/scriptarg 2>&1 | diff - ${OD}/scriptarg
+
+test-scriptarg-nospace: ${PROG} ${TD}/scriptarg-nospace
+ ${RP} ${TD}/scriptarg-nospace 2>&1 | diff - ${OD}/scriptarg-nospace
+
+goodaout: ${TD}/goodaout.c
+ ${LINK.c} ${LDSTATIC} -o ${.TARGET} ${TD}/goodaout.c ${LDLIBS}
+
+test-goodaout: ${PROG} goodaout
+ ${RP} ${.OBJDIR}/goodaout | diff - ${OD}/goodaout
+
+truncaout: goodaout
+ /bin/rm -rf truncaout
+ dd if=${.OBJDIR}/goodaout of=truncaout bs=16 count=1
+ chmod a+x truncaout
+
+test-truncaout: ${PROG} truncaout
+ ${RP} ${.OBJDIR}/truncaout | diff - ${OD}/truncaout
+
+.include <bsd.prog.mk>
diff --git a/regress/sys/kern/execve/doexec.c b/regress/sys/kern/execve/doexec.c
new file mode 100644
index 00000000000..6ea31d5a636
--- /dev/null
+++ b/regress/sys/kern/execve/doexec.c
@@ -0,0 +1,52 @@
+/* $NetBSD: doexec.c,v 1.3 1995/04/20 22:43:13 cgd Exp $ */
+
+/*
+ * Copyright (c) 1993 Christopher G. Demetriou
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Christopher G. Demetriou.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+int
+main(argc, argv)
+ int argc;
+ char *argv[];
+{
+ if (argc != 2) {
+ fprintf(stderr, "usage: %s <progname>\n", argv[0]);
+ exit(2);
+ }
+
+ if (execve(argv[1], &argv[1], NULL) == -1) {
+ printf("%s\n", strerror(errno));
+ exit(1);
+ }
+}
diff --git a/regress/sys/kern/execve/good/badinterplen b/regress/sys/kern/execve/good/badinterplen
new file mode 100644
index 00000000000..a0f8bc9fa2e
--- /dev/null
+++ b/regress/sys/kern/execve/good/badinterplen
@@ -0,0 +1 @@
+Exec format error
diff --git a/regress/sys/kern/execve/good/devnullscript b/regress/sys/kern/execve/good/devnullscript
new file mode 100644
index 00000000000..fd58f1d4fad
--- /dev/null
+++ b/regress/sys/kern/execve/good/devnullscript
@@ -0,0 +1 @@
+Permission denied
diff --git a/regress/sys/kern/execve/good/empty b/regress/sys/kern/execve/good/empty
new file mode 100644
index 00000000000..a0f8bc9fa2e
--- /dev/null
+++ b/regress/sys/kern/execve/good/empty
@@ -0,0 +1 @@
+Exec format error
diff --git a/regress/sys/kern/execve/good/goodaout b/regress/sys/kern/execve/good/goodaout
new file mode 100644
index 00000000000..774a5c0df4b
--- /dev/null
+++ b/regress/sys/kern/execve/good/goodaout
@@ -0,0 +1 @@
+succeeded
diff --git a/regress/sys/kern/execve/good/goodscript b/regress/sys/kern/execve/good/goodscript
new file mode 100644
index 00000000000..774a5c0df4b
--- /dev/null
+++ b/regress/sys/kern/execve/good/goodscript
@@ -0,0 +1 @@
+succeeded
diff --git a/regress/sys/kern/execve/good/nonexistent b/regress/sys/kern/execve/good/nonexistent
new file mode 100644
index 00000000000..ddc886910ed
--- /dev/null
+++ b/regress/sys/kern/execve/good/nonexistent
@@ -0,0 +1 @@
+No such file or directory
diff --git a/regress/sys/kern/execve/good/nonexistshell b/regress/sys/kern/execve/good/nonexistshell
new file mode 100644
index 00000000000..ddc886910ed
--- /dev/null
+++ b/regress/sys/kern/execve/good/nonexistshell
@@ -0,0 +1 @@
+No such file or directory
diff --git a/regress/sys/kern/execve/good/scriptarg b/regress/sys/kern/execve/good/scriptarg
new file mode 100644
index 00000000000..f3b372c72fe
--- /dev/null
+++ b/regress/sys/kern/execve/good/scriptarg
@@ -0,0 +1,2 @@
++ echo succeeded
+succeeded
diff --git a/regress/sys/kern/execve/good/scriptarg-nospace b/regress/sys/kern/execve/good/scriptarg-nospace
new file mode 100644
index 00000000000..f3b372c72fe
--- /dev/null
+++ b/regress/sys/kern/execve/good/scriptarg-nospace
@@ -0,0 +1,2 @@
++ echo succeeded
+succeeded
diff --git a/regress/sys/kern/execve/good/truncaout b/regress/sys/kern/execve/good/truncaout
new file mode 100644
index 00000000000..a0f8bc9fa2e
--- /dev/null
+++ b/regress/sys/kern/execve/good/truncaout
@@ -0,0 +1 @@
+Exec format error
diff --git a/regress/sys/kern/execve/tests/badinterplen b/regress/sys/kern/execve/tests/badinterplen
new file mode 100644
index 00000000000..1b3a2e4e5b9
--- /dev/null
+++ b/regress/sys/kern/execve/tests/badinterplen
@@ -0,0 +1,3 @@
+#! 456789012345678 0123456789012345 789012345678 012345678901234
+
+echo succeeded
diff --git a/regress/sys/kern/execve/tests/devnullscript b/regress/sys/kern/execve/tests/devnullscript
new file mode 100644
index 00000000000..d23f9901f20
--- /dev/null
+++ b/regress/sys/kern/execve/tests/devnullscript
@@ -0,0 +1,3 @@
+#! /dev/null
+
+echo succeeded
diff --git a/regress/sys/kern/execve/tests/empty b/regress/sys/kern/execve/tests/empty
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/regress/sys/kern/execve/tests/empty
diff --git a/regress/sys/kern/execve/tests/goodaout.c b/regress/sys/kern/execve/tests/goodaout.c
new file mode 100644
index 00000000000..d815a3cebe1
--- /dev/null
+++ b/regress/sys/kern/execve/tests/goodaout.c
@@ -0,0 +1,43 @@
+/* $NetBSD: goodaout.c,v 1.3 1995/04/20 22:44:20 cgd Exp $ */
+
+/*
+ * Copyright (c) 1993 Christopher G. Demetriou
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Christopher G. Demetriou.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+
+int
+main(argc, argv)
+ int argc;
+ char *argv[];
+{
+ printf("succeeded\n");
+ exit(0);
+}
diff --git a/regress/sys/kern/execve/tests/goodscript b/regress/sys/kern/execve/tests/goodscript
new file mode 100644
index 00000000000..6dc23b2ca72
--- /dev/null
+++ b/regress/sys/kern/execve/tests/goodscript
@@ -0,0 +1,3 @@
+#! /bin/csh
+
+echo succeeded
diff --git a/regress/sys/kern/execve/tests/nonexistshell b/regress/sys/kern/execve/tests/nonexistshell
new file mode 100644
index 00000000000..d00bd83e9f1
--- /dev/null
+++ b/regress/sys/kern/execve/tests/nonexistshell
@@ -0,0 +1,3 @@
+#! /foo/bar/baz
+
+echo foo
diff --git a/regress/sys/kern/execve/tests/scriptarg b/regress/sys/kern/execve/tests/scriptarg
new file mode 100644
index 00000000000..d0e38ae8d74
--- /dev/null
+++ b/regress/sys/kern/execve/tests/scriptarg
@@ -0,0 +1,3 @@
+#! /bin/sh -x
+
+echo succeeded
diff --git a/regress/sys/kern/execve/tests/scriptarg-nospace b/regress/sys/kern/execve/tests/scriptarg-nospace
new file mode 100644
index 00000000000..15def094282
--- /dev/null
+++ b/regress/sys/kern/execve/tests/scriptarg-nospace
@@ -0,0 +1,3 @@
+#!/bin/sh -x
+
+echo succeeded