* Use makeWrapper in building the test driver.
* In the interactive test driver, provide a function "testScript" to run the non-interactive test script. svn path=/nixos/trunk/; revision=25426
This commit is contained in:
parent
c8bca42355
commit
0966854590
@ -1,19 +1,19 @@
|
|||||||
#! @perl@ -w -I@libDir@ -I@readline@
|
#! /somewhere/perl
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use Machine;
|
use Machine;
|
||||||
use Term::ReadLine;
|
use Term::ReadLine;
|
||||||
|
use IO::File;
|
||||||
|
use XML::Writer;
|
||||||
|
|
||||||
$SIG{PIPE} = 'IGNORE'; # because Unix domain sockets may die unexpectedly
|
$SIG{PIPE} = 'IGNORE'; # because Unix domain sockets may die unexpectedly
|
||||||
|
|
||||||
$ENV{PATH} = "@extraPath@:$ENV{PATH}";
|
|
||||||
|
|
||||||
STDERR->autoflush(1);
|
STDERR->autoflush(1);
|
||||||
|
|
||||||
|
|
||||||
my %vms;
|
my %vms;
|
||||||
my $context = "";
|
my $context = "";
|
||||||
|
|
||||||
|
|
||||||
foreach my $vmScript (@ARGV) {
|
foreach my $vmScript (@ARGV) {
|
||||||
my $vm = Machine->new({startCommand => $vmScript});
|
my $vm = Machine->new({startCommand => $vmScript});
|
||||||
$vms{$vm->name} = $vm;
|
$vms{$vm->name} = $vm;
|
||||||
@ -26,6 +26,14 @@ sub startAll {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# In interactive tests, this allows the non-interactive test script to
|
||||||
|
# be executed conveniently.
|
||||||
|
sub testScript {
|
||||||
|
eval "$context $ENV{testScript};\n";
|
||||||
|
warn $@ if $@;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
sub runTests {
|
sub runTests {
|
||||||
if (defined $ENV{tests}) {
|
if (defined $ENV{tests}) {
|
||||||
eval "$context $ENV{tests}";
|
eval "$context $ENV{tests}";
|
||||||
|
@ -10,7 +10,12 @@ rec {
|
|||||||
|
|
||||||
testDriver = stdenv.mkDerivation {
|
testDriver = stdenv.mkDerivation {
|
||||||
name = "nixos-test-driver";
|
name = "nixos-test-driver";
|
||||||
buildCommand =
|
|
||||||
|
buildInputs = [ makeWrapper perl ];
|
||||||
|
|
||||||
|
unpackPhase = "true";
|
||||||
|
|
||||||
|
installPhase =
|
||||||
''
|
''
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
cp ${./test-driver/test-driver.pl} $out/bin/nixos-test-driver
|
cp ${./test-driver/test-driver.pl} $out/bin/nixos-test-driver
|
||||||
@ -20,11 +25,9 @@ rec {
|
|||||||
mkdir -p $libDir
|
mkdir -p $libDir
|
||||||
cp ${./test-driver/Machine.pm} $libDir/Machine.pm
|
cp ${./test-driver/Machine.pm} $libDir/Machine.pm
|
||||||
|
|
||||||
substituteInPlace $out/bin/nixos-test-driver \
|
wrapProgram $out/bin/nixos-test-driver \
|
||||||
--subst-var-by perl "${perl}/bin/perl" \
|
--prefix PATH : "${imagemagick}/bin" \
|
||||||
--subst-var-by readline "${perlPackages.TermReadLineGnu}/lib/perl5/site_perl" \
|
--prefix PERL5LIB : "${lib.makePerlPath [ perlPackages.TermReadLineGnu perlPackages.XMLWriter ]}:$out/lib/perl5/site_perl"
|
||||||
--subst-var-by extraPath "${imagemagick}/bin" \
|
|
||||||
--subst-var libDir
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user