mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 09:23:01 +00:00
* 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 Machine;
|
||||
use Term::ReadLine;
|
||||
use IO::File;
|
||||
use XML::Writer;
|
||||
|
||||
$SIG{PIPE} = 'IGNORE'; # because Unix domain sockets may die unexpectedly
|
||||
|
||||
$ENV{PATH} = "@extraPath@:$ENV{PATH}";
|
||||
|
||||
STDERR->autoflush(1);
|
||||
|
||||
|
||||
my %vms;
|
||||
my $context = "";
|
||||
|
||||
|
||||
foreach my $vmScript (@ARGV) {
|
||||
my $vm = Machine->new({startCommand => $vmScript});
|
||||
$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 {
|
||||
if (defined $ENV{tests}) {
|
||||
eval "$context $ENV{tests}";
|
||||
|
@ -10,7 +10,12 @@ rec {
|
||||
|
||||
testDriver = stdenv.mkDerivation {
|
||||
name = "nixos-test-driver";
|
||||
buildCommand =
|
||||
|
||||
buildInputs = [ makeWrapper perl ];
|
||||
|
||||
unpackPhase = "true";
|
||||
|
||||
installPhase =
|
||||
''
|
||||
mkdir -p $out/bin
|
||||
cp ${./test-driver/test-driver.pl} $out/bin/nixos-test-driver
|
||||
@ -20,11 +25,9 @@ rec {
|
||||
mkdir -p $libDir
|
||||
cp ${./test-driver/Machine.pm} $libDir/Machine.pm
|
||||
|
||||
substituteInPlace $out/bin/nixos-test-driver \
|
||||
--subst-var-by perl "${perl}/bin/perl" \
|
||||
--subst-var-by readline "${perlPackages.TermReadLineGnu}/lib/perl5/site_perl" \
|
||||
--subst-var-by extraPath "${imagemagick}/bin" \
|
||||
--subst-var libDir
|
||||
wrapProgram $out/bin/nixos-test-driver \
|
||||
--prefix PATH : "${imagemagick}/bin" \
|
||||
--prefix PERL5LIB : "${lib.makePerlPath [ perlPackages.TermReadLineGnu perlPackages.XMLWriter ]}:$out/lib/perl5/site_perl"
|
||||
'';
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user