X-Git-Url: http://git.ieval.ro/?p=gruntmaster-daemon.git;a=blobdiff_plain;f=lib%2FGruntmaster%2FDaemon%2FRunner%2FFile.pm;fp=lib%2FGruntmaster%2FDaemon%2FRunner%2FFile.pm;h=bfa9a05aee774bdc798f71d1664499fa284c67fd;hp=3f4c863a1acefeebef9fd84b67c6b6eeeb121b5a;hb=a722431b0f35babda9d7da134824caf76ad75458;hpb=d6a1ae0d77398b2a7ed967e10e8420ac7d9980e5 diff --git a/lib/Gruntmaster/Daemon/Runner/File.pm b/lib/Gruntmaster/Daemon/Runner/File.pm index 3f4c863..bfa9a05 100644 --- a/lib/Gruntmaster/Daemon/Runner/File.pm +++ b/lib/Gruntmaster/Daemon/Runner/File.pm @@ -13,27 +13,27 @@ our $VERSION = "5999.000_002"; ################################################## sub run{ - my ($test, $meta) = @_; - get_logger->trace("Running on test $test..."); - $meta->{files}{prog}{run}->($meta->{files}{prog}{name}, fds => [qw/0 input 1 >output/], map {defined $meta->{$_} ? ($_ => $meta->{$_}) : () } qw/timeout olimit mlimit/); - my $out = slurp 'output'; - my $ok; - if (exists $meta->{okfile}) { - $ok = $meta->{okfile}[$test - 1] - } else { - my $ct = defined $Gruntmaster::Data::contest ? "ct/$Gruntmaster::Data::contest" : ''; - $ok = slurp "/var/lib/gruntmasterd/$ct/pb/$meta->{problem}/$test.ok" - } - - $out =~ s/^\s+//; - $ok =~ s/^\s+//; - $out =~ s/\s+/ /; - $ok =~ s/\s+/ /; - $out =~ s/\s+$//; - $ok =~ s/\s+$//; - - die [WA, "Wrong answer"] if $out ne $ok; - $meta->{tests}[$test - 1] // 0 + my ($test, $meta) = @_; + get_logger->trace("Running on test $test..."); + $meta->{files}{prog}{run}->($meta->{files}{prog}{name}, fds => [qw/0 input 1 >output/], map {defined $meta->{$_} ? ($_ => $meta->{$_}) : () } qw/timeout olimit mlimit/); + my $out = slurp 'output'; + my $ok; + if (exists $meta->{okfile}) { + $ok = $meta->{okfile}[$test - 1] + } else { + my $ct = defined $Gruntmaster::Data::contest ? "ct/$Gruntmaster::Data::contest" : ''; + $ok = slurp "/var/lib/gruntmasterd/$ct/pb/$meta->{problem}/$test.ok" + } + + $out =~ s/^\s+//; + $ok =~ s/^\s+//; + $out =~ s/\s+/ /; + $ok =~ s/\s+/ /; + $out =~ s/\s+$//; + $ok =~ s/\s+$//; + + die [WA, "Wrong answer"] if $out ne $ok; + $meta->{tests}[$test - 1] // 0 } 1;