* Test driver: write structured log info to $out/log.xml (not finished
yet). * Machine->new -> createMachine (because VMs must be tracked in the %vms hash). svn path=/nixos/trunk/; revision=25427
This commit is contained in:
parent
0966854590
commit
7378e17f74
@ -1,4 +1,4 @@
|
|||||||
#! /somewhere/perl
|
#! /somewhere/perl -w
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use Machine;
|
use Machine;
|
||||||
@ -10,13 +10,23 @@ $SIG{PIPE} = 'IGNORE'; # because Unix domain sockets may die unexpectedly
|
|||||||
|
|
||||||
STDERR->autoflush(1);
|
STDERR->autoflush(1);
|
||||||
|
|
||||||
|
my $logFile = defined $ENV{LOGFILE} ? "$ENV{LOGFILE}" : "/dev/null";
|
||||||
|
my $log = new XML::Writer(OUTPUT => new IO::File(">$logFile"));
|
||||||
|
$log->startTag("logfile");
|
||||||
|
|
||||||
|
|
||||||
my %vms;
|
my %vms;
|
||||||
my $context = "";
|
my $context = "";
|
||||||
|
|
||||||
foreach my $vmScript (@ARGV) {
|
sub createMachine {
|
||||||
my $vm = Machine->new({startCommand => $vmScript});
|
my ($args) = @_;
|
||||||
|
my $vm = Machine->new($args);
|
||||||
$vms{$vm->name} = $vm;
|
$vms{$vm->name} = $vm;
|
||||||
|
return $vm;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $vmScript (@ARGV) {
|
||||||
|
my $vm = createMachine({startCommand => $vmScript});
|
||||||
$context .= "my \$" . $vm->name . " = \$vms{'" . $vm->name . "'}; ";
|
$context .= "my \$" . $vm->name . " = \$vms{'" . $vm->name . "'}; ";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,6 +96,8 @@ END {
|
|||||||
kill 9, $vm->{pid};
|
kill 9, $vm->{pid};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$log->endTag("logfile");
|
||||||
|
$log->end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ rec {
|
|||||||
''
|
''
|
||||||
ensureDir $out/nix-support
|
ensureDir $out/nix-support
|
||||||
|
|
||||||
${testDriver}/bin/nixos-test-driver ${network}/vms/*/bin/run-*-vm
|
LOGFILE=$out/log.xml ${testDriver}/bin/nixos-test-driver ${network}/vms/*/bin/run-*-vm
|
||||||
|
|
||||||
for i in */coverage-data; do
|
for i in */coverage-data; do
|
||||||
ensureDir $out/coverage-data
|
ensureDir $out/coverage-data
|
||||||
|
@ -93,7 +93,7 @@ let
|
|||||||
''
|
''
|
||||||
createDisk("harddisk", 4 * 1024);
|
createDisk("harddisk", 4 * 1024);
|
||||||
|
|
||||||
my $machine = Machine->new({ hda => "harddisk", cdrom => glob("${iso}/iso/*.iso"), qemuFlags => '${qemuNICFlags 1 1 1}' });
|
my $machine = createMachine({ hda => "harddisk", cdrom => glob("${iso}/iso/*.iso"), qemuFlags => '${qemuNICFlags 1 1 1}' });
|
||||||
$machine->start;
|
$machine->start;
|
||||||
|
|
||||||
${optionalString testChannel ''
|
${optionalString testChannel ''
|
||||||
@ -158,7 +158,7 @@ let
|
|||||||
$machine->shutdown;
|
$machine->shutdown;
|
||||||
|
|
||||||
# Now see if we can boot the installation.
|
# Now see if we can boot the installation.
|
||||||
my $machine = Machine->new({ hda => "harddisk" });
|
my $machine = createMachine({ hda => "harddisk" });
|
||||||
|
|
||||||
# Did /boot get mounted, if appropriate?
|
# Did /boot get mounted, if appropriate?
|
||||||
# !!! There is currently no good way to wait for the
|
# !!! There is currently no good way to wait for the
|
||||||
@ -181,7 +181,7 @@ let
|
|||||||
|
|
||||||
# And just to be sure, check that the machine still boots after
|
# And just to be sure, check that the machine still boots after
|
||||||
# "nixos-rebuild switch".
|
# "nixos-rebuild switch".
|
||||||
my $machine = Machine->new({ hda => "harddisk" });
|
my $machine = createMachine({ hda => "harddisk" });
|
||||||
$machine->mustSucceed("echo hello");
|
$machine->mustSucceed("echo hello");
|
||||||
$machine->shutdown;
|
$machine->shutdown;
|
||||||
'';
|
'';
|
||||||
@ -304,7 +304,7 @@ in {
|
|||||||
testScript =
|
testScript =
|
||||||
''
|
''
|
||||||
# damn, it's costly to evaluate nixos-rebuild (1G of ram)
|
# damn, it's costly to evaluate nixos-rebuild (1G of ram)
|
||||||
my $machine = Machine->new({ cdrom => glob("${iso}/iso/*.iso"), qemuFlags => '${qemuNICFlags 1 1 1} -m 1024' });
|
my $machine = createMachine({ cdrom => glob("${iso}/iso/*.iso"), qemuFlags => '${qemuNICFlags 1 1 1} -m 1024' });
|
||||||
$machine->start;
|
$machine->start;
|
||||||
|
|
||||||
# Make sure that we don't try to download anything.
|
# Make sure that we don't try to download anything.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user