From 7fd8ce0d95032cefba81f689f868e415f20f6190 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sun, 9 Jan 2011 18:46:02 +0000 Subject: [PATCH] * If a subtest fails, continue to the next subtest. svn path=/nixos/trunk/; revision=25472 --- lib/test-driver/Logger.pm | 4 +++- lib/test-driver/test-driver.pl | 11 ++++++++--- lib/testing.nix | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/test-driver/Logger.pm b/lib/test-driver/Logger.pm index b2d31b8820fd..6e62fdfd7708 100644 --- a/lib/test-driver/Logger.pm +++ b/lib/test-driver/Logger.pm @@ -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 { diff --git a/lib/test-driver/test-driver.pl b/lib/test-driver/test-driver.pl index 0ccde63fc3e1..1007546804bb 100644 --- a/lib/test-driver/test-driver.pl +++ b/lib/test-driver/test-driver.pl @@ -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 } : { })); } } diff --git a/lib/testing.nix b/lib/testing.nix index 045b5b646b85..16e38771172c 100644 --- a/lib/testing.nix +++ b/lib/testing.nix @@ -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 ''; # */ };