1
0
mirror of synced 2026-01-11 23:42:56 +00:00

Add as-installed testing support

This commit is contained in:
Axel Beckert 2015-07-14 21:55:41 +02:00
parent e6653f1ae9
commit 2dcea1666a
17 changed files with 74 additions and 38 deletions

View File

@ -15,9 +15,6 @@ General Ideas
[this mail](http://xen-tools.org/pipermail/xen-tools-discuss/2015-June/001103.html)
and the following mails on the xen-tools-discuss mailing list.
* Use Debian's autopkgtest specification and do as-installed testing
on http://ci.debian.net/.
Bugs to fix and features to add for 5.0
---------------------------------------

3
debian/changelog vendored
View File

@ -35,6 +35,8 @@ xen-tools (4.5+dev-1) UNRELEASED; urgency=medium
+ Report all SSH fingerprints of the created DomU, not only RSA ones.
+ Split up test suite in functionality/compatibility tests (t) and
author/release tests (xt).
+ Make test suite support as-installed-testing
- Mark package as autopkgtestable.
* Update Vcs-* headers and documentation as Gitorious closed its doors
in June 2015 and is now only available with static contents.
* Recommend debian-archive-keyring (for installing Debian DomUs on
@ -44,6 +46,7 @@ xen-tools (4.5+dev-1) UNRELEASED; urgency=medium
"xen-hypervisor" which is a virtual package provided by at least all
xen-hypervisor-* packages since Debian 6 Squeeze.
* Recommend lvm2, it's at least required if the --lvm option is used.
* Add an adequate as-installed test to debian/tests/control.
-- Axel Beckert <abe@debian.org> Fri, 09 Jan 2015 13:10:37 +0100

1
debian/control vendored
View File

@ -21,6 +21,7 @@ Standards-Version: 3.9.6
Homepage: http://xen-tools.org/software/xen-tools
Vcs-Browser: https://gitlab.com/xen-tools/xen-tools
Vcs-Git: https://gitlab.com/xen-tools/xen-tools.git
Testsuite: autopkgtest
Package: xen-tools
Architecture: all

3
debian/tests/adequate vendored Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
adequate xen-tools >&2

5
debian/tests/control vendored Normal file
View File

@ -0,0 +1,5 @@
Tests: functionality
Depends: @, @builddeps@
Tests: adequate
Depends: @, adequate

15
debian/tests/functionality vendored Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
export AS_INSTALLED_TESTING=1
prove -j1 -v \
t/hook-daemons.t \
t/hook-hostname.t \
t/hook-inittab.t \
t/hook-tls.t \
t/hooks.t \
t/plugin-checks.t \
t/pod-check.t \
t/xen-delete-image.t \
t/xen-lists-images.t \
t/xt-create-xen-config.t

View File

@ -129,7 +129,8 @@ sub xenRunning ($$)
my $running = 0;
unless ($CONFIG->{'xm'}) {
warn "Couldn't determine Xen toolstack, skipping check for running DomUs.";
warn "Couldn't determine Xen toolstack, skipping check for running DomUs."
unless $ENV{AS_INSTALLED_TESTING};
return 0;
}

View File

@ -19,12 +19,14 @@ use File::Temp;
# against we look for subdirectories beneath hooks/ and test each
# one.
#
foreach my $dir ( glob( "hooks/*" ) )
my $hook_dir = $ENV{AS_INSTALLED_TESTING} ? '/usr/share/xen-tools' : 'hooks';
foreach my $dir ( glob( "$hook_dir/*" ) )
{
next if ( $dir =~ /CVS/i );
next if ( ! -d $dir );
if ( $dir =~ /hooks\/(.*)/ )
if ( $dir =~ /$hook_dir\/(.*)/ )
{
my $dist = $1;
@ -49,7 +51,7 @@ sub maybeCallHook
#
foreach my $file ( qw/ 01-disable-daemons 99-enable-daemons / )
{
return if ( ! -e "./hooks/$dist/$file" );
return if ( ! -e "$hook_dir/$dist/$file" );
}
#
@ -87,7 +89,7 @@ sub testHook
#
# Call the first hook
#
`hooks/$dist/01-disable-daemons $dir`;
`$hook_dir/$dist/01-disable-daemons $dir`;
#
# Now /usr/sbin should exist.
@ -98,7 +100,7 @@ sub testHook
#
# Now call the second hook
#
`hooks/$dist/99-enable-daemons $dir`;
`$hook_dir/$dist/99-enable-daemons $dir`;
ok( ! -x $dir . "/usr/sbin/policy-rc.d", "The policy-rc.d file was correctly removed" );
}

View File

@ -19,13 +19,14 @@ use File::Temp;
# against we look for subdirectories beneath hooks/ and test each
# one.
#
foreach my $dir ( glob( "hooks/*" ) )
my $hook_dir = $ENV{AS_INSTALLED_TESTING} ? '/usr/share/xen-tools' : 'hooks';
foreach my $dir ( glob( "$hook_dir/*" ) )
{
next if ( $dir =~ /CVS/i );
next if ( $dir =~ /common/i );
next if ( ! -d $dir );
if ( $dir =~ /hooks\/(.*)/ )
if ( $dir =~ /$hook_dir\/(.*)/ )
{
my $dist = $1;
@ -78,14 +79,14 @@ sub testHostCreation
# Make sure we have the distro-specific hook directory, and
# TLS-disabling hook script.
#
ok( -d "hooks/$dist", "There is a hook directory for the distro $dist" );
ok( -d "$hook_dir/$dist", "There is a hook directory for the distro $dist" );
ok( -e "hooks/$dist/50-setup-hostname", "There is a hook for setting up hostname stuff." );
ok( -e "$hook_dir/$dist/50-setup-hostname", "There is a hook for setting up hostname stuff." );
#
# Call the hook
#
`hooks/$dist/50-setup-hostname $dir`;
`$hook_dir/$dist/50-setup-hostname $dir`;
ok( -e $dir . "/etc/hosts", " There is now a hosts file present" );

View File

@ -11,6 +11,7 @@ use Test::More;
use File::Temp;
use File::Copy;
my $hook_dir = $ENV{AS_INSTALLED_TESTING} ? '/usr/share/xen-tools' : 'hooks';
#
# Check if build system has /etc/inittab.
@ -23,13 +24,13 @@ SKIP: {
# against we look for subdirectories beneath hooks/ and test each
# one.
#
foreach my $dir ( glob( "hooks/*" ) )
foreach my $dir ( glob( "$hook_dir/*" ) )
{
next if ( $dir =~ /CVS/i );
next if ( $dir =~ /common/i );
next if ( ! -d $dir );
if ( $dir =~ /hooks\/(.*)/ )
if ( $dir =~ /$hook_dir\/(.*)/ )
{
my $dist = $1;
@ -60,13 +61,13 @@ sub testHook
ok( -d $dir, "Temporary directory created OK" );
ok( -e $dir . "/etc/inittab", "/etc/inittab copied correctly." );
ok( -e "hooks/$dist/30-disable-gettys", "$dist inittab fixing hook exists" );
ok( -x "hooks/$dist/30-disable-gettys", "$dist inittab fixing hook is executable" );
ok( -e "$hook_dir/$dist/30-disable-gettys", "$dist inittab fixing hook exists" );
ok( -x "$hook_dir/$dist/30-disable-gettys", "$dist inittab fixing hook is executable" );
#
# Call the hook
#
`hooks/$dist/30-disable-gettys $dir`;
`$hook_dir/$dist/30-disable-gettys $dir`;
#
# Now we read the new file, and make sure it looks like we expect.

View File

@ -21,16 +21,17 @@ if ( $Config::Config{archname} =~ /64/ )
# against we look for subdirectories beneath hooks/ and test each
# one.
#
foreach my $dir ( glob( "hooks/*" ) )
my $hook_dir = $ENV{AS_INSTALLED_TESTING} ? '/usr/share/xen-tools' : 'hooks';
foreach my $dir ( glob( "$hook_dir/*" ) )
{
next if ( $dir =~ /CVS|common/i );
next if ( ! -d $dir );
if ( $dir =~ /hooks\/(.*)/ )
if ( $dir =~ /$hook_dir\/(.*)/ )
{
my $dist = $1;
testTLSDisabling( $dist ) if -e "hooks/$dist/10-disable-tls";
testTLSDisabling( $dist ) if -e "$hook_dir/$dist/10-disable-tls";
}
}
@ -63,15 +64,15 @@ sub testTLSDisabling
# Make sure we have the distro-specific hook directory, and
# TLS-disabling hook script.
#
ok( -d "hooks/$dist", "There is a hook directory for the distro $dist" );
ok( -d "$hook_dir/$dist", "There is a hook directory for the distro $dist" );
ok( -e "hooks/$dist/10-disable-tls", "TLS Disabling hook exists ($dist)" );
ok( -x "hooks/$dist/10-disable-tls", "TLS Disabling hook is executable ($dist)" );
ok( -e "$hook_dir/$dist/10-disable-tls", "TLS Disabling hook exists ($dist)" );
ok( -x "$hook_dir/$dist/10-disable-tls", "TLS Disabling hook is executable ($dist)" );
#
# Call the hook
#
`hooks/$dist/10-disable-tls $dir`;
`$hook_dir/$dist/10-disable-tls $dir`;
#
# Make sure the the TLS directory is empty

View File

@ -15,13 +15,14 @@ use Test::More;
# against we look for subdirectories beneath hooks/ and test each
# one.
#
foreach my $dir ( glob( "hooks/*" ) )
my $hook_dir = $ENV{AS_INSTALLED_TESTING} ? '/usr/share/xen-tools' : 'hooks';
foreach my $dir ( glob( "$hook_dir/*" ) )
{
next if ( $dir =~ /CVS/i );
next if ( $dir =~ /common/i );
next if ( ! -d $dir );
if ( $dir =~ /hooks\/(.*)/ )
if ( $dir =~ /$hook_dir\/(.*)/ )
{
my $dist = $1;
testDistroHooks( $dist );
@ -37,12 +38,12 @@ sub testDistroHooks
#
# Make sure we have a distro-specific hook directory.
#
ok( -d "hooks/$dist", "There is a hook directory for distro $dist" );
ok( -d "$hook_dir/$dist", "There is a hook directory for distro $dist" );
#
# Now make sure we just have files, and that they are executable.
#
foreach my $file ( glob( "hooks/$dist/*" ) )
foreach my $file ( glob( "$hook_dir/$dist/*" ) )
{
if ( ! -d $file )
{

View File

@ -17,13 +17,14 @@ use Test::More;
# against we look for subdirectories beneath hooks/ and test each
# one.
#
foreach my $dir ( glob( "hooks/*" ) )
my $hook_dir = $ENV{AS_INSTALLED_TESTING} ? '/usr/share/xen-tools' : 'hooks';
foreach my $dir ( glob( "$hook_dir/*" ) )
{
next if ( $dir =~ /CVS/i );
next if ( $dir =~ /common/i );
next if ( ! -d $dir );
if ( $dir =~ /hooks\/(.*)/ )
if ( $dir =~ /$hook_dir\/(.*)/ )
{
my $dist = $1;
testPlugins( $dist );
@ -45,12 +46,12 @@ sub testPlugins
#
# Make sure there is a hook directory for the named distro
#
ok( -d "hooks/$dist/", "There is a hook directory for the distro $dist" );
ok( -d "$hook_dir/$dist/", "There is a hook directory for the distro $dist" );
#
# Make sure the plugins are OK.
#
foreach my $file ( glob( "hooks/$dist/*" ) )
foreach my $file ( glob( "$hook_dir/$dist/*" ) )
{
ok( -e $file, "$file" );

View File

@ -10,7 +10,8 @@
use strict;
use Test::More;
foreach my $file ( glob( "bin/*-*" ) )
my $bin_dir = $ENV{AS_INSTALLED_TESTING} ? '/usr/bin' : 'bin';
foreach my $file ( glob( "$bin_dir/xen-*-* $bin_dir/xt-*-*" ) )
{
ok( -e $file, "$file" );
ok( -x $file, " File is executable: $file" );

View File

@ -75,7 +75,8 @@ close( IMAGE );
# So we need to run the deletion script and verify the images
# are removed correctly.
#
my $log = `perl -Ilib -I../lib bin/xen-delete-image --test --verbose --dir=$dir $hostname`;
my $prefix = $ENV{AS_INSTALLED_TESTING} ? '/usr/' : 'perl -Ilib -I../lib ';
my $log = `${prefix}bin/xen-delete-image --test --verbose --dir=$dir $hostname`;
ok ( $? == 0, 'Calling xen-delete-image returned exit code 0' );
print $log;

View File

@ -98,7 +98,8 @@ EOS
# Now run the xen-list-images script to make sure we can read
# the relevant details back from it.
#
my $cmd = "perl -I./lib -I../lib ./bin/xen-list-images --test=$dir";
my $prefix = $ENV{AS_INSTALLED_TESTING} ? '/usr/' : 'perl -Ilib -I../lib ';
my $cmd = "${prefix}bin/xen-list-images --test=$dir";
my $output = `$cmd`;
ok( defined( $output ) && length( $output ), "Runing the list command produced some output" );

View File

@ -174,7 +174,8 @@ sub runCreateCommand
#
# Run the command
#
system( "perl bin/xt-create-xen-config --output=$dir --template=etc/xm.tmpl" );
my $prefix = $ENV{AS_INSTALLED_TESTING} ? '/usr/' : 'perl ';
system( "${prefix}bin/xt-create-xen-config --output=$dir --template=etc/xm.tmpl" );
#
# Reset the environment