3
0
Fork 0
forked from mirrors/nixpkgs

* 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}->startTag("nest");
$self->{log}->dataElement("head", $msg, %{$attrs}); $self->{log}->dataElement("head", $msg, %{$attrs});
$self->drainLogQueue(); $self->drainLogQueue();
&$coderef; eval { &$coderef };
my $res = $@;
$self->drainLogQueue(); $self->drainLogQueue();
$self->{log}->endTag("nest"); $self->{log}->endTag("nest");
die $@ if $@;
} }
sub sanitise { sub sanitise {

View file

@ -52,8 +52,12 @@ sub subtest {
my ($name, $coderef) = @_; my ($name, $coderef) = @_;
$log->nest("subtest: $name", sub { $log->nest("subtest: $name", sub {
$nrTests++; $nrTests++;
&$coderef; eval { &$coderef };
$nrSucceeded++; if ($@) {
$log->log("error: $@", { error => 1 });
} else {
$nrSucceeded++;
}
}); });
} }
@ -95,7 +99,8 @@ sub runTests {
} }
if ($nrTests != 0) { 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/ ln -s ${pkgs.jquery_ui}/js/jquery-ui.min.js $out/
touch $out/nix-support/hydra-build-products 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
''; # */ ''; # */
}; };