Add test for $dist/updates vs $dist-security
Uses Test::File::Contents, add it to .travis.yml and the according package as build-dependency in debian/control.
This commit is contained in:
@@ -28,7 +28,7 @@ before_install:
|
||||
- perl -V
|
||||
|
||||
install:
|
||||
- yes '' | cpanm --verbose --notest --skip-satisfied Data::Validate::Domain Data::Validate::IP Data::Validate::URI File::Slurp File::Which Log::Message Term::UI Test::NoTabs Test::Pod::Coverage Test::Pod Text::Template Devel::Cover::Report::Coveralls Sort::Versions
|
||||
- yes '' | cpanm --verbose --notest --skip-satisfied Data::Validate::Domain Data::Validate::IP Data::Validate::URI File::Slurp File::Which Log::Message Term::UI Test::NoTabs Test::Pod::Coverage Test::Pod Text::Template Devel::Cover::Report::Coveralls Sort::Versions Test::File::Contents
|
||||
- export RELEASE_TESTING=1 AUTOMATED_TESTING=1 AUTHOR_TESTING=1 HARNESS_OPTIONS=j10:c HARNESS_TIMER=1 PATH=bin:${PERLBREW_PATH}:${PATH}
|
||||
|
||||
script:
|
||||
|
||||
1
debian/changelog
vendored
1
debian/changelog
vendored
@@ -10,6 +10,7 @@ xen-tools (4.8.1~dev-1) UNRELEASED; urgency=medium
|
||||
+ Distinguish between those Debian releases using $dist/updates for
|
||||
security updates and those who use $dist-security. Thanks Paul Wise!
|
||||
(Closes: #972749)
|
||||
- Add test for this; needs libtest-file-contents-perl as build-dep.
|
||||
+ Fix support for lvm_thin. Thanks to Andreas Sundstrom for the bug
|
||||
report and patch! (Closes: #942244)
|
||||
+ Mount /proc and /dev before calling update-grub. Thanks to Brandon
|
||||
|
||||
1
debian/control
vendored
1
debian/control
vendored
@@ -13,6 +13,7 @@ Build-Depends: debhelper-compat (= 13),
|
||||
liblog-message-perl | perl (<< 5.17.0),
|
||||
libterm-ui-perl | perl (<< 5.17.0),
|
||||
libsort-versions-perl,
|
||||
libtest-file-contents-perl,
|
||||
libtest-notabs-perl,
|
||||
libtest-pod-coverage-perl,
|
||||
libtest-pod-perl,
|
||||
|
||||
16
t/data/sources.list.bookworm
Normal file
16
t/data/sources.list.bookworm
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# /etc/apt/sources.list
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# bookworm
|
||||
#
|
||||
deb http://deb.debian.org/debian bookworm main contrib non-free
|
||||
deb-src http://deb.debian.org/debian bookworm main contrib non-free
|
||||
|
||||
#
|
||||
# Security updates
|
||||
#
|
||||
deb http://security.debian.org/ bookworm-security main contrib non-free
|
||||
deb-src http://security.debian.org/ bookworm-security main contrib non-free
|
||||
16
t/data/sources.list.bullseye
Normal file
16
t/data/sources.list.bullseye
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# /etc/apt/sources.list
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# bullseye
|
||||
#
|
||||
deb http://deb.debian.org/debian bullseye main contrib non-free
|
||||
deb-src http://deb.debian.org/debian bullseye main contrib non-free
|
||||
|
||||
#
|
||||
# Security updates
|
||||
#
|
||||
deb http://security.debian.org/ bullseye-security main contrib non-free
|
||||
deb-src http://security.debian.org/ bullseye-security main contrib non-free
|
||||
16
t/data/sources.list.buster
Normal file
16
t/data/sources.list.buster
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# /etc/apt/sources.list
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# buster
|
||||
#
|
||||
deb http://deb.debian.org/debian buster main contrib non-free
|
||||
deb-src http://deb.debian.org/debian buster main contrib non-free
|
||||
|
||||
#
|
||||
# Security updates
|
||||
#
|
||||
deb http://security.debian.org/ buster/updates main contrib non-free
|
||||
deb-src http://security.debian.org/ buster/updates main contrib non-free
|
||||
16
t/data/sources.list.sid
Normal file
16
t/data/sources.list.sid
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# /etc/apt/sources.list
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# sid
|
||||
#
|
||||
deb http://deb.debian.org/debian sid main contrib non-free
|
||||
deb-src http://deb.debian.org/debian sid main contrib non-free
|
||||
|
||||
#
|
||||
# Security updates - Uncomment to enable.
|
||||
#
|
||||
# deb http://security.debian.org/ sid-security main contrib non-free
|
||||
# deb-src http://security.debian.org/ sid-security main contrib non-free
|
||||
16
t/data/sources.list.stretch
Normal file
16
t/data/sources.list.stretch
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# /etc/apt/sources.list
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# stretch
|
||||
#
|
||||
deb http://deb.debian.org/debian stretch main contrib non-free
|
||||
deb-src http://deb.debian.org/debian stretch main contrib non-free
|
||||
|
||||
#
|
||||
# Security updates
|
||||
#
|
||||
deb http://security.debian.org/ stretch/updates main contrib non-free
|
||||
deb-src http://security.debian.org/ stretch/updates main contrib non-free
|
||||
92
t/hook-apt.t
Executable file
92
t/hook-apt.t
Executable file
@@ -0,0 +1,92 @@
|
||||
#!perl -w
|
||||
#
|
||||
# Test that the /etc/inittab file is modified as we expect.
|
||||
#
|
||||
# Steve
|
||||
# --
|
||||
#
|
||||
|
||||
use strict;
|
||||
use Test::More;
|
||||
use Test::File::Contents;
|
||||
use File::Temp;
|
||||
use File::Copy;
|
||||
use File::Path qw(make_path);
|
||||
|
||||
my $asl = 't/data/sources.list';
|
||||
my $hook_dir = $ENV{AS_INSTALLED_TESTING} ? '/usr/share/xen-tools' : 'hooks';
|
||||
|
||||
foreach my $dist (qw(stretch buster bullseye bookworm sid)) {
|
||||
testHook( $dist );
|
||||
}
|
||||
|
||||
done_testing();
|
||||
|
||||
sub testHook
|
||||
{
|
||||
my ( $dist ) = ( @_ );
|
||||
my $dasl = "$asl.$dist";
|
||||
my $ea = 'etc/apt';
|
||||
my $easl = "$ea/sources.list";
|
||||
my $hook = "$hook_dir/" .
|
||||
(
|
||||
$ENV{AS_INSTALLED_TESTING} ?
|
||||
$dist :
|
||||
'debian'
|
||||
) . '/20-setup-apt';
|
||||
|
||||
#
|
||||
# Check that the according sample sources.list exists.
|
||||
#
|
||||
if (-e $dasl) {
|
||||
|
||||
#
|
||||
# Create a temporary directory to use as prefix
|
||||
#
|
||||
my $dir = File::Temp::tempdir( CLEANUP => 1 );
|
||||
make_path( "$dir/$ea/apt.conf.d", { chmod => 0755 });
|
||||
make_path( "$dir/bin", { chmod => 0755 });
|
||||
my $tmphook = "$dir/bin/20-setup-apt";
|
||||
|
||||
#
|
||||
# Make sure that worked.
|
||||
#
|
||||
ok( -d $dir, "temporary directory created OK [$dist]" );
|
||||
ok( -d "$dir/bin",
|
||||
"bin inside temporary directory created OK [$dist]" );
|
||||
ok( -d "$dir/$ea",
|
||||
"$ea inside temporary directory created OK [$dist]" );
|
||||
|
||||
# Create a copy of the 20-setup-apt hook to be able to comment
|
||||
# out the chroot + apt-get update call.
|
||||
File::Copy::cp( $hook, $tmphook );
|
||||
|
||||
ok( -e "$tmphook", "hook exists in temporary directory [$dist]" );
|
||||
ok( -x "$tmphook",
|
||||
"hook is executable in temporary directory [$dist]" );
|
||||
|
||||
no warnings qw(qw);
|
||||
is(system(qw(sed -e s/chroot/#chroot/ -i), $tmphook) >> 8, 0,
|
||||
"chroot call in hook could be deactivated [$dist]");
|
||||
use warnings qw(qw);
|
||||
|
||||
#
|
||||
# Set up some variables expected by the hook
|
||||
#
|
||||
$ENV{dist} = $dist;
|
||||
$ENV{mirror} = 'http://deb.debian.org/debian';
|
||||
|
||||
#
|
||||
# Call the hook
|
||||
#
|
||||
is(system($tmphook, $dir) >> 8, 0,
|
||||
"hook for $dist exited with zero return code");
|
||||
|
||||
ok( -e "$dir/$easl", "A sources.list file has been created. [$dist]" );
|
||||
files_eq_or_diff($dasl, "$dir/$easl",
|
||||
"sources.list for $dist has the expected contents")
|
||||
}
|
||||
else {
|
||||
BAIL_OUT("$dasl not found, source distribution seems incomplete");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user