forked from lix-project/hydra
Implemented quoted strings support in hydra-build-products to allow file names with spaces + testcase
This commit is contained in:
parent
50434d76c2
commit
03189bf62b
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue