summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2018-06-06 10:33:08 +0000
committerMarc Espie <espie@cvs.openbsd.org>2018-06-06 10:33:08 +0000
commit058013acccd1567262ca108126dc77b48ee9ca9a (patch)
tree5b6b9966ddce6640d74ab63d31bae63279edaec6
parent6e27fda0926f61fb1fe108eabad185b22f2250e1 (diff)
add non-regression tests for bad user list files
-rw-r--r--regress/usr.sbin/pkg_add/Makefile28
-rw-r--r--regress/usr.sbin/pkg_add/baduser14
-rw-r--r--regress/usr.sbin/pkg_add/baduser212
-rw-r--r--regress/usr.sbin/pkg_add/baduser312
4 files changed, 54 insertions, 2 deletions
diff --git a/regress/usr.sbin/pkg_add/Makefile b/regress/usr.sbin/pkg_add/Makefile
index 2ddaf3f8c11..3ef603d6beb 100644
--- a/regress/usr.sbin/pkg_add/Makefile
+++ b/regress/usr.sbin/pkg_add/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.53 2017/07/12 15:21:12 bluhm Exp $
+# $OpenBSD: Makefile,v 1.54 2018/06/06 10:33:07 espie Exp $
REGRESS_TARGETS=pkgnames pkgpaths signatures depends-check longnames pkgcfl \
collision-check1-disabled collision-check2-disabled collision-check3 \
@@ -8,7 +8,8 @@ REGRESS_TARGETS=pkgnames pkgpaths signatures depends-check longnames pkgcfl \
merge-update split-update big-merge family-circus missing \
lib-report1 lib-report2 lib-report3 loop1 \
lib-report4 lib-report5 lib-report6 lib-report7 \
- qttest gstest exotest-disabled inter1 manual1 oldlib1
+ qttest gstest exotest-disabled inter1 manual1 oldlib1 \
+ usertest-1 usertest-2 usertest-3
collision-check{1,2}-disabled:
@! ${MAKE} -C ${.CURDIR} ${@:S/-disabled$//}
@@ -643,6 +644,29 @@ rep1/ol-1.tgz: plist21
@touch ${SRC23}/lib/subdir/libol.so.1.0
@${CREATE_PKG} -B src23 -DLIBol_VERSION=1.0 -f plist21 $@
+usertest-1:
+ @if ${CREATE_PKG} -u ${.CURDIR}/baduser1 \
+ -f ${.CURDIR}/empty truc-0.tgz; then \
+ exit 1; \
+ else \
+ exit 0; \
+ fi
+
+usertest-2:
+ @if ${CREATE_PKG} -u ${.CURDIR}/baduser2 \
+ -f ${.CURDIR}/empty truc-0.tgz; then \
+ exit 1; \
+ else \
+ exit 0; \
+ fi
+
+usertest-3:
+ @if ${CREATE_PKG} -u ${.CURDIR}/baduser3 \
+ -f ${.CURDIR}/empty truc-0.tgz; then \
+ exit 1; \
+ else \
+ exit 0; \
+ fi
keys:
mkdir signify
signify -G -n -s signify/test-pkg.sec -p signify/test-pkg.pub
diff --git a/regress/usr.sbin/pkg_add/baduser1 b/regress/usr.sbin/pkg_add/baduser1
new file mode 100644
index 00000000000..23c8f3ceba2
--- /dev/null
+++ b/regress/usr.sbin/pkg_add/baduser1
@@ -0,0 +1,4 @@
+$OpenBSD: baduser1,v 1.1 2018/06/06 10:33:07 espie Exp $
+This is a bad user list without any
+"------"
+marker
diff --git a/regress/usr.sbin/pkg_add/baduser2 b/regress/usr.sbin/pkg_add/baduser2
new file mode 100644
index 00000000000..5204765a310
--- /dev/null
+++ b/regress/usr.sbin/pkg_add/baduser2
@@ -0,0 +1,12 @@
+$OpenBSD: baduser2,v 1.1 2018/06/06 10:33:07 espie Exp $
+
+
+id user group port options
+----------------------------------------------------
+500 _opennap _opennap audio/opennap
+501 _gnats databases/gnats
+502 _mysql _mysql databases/mariadb,-server
+503 _postgresql _postgresql databases/postgresql,-server
+504 _mailman _mailman mail/mailman
+insert random line here
+506 _spamdaemon _spamdaemon mail/p5-Mail-SpamAssassin
diff --git a/regress/usr.sbin/pkg_add/baduser3 b/regress/usr.sbin/pkg_add/baduser3
new file mode 100644
index 00000000000..5f89808da31
--- /dev/null
+++ b/regress/usr.sbin/pkg_add/baduser3
@@ -0,0 +1,12 @@
+$OpenBSD: baduser3,v 1.1 2018/06/06 10:33:07 espie Exp $
+
+
+id user group port options
+----------------------------------------------------
+500 _opennap _opennap audio/opennap
+501 _gnats databases/gnats
+502 _mysql _mysql databases/mariadb,-server
+503 _postgresql _postgresql databases/postgresql,-server
+504 _mailman _mailman mail/mailman
+# duplicate id
+501 _spamdaemon _spamdaemon mail/p5-Mail-SpamAssassin