* If a subtest fails, continue to the next subtest.

svn path=/nixos/trunk/; revision=25472
This commit is contained in:
Eelco Dolstra 2011-01-09 18:46:02 +00:00
parent 260d9faee7
commit 7fd8ce0d95
3 changed files with 12 additions and 5 deletions

View File

@ -46,9 +46,11 @@ sub nest {
$self->{log}->startTag("nest");
$self->{log}->dataElement("head", $msg, %{$attrs});
$self->drainLogQueue();
&$coderef;
eval { &$coderef };
my $res = $@;
$self->drainLogQueue();
$self->{log}->endTag("nest");
die $@ if $@;
}
sub sanitise {

View File

@ -52,8 +52,12 @@ sub subtest {
my ($name, $coderef) = @_;
$log->nest("subtest: $name", sub {
$nrTests++;
&$coderef;
$nrSucceeded++;
eval { &$coderef };
if ($@) {
$log->log("error: $@", { error => 1 });
} else {
$nrSucceeded++;
}
});
}
@ -95,7 +99,8 @@ sub runTests {
}
if ($nrTests != 0) {
#$log->dataElement("line", "$nrSucceeded out of $nrTests tests succeeded");
$log->log("$nrSucceeded out of $nrTests tests succeeded",
($nrSucceeded != $nrTests ? { error => 1 } : { }));
}
}

View File

@ -65,7 +65,7 @@ rec {
ln -s ${pkgs.jquery_ui}/js/jquery-ui.min.js $out/
touch $out/nix-support/hydra-build-products
echo "report testlog $out/log.html" >> $out/nix-support/hydra-build-products
echo "report testlog $out log.html" >> $out/nix-support/hydra-build-products
''; # */
};