Package: libdpkg-perl Version: 1.18.10ubuntu1 Severity: wishlist Tags: patch
Heya, This is sort of similar to #779559. Let me just explain the problem briefly- In Ubuntu we dispatch tests to fresh cloud instances. Each instance has a ~3 minute boot and teardown overhead, which is quite significant when there are many triggered tests - for example glibc uploads trigger thousands of tests. Full machine virtualisation is not actually required for the majority of tests. autopkgtests has an lxd (or schroot, etc) backend that I would like to use as they have a far smaller per-test overhead. The only problem is that some tests have the 'isolation-machine' restriction which means that you do require an entire machine - lxd won't do. I don't currently have any way when dispatching the tests to know if this is the case, short of downloading the source package and looking in debian/tests/control. Exposing the restrictions in the index will let me send tests to the right autopkgtest backend straight off. There's a patch attached. It works for me, but review appreciated. I didn't know if 'deps_iterate' was right to use for Restrictions - it's dependency like in format but obviously not actually a dependency field. Cheers, -- Iain Lane [ [email protected] ] Debian Developer [ [email protected] ] Ubuntu Developer [ [email protected] ]
>From ae3c57f4a143b9f1af6a7995be1fe633246a5791 Mon Sep 17 00:00:00 2001 From: Iain Lane <[email protected]> Date: Mon, 12 Dec 2016 12:46:20 +0000 Subject: [PATCH] Generate Testsuite-Recommends in .dscs from Restrictions in debian/tests/control. --- debian/changelog | 4 ++++ man/dsc.man | 4 ++++ scripts/Dpkg/Control/FieldsCore.pm | 7 ++++++- scripts/dpkg-source.pl | 24 ++++++++++++++++++++++++ 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index e2b3796..af7d38f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,10 @@ dpkg (1.18.16) UNRELEASED; urgency=medium [ Updated man pages translations ] * German (Helge Kreutzmann). + [ Iain Lane ] + * Generate Testsuite-Recommends in .dscs from Restrictions in + debian/tests/control. + -- Guillem Jover <[email protected]> Wed, 16 Nov 2016 05:16:45 +0100 dpkg (1.18.15) unstable; urgency=medium diff --git a/man/dsc.man b/man/dsc.man index 839bada..cb38e40 100644 --- a/man/dsc.man +++ b/man/dsc.man @@ -150,6 +150,10 @@ restrictions removed, and OR dependencies flattened, except for binaries generated by this source package and meta-dependencies such as \fB@\fP or \fB@builddeps@\fP. .TP +.BI Testsuite\-Restrictions: " name-list" +This field declares the comma-separated union of all test restrictions +(\fBRestrictions\fP fields in \fIdebian/tests/control\fP file). +.TP .BI Build\-Depends: " package-list" .TQ .BI Build\-Depends\-Arch: " package-list" diff --git a/scripts/Dpkg/Control/FieldsCore.pm b/scripts/Dpkg/Control/FieldsCore.pm index 7c7e759..0e6556c 100644 --- a/scripts/Dpkg/Control/FieldsCore.pm +++ b/scripts/Dpkg/Control/FieldsCore.pm @@ -383,6 +383,10 @@ our %FIELDS = ( allowed => ALL_SRC, separator => FIELD_SEP_COMMA, }, + 'Testsuite-Restrictions' => { + allowed => ALL_SRC, + separator => FIELD_SEP_COMMA, + }, 'Timestamp' => { allowed => CTRL_CHANGELOG, }, @@ -468,7 +472,8 @@ our %FIELD_ORDER = ( qw(Format Source Binary Architecture Version Origin Maintainer Uploaders Homepage Standards-Version Vcs-Browser Vcs-Arch Vcs-Bzr Vcs-Cvs Vcs-Darcs Vcs-Git Vcs-Hg Vcs-Mtn - Vcs-Svn Testsuite Testsuite-Triggers), &field_list_src_dep(), + Vcs-Svn Testsuite Testsuite-Triggers Testsuite-Restrictions), + &field_list_src_dep(), qw(Package-List), @checksum_fields, qw(Files) ], CTRL_FILE_BUILDINFO() => [ diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl index bf2c5be..da0cfa7 100755 --- a/scripts/dpkg-source.pl +++ b/scripts/dpkg-source.pl @@ -368,6 +368,7 @@ if ($options{opmode} =~ /^(build|print-format|(before|after)-build|commit)$/) { # Check if we have a testsuite, and handle manual and automatic values. set_testsuite_field($fields); set_testsuite_triggers_field($fields, @binarypackages); + set_testsuite_restrictions_field($fields); # Scan fields of dpkg-parsechangelog foreach (keys %{$changelog}) { @@ -552,6 +553,29 @@ sub set_testsuite_triggers_field $fields->{'Testsuite-Triggers'} = join ', ', sort keys %testdeps; } +sub set_testsuite_restrictions_field +{ + my $fields = shift; + my %testrestrictions; + + # Never overwrite a manually defined field. + return if $fields->{'Testsuite-Restrictions'}; + + # We only support autopkgtests. + return unless -e "$dir/debian/tests/control"; + + my $tests = Dpkg::Control::Tests->new(); + $tests->load("$dir/debian/tests/control"); + + foreach my $test ($tests->get()) { + next unless $test->{Restrictions}; + + my $restrictions = deps_parse($test->{Restrictions}, use_arch => 0, tests_dep => 0); + deps_iterate($restrictions, sub { $testrestrictions{$_[0]} = 1; }); + } + $fields->{'Testsuite-Restrictions'} = join ', ', sort keys %testrestrictions; +} + sub setopmode { my $opmode = shift; -- 2.9.3

