use File::Slurp qw/slurp/;
use Log::Log4perl qw/get_logger/;
-our $VERSION = "5999-TRIAL";
+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 = $meta->{okfile}[$test - 1];
-
- $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+/ /g;
+ $ok =~ s/\s+/ /g;
+ $out =~ s/\s+$//;
+ $ok =~ s/\s+$//;
+
+ die [WA, "Wrong answer"] if $out ne $ok;
+ $meta->{tests}[$test - 1] // 0
}
1;
=head1 DESCRIPTION
-Gruntmaster::Daemon::Runner::File is a runner which compares the program output for test C<$test> with C<< $meta->{tests}[$test - 1]>>. Before comparing, leading and trailing whitespace is removed, and sequences of whitespace are converted to a single space.
+Gruntmaster::Daemon::Runner::File is a runner which compares the program output for test C<$test> with C<< $meta->{tests}[$test - 1] >>. Before comparing, leading and trailing whitespace is removed, and sequences of whitespace are converted to a single space.
=head1 AUTHOR