d521acf40c033c0056884b6ac5859df554473040
1 package Gruntmaster
::Daemon
::Runner
::File
;
8 use Gruntmaster
::Daemon
::Constants qw
/WA/;
9 use Gruntmaster
::Daemon
::Format qw
/copy_to_vm copy_from_vm/;
10 use File
::Slurp qw
/slurp/;
11 use Log
::Log4perl qw
/get_logger/;
13 our $VERSION = '5999.000_005';
15 ##################################################
18 my ($test, $meta) = @_;
19 get_logger
->trace("Running on test $test...");
21 $meta->{files
}{prog
}{run
}->($meta->{files
}{prog
}{name
}, fds
=> [qw
/0 input 1 >output/], map { $_ => $meta->{$_} } qw
/timeout olimit mlimit/);
22 copy_from_vm
'output';
23 my $out = slurp
'output';
25 if (exists $meta->{okfile
}) { # uncoverable branch false
26 $ok = $meta->{okfile
}[$test - 1]
28 $ok = slurp
"/var/lib/gruntmasterd/pb/$meta->{problem}/$test.ok" # uncoverable statement
38 die [WA
, 'Wrong answer'] if $out ne $ok; ## no critic (RequireCarping)
39 $meta->{tests
}[$test - 1] // 0
49 Gruntmaster::Daemon::Runner::File - Compare output with static text files
53 use Gruntmaster::Daemon::Runner::File;
54 Gruntmaster::Daemon::Runner::File::run(5, $meta);
58 Gruntmaster::Daemon::Runner::File is a runner which compares the program output for test C<$test> with a static output. Before comparing, leading and trailing whitespace is removed, and sequences of whitespace are converted to a single space.
60 If C<< $meta->{okfile} >> exists, the output is compared to C<< $meta->{okfile}[$test - 1] >>.
61 Otherwise, the output is compared to F<< /var/lib/gruntmasterd/pb/$meta->{problem}/$test.ok >>.
63 If the two strings match, the verdict is C<< $meta->{tests}[$test - 1] >>. Otherwise, the verdict is C<[WA, "Wrong answer"]>.
67 Marius Gavrilescu E<lt>marius@ieval.roE<gt>
69 =head1 COPYRIGHT AND LICENSE
71 Copyright (C) 2014 by Marius Gavrilescu
73 This library is free software: you can redistribute it and/or modify
74 it under the terms of the GNU Affero General Public License as published by
75 the Free Software Foundation, either version 3 of the License, or
76 (at your option) any later version.
This page took 0.02495 seconds and 4 git commands to generate.