This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=cb66cd75afdbcb3b38453fba41e5a17df4b9ef3f commit cb66cd75afdbcb3b38453fba41e5a17df4b9ef3f Author: Guillem Jover <[email protected]> AuthorDate: Sat Dec 4 06:01:35 2021 +0100 build: Split the test-runner into its own script Having so much perl logic in an automake file is cumbersome. Use a proper program to implement this. --- Makefile.am | 1 + build-aux/tap.am | 24 ++++-------------------- build-aux/test-runner | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 20 deletions(-) diff --git a/Makefile.am b/Makefile.am index 3d2b77b71..989861960 100644 --- a/Makefile.am +++ b/Makefile.am @@ -61,6 +61,7 @@ EXTRA_DIST = \ build-aux/get-version \ build-aux/lcov-inject \ build-aux/run-script \ + build-aux/test-runner \ doc/coding-style.txt \ debian/README.bug-usertags \ debian/bug-script \ diff --git a/build-aux/tap.am b/build-aux/tap.am index 7e600e567..8a713c3eb 100644 --- a/build-aux/tap.am +++ b/build-aux/tap.am @@ -12,36 +12,20 @@ TEST_VERBOSE ?= 0 TEST_PARALLEL ?= 1 -TEST_RUNNER = '\ - my $$harness = TAP::Harness->new({ \ - exec => sub { my (undef, $$test) = @_; \ - return [ $$test ] if $$test !~ "\.t\$$" and -x $$test; \ - return }, \ - lib => [ "$(top_srcdir)/scripts", "$(top_srcdir)/dselect/methods" ], \ - color => 1, \ - verbosity => $(TEST_VERBOSE), \ - jobs => $(TEST_PARALLEL), \ - failures => 1, \ - }); \ - my $$aggregate = $$harness->runtests(@ARGV); \ - die "FAIL: test suite has errors\n" if $$aggregate->has_errors;' - tap-clean: [ -z "$(test_tmpdir)" ] || rm -fr $(test_tmpdir) tap-check: $(test_data) $(test_programs) $(test_scripts) [ -z "$(test_tmpdir)" ] || $(MKDIR_P) $(test_tmpdir) - PATH="$(abs_top_builddir)/src:$(abs_top_builddir)/scripts:$(abs_top_builddir)/utils:$(PATH)" \ - LC_ALL=C \ - DPKG_COLORS=never \ $(TEST_ENV_VARS) \ + abs_top_srcdir=$(abs_top_srcdir) \ + abs_top_builddir=$(abs_top_builddir) \ srcdir=$(srcdir) builddir=$(builddir) \ CC=$(CC) \ - PERL=$(PERL) \ SHELL=$(SHELL) \ + PERL=$(PERL) \ PERL_DL_NONLAZY=1 \ - PERL5LIB=$(abs_top_srcdir)/scripts:$(abs_top_srcdir)/dselect/methods \ PERL5OPT=$(TEST_COVERAGE) \ - $(PERL) -MTAP::Harness -e $(TEST_RUNNER) \ + $(PERL) $(top_srcdir)/build-aux/test-runner \ $(addprefix $(builddir)/,$(test_programs)) \ $(addprefix $(srcdir)/,$(test_scripts)) diff --git a/build-aux/test-runner b/build-aux/test-runner new file mode 100755 index 000000000..5355feffb --- /dev/null +++ b/build-aux/test-runner @@ -0,0 +1,34 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use TAP::Harness; + +my $srcroot = $ENV{abs_top_srcdir}; +my $binroot = $ENV{abs_top_builddir}; + +# Setup the environment +$ENV{LC_ALL} = 'C'; +$ENV{DPKG_COLORS} = 'never'; +$ENV{PATH} = "$binroot/src:$binroot/scripts:$binroot/utils:$ENV{PATH}"; + +my $harness = TAP::Harness->new({ + exec => sub { + my (undef, $test) = @_; + return [ $test ] if $test !~ m/\.t$/ and -x $test; + return + }, + lib => [ + "$srcroot/scripts", + "$srcroot/dselect/methods" + ], + color => 1, + verbosity => $ENV{TEST_VERBOSE}, + jobs => $ENV{TEST_PARALLEL}, + failures => 1, +}); + +my $aggregate = $harness->runtests(@ARGV); +die "FAIL: test suite has errors\n" if $aggregate->has_errors; +1; -- Dpkg.Org's dpkg

