summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgregor herrmann <gregoa@debian.org>2017-07-15 18:34:54 +0200
committerNiels Thykier <niels@thykier.net>2017-07-15 19:17:23 +0000
commit3093ccb0d619bdd9f1fed2e6ec7678ba94da013d (patch)
tree14d77626de5589b75c12ee7f1c7cf462b67a1e42
parentf13b362d4bf704c2e90d485e87d00f072899bfdc (diff)
autopkgtest-pkg-perl: fix smoke test.
autopkgtest-pkg-perl's smoke test fails all over the place because debhelper's testsuite has many assumptions that it is run from the source tree, while autopkgtest-pkg-perl's smoke test copies (by default) the t/ directory to a new empty directory and runs the tests from there. Add debian/tests/pkg-perl/smoke-files to copy more files from the source tree which are used in tests. Add debian/tests/pkg-perl/smoke-skip to skip t/size.t which fails when run under autopkgtest-pkg-perl because it tests all /usr/bin/dh_* helpers, and at least dh_autotools-dev_updateconfig is too large. Change t/buildsystems/03-bs-auto-buildable.t, t/buildsystems/buildsystem_tests.t, t/override_target.t, t/size.t, and t/syntax/syntax-progs.t to look for scripts and modules not in the source tree but in the installed directories when run under autopkgtest. With these changes, the test suite passes both during build and during autokpkgtest. Signed-off-by: Niels Thykier <niels@thykier.net>
-rw-r--r--debian/tests/pkg-perl/smoke-files4
-rw-r--r--debian/tests/pkg-perl/smoke-skip5
-rwxr-xr-xt/buildsystems/03-bs-auto-buildable.t4
-rwxr-xr-xt/buildsystems/buildsystem_tests.t2
-rwxr-xr-xt/override_target.t3
-rwxr-xr-xt/size.t3
-rwxr-xr-xt/syntax/syntax-progs.t8
7 files changed, 23 insertions, 6 deletions
diff --git a/debian/tests/pkg-perl/smoke-files b/debian/tests/pkg-perl/smoke-files
new file mode 100644
index 00000000..2a0aeddb
--- /dev/null
+++ b/debian/tests/pkg-perl/smoke-files
@@ -0,0 +1,4 @@
+t/
+debian/compat
+debian/control
+debian/changelog
diff --git a/debian/tests/pkg-perl/smoke-skip b/debian/tests/pkg-perl/smoke-skip
new file mode 100644
index 00000000..c006e7ab
--- /dev/null
+++ b/debian/tests/pkg-perl/smoke-skip
@@ -0,0 +1,5 @@
+# If we set the path to /usr/bin when run under autopkgtest,
+# other dh_* commands are tested as well. This might be nice
+# or not but it currently fails for dh_autotools-dev_updateconfig.
+# So let's skip t/size.t for now.
+t/size.t
diff --git a/t/buildsystems/03-bs-auto-buildable.t b/t/buildsystems/03-bs-auto-buildable.t
index 77845ced..b2c82e26 100755
--- a/t/buildsystems/03-bs-auto-buildable.t
+++ b/t/buildsystems/03-bs-auto-buildable.t
@@ -59,7 +59,9 @@ my %options = (
'sourcedir' => $sourcedir,
);
make_path($sourcedir, $builddir);
-my @bs = load_all_buildsystems([ $Test::DH::ROOT_DIR ], %options);
+use Config;
+my $libpath = $ENV{AUTOPKGTEST_TMP} ? $Config{vendorlib} : $Test::DH::ROOT_DIR;
+my @bs = load_all_buildsystems([ $libpath ], %options);
my %bs;
my @names = map { $_->NAME() } @bs;
diff --git a/t/buildsystems/buildsystem_tests.t b/t/buildsystems/buildsystem_tests.t
index aae80877..ac39b6d9 100755
--- a/t/buildsystems/buildsystem_tests.t
+++ b/t/buildsystems/buildsystem_tests.t
@@ -17,7 +17,7 @@ use_ok( 'Debian::Debhelper::Dh_Lib' );
use_ok( 'Debian::Debhelper::Buildsystem' );
use_ok( 'Debian::Debhelper::Dh_Buildsystems' );
-my $TOPDIR = "../..";
+my $TOPDIR = $ENV{AUTOPKGTEST_TMP} ? '/usr/bin' : '../..';
my @STEPS = qw(configure build test install clean);
my $BS_CLASS = 'Debian::Debhelper::Buildsystem';
diff --git a/t/override_target.t b/t/override_target.t
index b56c9862..2ef0baa3 100755
--- a/t/override_target.t
+++ b/t/override_target.t
@@ -8,10 +8,11 @@ plan(tests => 1);
system("mkdir -p t/tmp/debian");
system("cp debian/control debian/compat debian/changelog t/tmp/debian");
open (OUT, ">", "t/tmp/debian/rules") || die "$!";
+my $binpath = $ENV{AUTOPKGTEST_TMP} ? '/usr/bin' : '../..';
print OUT <<EOF;
#!/usr/bin/make -f
%:
- PATH=../..:\$\$PATH PERL5LIB=../.. ../../dh \$@ --without autoreconf
+ PATH=../..:\$\$PATH PERL5LIB=../.. $binpath/dh \$@ --without autoreconf
override_dh_update_autotools_config override_dh_strip_nondeterminism:
diff --git a/t/size.t b/t/size.t
index 79564af8..5a16db43 100755
--- a/t/size.t
+++ b/t/size.t
@@ -7,7 +7,8 @@ use strict;
use warnings;
use Test::More;
-my @progs=grep { -x $_ } glob("dh_*");
+my $binpath = $ENV{AUTOPKGTEST_TMP} ? '/usr/bin' : '.';
+my @progs=grep { -x $_ } glob("$binpath/dh_*");
plan(tests => (@progs + @progs));
diff --git a/t/syntax/syntax-progs.t b/t/syntax/syntax-progs.t
index 0dbdb2a2..0317c6e2 100755
--- a/t/syntax/syntax-progs.t
+++ b/t/syntax/syntax-progs.t
@@ -8,11 +8,15 @@ use lib dirname(dirname(__FILE__));
# Need Test::More to set PERL5LIB
use Test::DH;
+use Config;
+my $binpath = $ENV{AUTOPKGTEST_TMP} ? '/usr/bin' : '.';
+my $libpath = $ENV{AUTOPKGTEST_TMP} ? $Config{vendorlib} : '.';
+
my @targets;
if ($0 =~ m{syntax-progs\.t$}) {
- @targets = grep { -x $_ } glob("dh_*"), "dh";
+ @targets = grep { -x $_ } glob("$binpath/dh_*"), "$binpath/dh";
} else {
- @targets = (glob("Debian/Debhelper/*.pm"), glob("Debian/Debhelper/*/*.pm"));
+ @targets = (glob("$libpath/Debian/Debhelper/*.pm"), glob("$libpath/Debian/Debhelper/*/*.pm"));
}
plan(tests => scalar(@targets));