summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2009-11-14 09:34:57 +0000
committerMarc Espie <espie@cvs.openbsd.org>2009-11-14 09:34:57 +0000
commit1f851e3f878a1cd0b1c3272b603d55122e5da350 (patch)
treeb1b9117083b2dfdea39c76e3c256858a9bc3b3d0
parentff0e78f68df5bb5c52b0aa72d7886ba7cbe12d59 (diff)
fix regress test (needs -F downgrade to be able to go back)
Introduce two scripts to make it easier to write a "full" scaffolding for further tests, to be used soonish...
-rw-r--r--regress/usr.sbin/pkg_add/Makefile42
-rw-r--r--regress/usr.sbin/pkg_add/mycreate47
2 files changed, 58 insertions, 31 deletions
diff --git a/regress/usr.sbin/pkg_add/Makefile b/regress/usr.sbin/pkg_add/Makefile
index c2c5bea8fa0..b1f2e404c5e 100644
--- a/regress/usr.sbin/pkg_add/Makefile
+++ b/regress/usr.sbin/pkg_add/Makefile
@@ -1,50 +1,30 @@
-# $OpenBSD: Makefile,v 1.3 2006/08/18 13:14:34 espie Exp $
+# $OpenBSD: Makefile,v 1.4 2009/11/14 09:34:56 espie Exp $
REGRESS_TARGETS=pkgnames depends-check
+PKG_ADD=perl ${.CURDIR}/myadd
+PKG_CREATE=perl ${.CURDIR}/mycreate
+
pkgnames:
perl ${.CURDIR}/check-name
depends-check: old/a-0.0.tgz old/b-0.0.tgz new/a-1.0.tgz new/b-1.0.tgz
-rm -rf ${.OBJDIR}/depends
- -mkdir -p ${.OBJDIR}/depends/pkgdb
- PKG_DBDIR=${.OBJDIR}/depends/pkgdb pkg_add -F nonroot -B${.OBJDIR}/depends old/a-0.0.tgz old/b-0.0.tgz
- PKG_DBDIR=${.OBJDIR}/depends/pkgdb PKG_PATH=${.OBJDIR}/new pkg_add -F nonroot -B${.OBJDIR}/depends -u a b
- PKG_DBDIR=${.OBJDIR}/depends/pkgdb PKG_PATH=${.OBJDIR}/old pkg_add -F nonroot -B${.OBJDIR}/depends -u a b
+ ROOT=${.OBJDIR}/depends ${PKG_ADD} old/a-0.0.tgz old/b-0.0.tgz
+ ROOT=${.OBJDIR}/depends PKG_PATH=${.OBJDIR}/new ${PKG_ADD} -u a b
+ ROOT=${.OBJDIR}/depends PKG_PATH=${.OBJDIR}/old ${PKG_ADD} -F downgrade -u a b
old/a-0.0.tgz:
- -mkdir -p ${@D}
- pkg_create -p /usr/local -A \* \
- -DFULLPKGPATH=test/a \
- -DPERMIT_PACKAGE_FTP=Yes \
- -DPERMIT_PACKAGE_CDROM=Yes \
- -P'test/b:b-*:b-0.0' \
- -c '-comment' -d '-descr' -f ${.CURDIR}/empty $@
+ ${PKG_CREATE} -P'test/b:b-*:b-0.0' -f ${.CURDIR}/empty $@
new/a-1.0.tgz:
- -mkdir -p ${@D}
- pkg_create -p /usr/local -A \* \
- -DFULLPKGPATH=test/a \
- -DPERMIT_PACKAGE_FTP=Yes \
- -DPERMIT_PACKAGE_CDROM=Yes \
- -c '-comment' -d '-descr' -f ${.CURDIR}/empty $@
+ ${PKG_CREATE} -f ${.CURDIR}/empty $@
old/b-0.0.tgz:
- -mkdir -p ${@D}
- pkg_create -p /usr/local -A \* \
- -DFULLPKGPATH=test/a \
- -DPERMIT_PACKAGE_FTP=Yes \
- -DPERMIT_PACKAGE_CDROM=Yes \
- -c '-comment' -d '-descr' -f ${.CURDIR}/empty $@
+ ${PKG_CREATE} -f ${.CURDIR}/empty $@
new/b-1.0.tgz:
- -mkdir -p ${@D}
- pkg_create -p /usr/local -A \* \
- -DFULLPKGPATH=test/a \
- -DPERMIT_PACKAGE_FTP=Yes \
- -DPERMIT_PACKAGE_CDROM=Yes \
- -P'test/a:a-*:a-1.0' \
- -c '-comment' -d '-descr' -f ${.CURDIR}/empty $@
+ ${PKG_CREATE} -P'test/a:a-*:a-1.0' -f ${.CURDIR}/empty $@
.PHONY: pkgnames depends-check
diff --git a/regress/usr.sbin/pkg_add/mycreate b/regress/usr.sbin/pkg_add/mycreate
new file mode 100644
index 00000000000..b16bee26206
--- /dev/null
+++ b/regress/usr.sbin/pkg_add/mycreate
@@ -0,0 +1,47 @@
+#! /usr/bin/perl
+
+# ex:ts=8 sw=4:
+# $OpenBSD: mycreate,v 1.1 2009/11/14 09:34:56 espie Exp $
+#
+# Copyright (c) 2009 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
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+use strict;
+use warnings;
+use File::Basename;
+use File::Path;
+use OpenBSD::PackageName;
+
+my $target = pop @ARGV;
+my $basename = basename($target, '.tgz');
+File::Path::make_path(dirname($target));
+my $pkgname = OpenBSD::PackageName->from_string($basename);
+my $pkgpath = $ENV{'PACKAGE_PATH'};
+if (!defined $pkgpath) {
+ $pkgpath = 'test/'.$pkgname->{stem};
+}
+
+my @l;
+push(@l,
+ '-p', $ENV{'PACKAGE_BASE'} || '/usr/local',
+ '-DPERMIT_PACKAGE_CDROM='.($ENV{'PACKAGE_CDROM'} || 'Yes'),
+ '-DPERMIT_PACKAGE_FTP='.($ENV{'PACKAGE_FTP'} || 'Yes'),
+ "-DFULLPKGPATH=$pkgpath",
+ '-c', $ENV{'PACKAGE_COMMENT'} || '-comment',
+ '-d', $ENV{'PACKAGE_DESCR'} || '-descr',
+ '-A', $ENV{'PACKAGE_ARCH'} || '*');
+
+
+my @args = ('pkg_create', @l, @ARGV, $target);
+print join(' ', @args), "\n" if $ENV{'VERBOSE'};
+exec {'pkg_create'} @args;