summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regress/usr.sbin/pkg_add/Makefile19
-rw-r--r--regress/usr.sbin/pkg_add/list10.out2
-rw-r--r--regress/usr.sbin/pkg_add/list11.out4
-rw-r--r--regress/usr.sbin/pkg_add/list9.out2
-rw-r--r--regress/usr.sbin/pkg_add/my (renamed from regress/usr.sbin/pkg_add/myadd)26
5 files changed, 33 insertions, 20 deletions
diff --git a/regress/usr.sbin/pkg_add/Makefile b/regress/usr.sbin/pkg_add/Makefile
index d4b09dd84b7..af4971be22d 100644
--- a/regress/usr.sbin/pkg_add/Makefile
+++ b/regress/usr.sbin/pkg_add/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.46 2011/07/12 23:33:42 espie Exp $
+# $OpenBSD: Makefile,v 1.47 2011/07/13 11:57:10 espie Exp $
REGRESS_TARGETS=pkgnames pkgpaths signatures depends-check longnames \
update-check1 \
@@ -6,11 +6,13 @@ REGRESS_TARGETS=pkgnames pkgpaths signatures depends-check longnames \
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 inter1
+ qttest gstest exotest inter1 manual1
-ADD_PKG=perl ${.CURDIR}/myadd
+ADD_PKG=perl ${.CURDIR}/my add
+DELETE_PKG=perl ${.CURDIR}/my delete
+INFO_PKG=perl ${.CURDIR}/my info
CREATE_PKG=perl ${.CURDIR}/mycreate
LONG1=iamareallongfilenamethatcantberepresentedcorrectlyinatararchivebutwewantittohappenanywaysohmygodaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa42
LONG2=iamanotherreallygfilenamethatcantberepresentedcorrectlyinatararchivebutwewantittohappenanywaysohmygodaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa42
@@ -203,17 +205,16 @@ manual1: rep0/ma-0.tgz rep0/mb-0.tgz rep0/mc-0.tgz rep0/md-0.tgz \
rep1/ma-1.tgz rep1/mb-1.tgz rep1/me-1.tgz rep1/md-1.tgz
@-rm -rf ${D30}
@ROOT=${D30} PKG_PATH=${.OBJDIR}/rep0 ${ADD_PKG} md mb
- PKG_DBDIR=${D30}/pkgdb pkg_info -m
+ @ROOT=${D30} ${INFO_PKG} -mq|diff -u - ${.CURDIR}/list9.out
@ROOT=${D30} PKG_PATH=${.OBJDIR}/rep1 ${ADD_PKG} -u
- @PKG_DBDIR=${D30}/pkgdb pkg_info -m
- PKG_DBDIR=${D30}/pkgdb pkg_delete -Dnonroot -B ${D30} -a
- @PKG_DBDIR=${D30}/pkgdb pkg_info
+ @ROOT=${D30} ${INFO_PKG} -mq|diff -u - ${.CURDIR}/list10.out
+ @ROOT=${D30} ${DELETE_PKG} -a
+ @ROOT=${D30} ${INFO_PKG} -q|diff -u - ${.CURDIR}/list11.out
inter1: rep0/inta-0.tgz rep0/intb-0.tgz
-rm -rf ${D31}
@ROOT=${D31} PKG_PATH=${.OBJDIR}/rep0 ${ADD_PKG} inta intb
- @PKG_DBDIR=${D31}/pkgdb pkg_delete -Dnonroot -B ${D30} inta intb
-
+ @ROOT=${D31} ${DELETE_PKG} inta intb
plist1:
@echo "@owner "`id -un` >$@
diff --git a/regress/usr.sbin/pkg_add/list10.out b/regress/usr.sbin/pkg_add/list10.out
new file mode 100644
index 00000000000..f857c9588c9
--- /dev/null
+++ b/regress/usr.sbin/pkg_add/list10.out
@@ -0,0 +1,2 @@
+mb-1
+md-1
diff --git a/regress/usr.sbin/pkg_add/list11.out b/regress/usr.sbin/pkg_add/list11.out
new file mode 100644
index 00000000000..300c6ca53d9
--- /dev/null
+++ b/regress/usr.sbin/pkg_add/list11.out
@@ -0,0 +1,4 @@
+ma-1
+mb-1
+md-1
+me-1
diff --git a/regress/usr.sbin/pkg_add/list9.out b/regress/usr.sbin/pkg_add/list9.out
new file mode 100644
index 00000000000..4a8e5cbfa97
--- /dev/null
+++ b/regress/usr.sbin/pkg_add/list9.out
@@ -0,0 +1,2 @@
+mb-0
+md-0
diff --git a/regress/usr.sbin/pkg_add/myadd b/regress/usr.sbin/pkg_add/my
index 470b03b78ad..b1712039538 100644
--- a/regress/usr.sbin/pkg_add/myadd
+++ b/regress/usr.sbin/pkg_add/my
@@ -1,9 +1,9 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: myadd,v 1.4 2011/07/12 23:17:21 espie Exp $
+# $OpenBSD: my,v 1.1 2011/07/13 11:57:10 espie Exp $
#
-# Copyright (c) 2009 Marc Espie <espie@openbsd.org>
+# Copyright (c) 2011 Marc Espie <espie@openbsd.org>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@@ -25,17 +25,21 @@ my $root = $ENV{'ROOT'};
File::Path::make_path("$root/pkgdb");
$ENV{'PKG_DBDIR'} = "$root/pkgdb";
+my $prog = "pkg_".(shift @ARGV);
+my $run;
-my @args = ('-D', 'nonroot', '-B', $root, @ARGV);
-my $prog;
+my @args = ('-D', 'nonroot', @ARGV);
+if ($prog ne 'pkg_info') {
+ unshift(@args, '-B', $root);
+}
if ($ENV{'DEBUG'}) {
- unshift(@args, 'perl', '-d', '/usr/sbin/pkg_add', '-D', 'debug');
- $prog = 'perl';
+ unshift(@args, 'perl', '-d', "/usr/sbin/$prog", '-D', 'debug');
+ $run = 'perl';
} else {
- unshift(@args, 'pkg_add');
- $prog = 'pkg_add';
+ unshift(@args, $prog);
+ $run = $prog;
}
-print join(' ', "pkg_add", @ARGV), "\n" unless $ENV{'SILENT'} || $ENV{'VERBOSE'};
-print join(' ', @args), "\n" if $ENV{'VERBOSE'};
+print STDERR join(' ', $prog, @ARGV), "\n" unless $ENV{'SILENT'} || $ENV{'VERBOSE'};
+print join(' ', $run, @args), "\n" if $ENV{'VERBOSE'};
-exec {$prog} @args;
+exec {$run} @args;