From: Martin Mares Date: Mon, 19 Nov 2007 08:17:39 +0000 (+0100) Subject: Simplify temporary file deletion in the tester. X-Git-Tag: python-dummy-working~265 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=a5c99ce9af945065b7f9961a7ccb868f45d7f972;p=moe.git Simplify temporary file deletion in the tester. The advantage of doing a wildcard rm instead of deleting the files individually is that you can use $n for temporary files, which are not mentioned as explicit inputs or outputs in the test case. --- diff --git a/judge/tester b/judge/tester index ae3165a..d467b98 100755 --- a/judge/tester +++ b/judge/tester @@ -67,7 +67,6 @@ TEST: foreach $tt (@tests) { my @out_files = (); my @out_checks = (); - my @temps = (); my $redirs = ""; if (defined $tt->{'In'}) { @@ -76,7 +75,6 @@ TEST: foreach $tt (@tests) { print X $tt->{'In'}, "\n"; close X; $redirs .= " <$ifi"; - push @temps, $ifi; } else { $redirs .= " {'Out'}; } else { @@ -94,7 +91,6 @@ TEST: foreach $tt (@tests) { my $f = "tmp/test$i.$arg"; if (defined $tt->{"Out$arg"}) { unlink "$rundir/$f"; - push @temps, $f; push @out_files, $f; push @out_checks, $tt->{"Out$arg"}; } @@ -102,7 +98,6 @@ TEST: foreach $tt (@tests) { open X, ">$rundir/$f" or die "Unable to create $f"; print X $tt->{"In$arg"}, "\n"; close X; - push @temps, $f; } } $run =~ s/\$(\d)/tmp\/test$i.$1/g; @@ -137,9 +132,7 @@ TEST: foreach $tt (@tests) { } } - foreach my $f (@temps) { - unlink "$rundir/$f"; - } + system "rm $rundir/tmp/test$i.*"; print "OK\n"; }