X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=build%2Ftester;h=73794d9396b818711c0e70854d627ab16b31e848;hb=ba9c448bb5446d0100173e7a594bcb1d849b4e39;hp=f2daedc13dd7f2d5b2477741fb7842dd2077a3b3;hpb=597f47bc3baa7cf0a0fa55f01a003ca090dc9733;p=libucw.git diff --git a/build/tester b/build/tester index f2daedc1..73794d93 100755 --- a/build/tester +++ b/build/tester @@ -1,6 +1,7 @@ #!/usr/bin/perl # A simple unit testing script # (c) 2004 Martin Mares +# (c) 2007 Pavel Charvat my @tests = (); my $tt; @@ -28,14 +29,16 @@ while (<>) { my $i = 0; my $errors = 0; +my $prev_run = undef; foreach $tt (@tests) { $i++; print "Test $i: "; - my $run = $tt->{'Run'} or die "Don't know what to run"; + $run = ($tt->{'Run'} || $prev_run) or die "Don't know what to run"; + $prev_run = $run; my ($ifi, $ofi); if (defined $tt->{'In'}) { - $ifi = "run/tmp/test$i.in"; - open X, ">$ifi" or die "Unable to create $ifi"; + $ifi = "tmp/test$i.in"; + open X, ">run/$ifi" or die "Unable to create $ifi"; print X $tt->{'In'}, "\n"; close X; $run .= " <$ifi"; @@ -43,20 +46,20 @@ foreach $tt (@tests) { $run .= " {'Out'}) { - $ofi = "run/tmp/test$i.out"; - unlink $ofi; + $ofi = "tmp/test$i.out"; + unlink "run/$ofi"; $run .= " >$ofi"; } else { $run .= " >/dev/null"; } - `$run`; + system "cd run && ( $run )"; if ($?) { print "FAILED with exit code $?\n"; $errors++; next; } if (defined $tt->{'Out'}) { - open X, "<$ofi" or die "Unable to read $ofi"; + open X, "