]>
iEval git - gruntmaster-daemon.git/blob - Gruntmaster/Daemon/Runner/File.pm
1 package Gruntmaster
:: Daemon
:: Runner
:: File
;
7 use Gruntmaster
:: Daemon
:: Constants qw
/WA/ ;
8 use File
:: Slurp qw
/slurp/ ;
9 use Log
:: Log4perl qw
/get_logger/ ;
11 our $VERSION = "5999.000_001" ;
13 ##################################################
16 my ( $test , $meta ) = @_ ;
17 get_logger
-> trace ( "Running on test $test ..." );
18 $meta ->{ files
}{ prog
}{ run
}->( $meta ->{ files
}{ prog
}{ name
}, fds
=> [ qw
/0 input 1 >output/ ], map { defined $meta ->{ $_ } ?
( $_ => $meta ->{ $_ }) : () } qw
/timeout olimit mlimit/ );
19 my $out = slurp
'output' ;
21 if ( exists $meta ->{ okfile
}) {
22 $ok = $meta ->{ okfile
}[ $test - 1 ]
24 $ok = slurp
"/var/lib/gruntmasterd/pb/ $meta ->{problem}/ $test .ok"
34 die [ WA
, "Wrong answer" ] if $out ne $ok ;
35 $meta ->{ tests
}[ $test - 1 ] // 0
45 Gruntmaster::Daemon::Runner::File - Compare output with static text files
49 use Gruntmaster::Daemon::Runner::File;
50 Gruntmaster::Daemon::Runner::File->run(5, $meta);
54 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.
58 Marius Gavrilescu E<lt>marius@ieval.roE<gt>
60 =head1 COPYRIGHT AND LICENSE
62 Copyright (C) 2014 by Marius Gavrilescu
64 This library is free software: you can redistribute it and/or modify
65 it under the terms of the GNU Affero General Public License as published by
66 the Free Software Foundation, either version 3 of the License, or
67 (at your option) any later version.
This page took 0.053168 seconds and 4 git commands to generate.