]>
iEval git - gruntmaster-daemon.git/blob - lib/Gruntmaster/Daemon/Runner/File.pm
1 package Gruntmaster
:: Daemon
:: Runner
:: File
;
8 use Gruntmaster
:: Daemon
:: Constants qw
/WA/ ;
9 use File
:: Slurp qw
/slurp/ ;
10 use Log
:: Log4perl qw
/get_logger/ ;
12 our $VERSION = '5999.000_004' ;
14 ##################################################
17 my ( $test , $meta ) = @_ ;
18 get_logger
-> trace ( "Running on test $test ..." );
19 $meta ->{ files
}{ prog
}{ run
}->( $meta ->{ files
}{ prog
}{ name
}, fds
=> [ qw
/0 input 1 >output/ ], map { $_ => $meta ->{ $_ } } qw
/timeout olimit mlimit/ );
20 my $out = slurp
'output' ;
22 if ( exists $meta ->{ okfile
}) { # uncoverable branch false
23 $ok = $meta ->{ okfile
}[ $test - 1 ]
25 $ok = slurp
"/var/lib/gruntmasterd/pb/ $meta ->{problem}/ $test .ok" # uncoverable statement
35 die [ WA
, 'Wrong answer' ] if $out ne $ok ; ## no critic (RequireCarping)
36 $meta ->{ tests
}[ $test - 1 ] // 0
46 Gruntmaster::Daemon::Runner::File - Compare output with static text files
50 use Gruntmaster::Daemon::Runner::File;
51 Gruntmaster::Daemon::Runner::File::run(5, $meta);
55 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.
57 If C<< $meta->{okfile} >> exists, the output is compared to C<< $meta->{okfile}[$test - 1] >>.
58 Otherwise, the output is compared to F<< /var/lib/gruntmasterd/pb/$meta->{problem}/$test.ok >>.
60 If the two strings match, the verdict is C<< $meta->{tests}[$test - 1] >>. Otherwise, the verdict is C<[WA, "Wrong answer"]>.
64 Marius Gavrilescu E<lt>marius@ieval.roE<gt>
66 =head1 COPYRIGHT AND LICENSE
68 Copyright (C) 2014 by Marius Gavrilescu
70 This library is free software: you can redistribute it and/or modify
71 it under the terms of the GNU Affero General Public License as published by
72 the Free Software Foundation, either version 3 of the License, or
73 (at your option) any later version.
This page took 0.057217 seconds and 5 git commands to generate.