forked from lix-project/hydra
Merge pull request #74 from svanderburg/master
Implemented support to allow spaces in hydra-build-products
This commit is contained in:
commit
f4ae655ee6
|
@ -782,10 +782,10 @@ sub addBuildProducts {
|
|||
|
||||
open LIST, "$outPath/nix-support/hydra-build-products" or die;
|
||||
while (<LIST>) {
|
||||
/^([\w\-]+)\s+([\w\-]+)\s+(\S+)(\s+(\S+))?$/ or next;
|
||||
/^([\w\-]+)\s+([\w\-]+)\s+("[^"]*"|\S+)(\s+(\S+))?$/ or next;
|
||||
my $type = $1;
|
||||
my $subtype = $2 eq "none" ? "" : $2;
|
||||
my $path = File::Spec->canonpath($3);
|
||||
my $path = File::Spec->canonpath((substr $3, 0, 1) eq "\"" ? substr $3, 1, -1 : $3);
|
||||
my $defaultPath = $5;
|
||||
|
||||
# Ensure that the path exists and points into the Nix store.
|
||||
|
|
|
@ -7,7 +7,7 @@ use Setup;
|
|||
|
||||
my $db = Hydra::Model::DB->new;
|
||||
|
||||
use Test::Simple tests => 60;
|
||||
use Test::Simple tests => 68;
|
||||
|
||||
hydra_setup($db);
|
||||
|
||||
|
@ -136,3 +136,25 @@ foreach my $scm ( @scminputs ) {
|
|||
($loop, $updated) = updateRepository($scmName, $update, getcwd . "/$scmName-repo/");
|
||||
}
|
||||
}
|
||||
|
||||
# Test build products
|
||||
|
||||
$jobset = createBaseJobset("build-products", "build-products.nix");
|
||||
|
||||
ok(evalSucceeds($jobset), "Evaluating jobs/build-products.nix should exit with return code 0");
|
||||
ok(nrQueuedBuildsForJobset($jobset) == 2 , "Evaluating jobs/build-products.nix should result in 2 builds");
|
||||
|
||||
for my $build (queuedBuildsForJobset($jobset)) {
|
||||
ok(runBuild($build), "Build '".$build->job->name."' from jobs/build-products.nix should exit with code 0");
|
||||
my $newbuild = $db->resultset('Builds')->find($build->id);
|
||||
ok($newbuild->finished == 1 && $newbuild->buildstatus == 0, "Build '".$build->job->name."' from jobs/build-products.nix should have buildstatus 0");
|
||||
|
||||
my $buildproducts = $db->resultset('BuildProducts')->search({ build => $build->id });
|
||||
my $buildproduct = $buildproducts->next;
|
||||
|
||||
if($build->job->name eq "simple") {
|
||||
ok($buildproduct->name eq "text.txt", "We should have text.txt, but found: ".$buildproduct->name."\n");
|
||||
} elsif ($build->job->name eq "with_spaces") {
|
||||
ok($buildproduct->name eq "some text.txt", "We should have: \"some text.txt\", but found: ".$buildproduct->name."\n");
|
||||
}
|
||||
}
|
||||
|
|
5
tests/jobs/build-product-simple.sh
Executable file
5
tests/jobs/build-product-simple.sh
Executable file
|
@ -0,0 +1,5 @@
|
|||
#! /bin/sh
|
||||
|
||||
mkdir -p $out/nix-support
|
||||
echo "Hello" > $out/text.txt
|
||||
echo "doc none $out/text.txt" > $out/nix-support/hydra-build-products
|
5
tests/jobs/build-product-with-spaces.sh
Executable file
5
tests/jobs/build-product-with-spaces.sh
Executable file
|
@ -0,0 +1,5 @@
|
|||
#! /bin/sh
|
||||
|
||||
mkdir -p $out/nix-support
|
||||
echo "Hello" > "$out/some text.txt"
|
||||
echo "doc none \"$out/some text.txt\"" > $out/nix-support/hydra-build-products
|
14
tests/jobs/build-products.nix
Normal file
14
tests/jobs/build-products.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
with import ./config.nix;
|
||||
{
|
||||
simple =
|
||||
mkDerivation {
|
||||
name = "build-product-simple";
|
||||
builder = ./build-product-simple.sh;
|
||||
};
|
||||
|
||||
with_spaces =
|
||||
mkDerivation {
|
||||
name = "build-product-with-spaces";
|
||||
builder = ./build-product-with-spaces.sh;
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue