Make gruntmasterd use Redis
[gruntmaster-daemon.git] / lib / Gruntmaster / Daemon / Runner / File.pm
CommitLineData
5c5cd38a
MG
1package Gruntmaster::Daemon::Runner::File;
2
3use 5.014000;
4use strict;
5use warnings;
6
7use Gruntmaster::Daemon::Constants qw/WA/;
8use File::Slurp qw/slurp/;
9use Log::Log4perl qw/get_logger/;
10
11##################################################
12
13sub run{
14 my ($test, $meta) = @_;
15 get_logger->trace("Running on test $test...");
16 $meta->{files}{prog}{run}->($meta->{files}{prog}{name}, fds => [qw/0 input 1 >output/], map {defined $meta->{$_} ? ($_ => $meta->{$_}) : () } qw/timeout olimit mlimit/);
17 my $out = slurp 'output';
ab436d78 18 my $ok = $meta->{okfile}[$test - 1];
5c5cd38a
MG
19
20 $out =~ s/^\s+//;
21 $ok =~ s/^\s+//;
22 $out =~ s/\s+/ /;
23 $ok =~ s/\s+/ /;
24 $out =~ s/\s+$//;
25 $ok =~ s/\s+$//;
26
27 die [WA, "Wrong answer"] if $out ne $ok;
28 $meta->{tests}[$test - 1] // 0
29}
30
311
This page took 0.024188 seconds and 4 git commands to generate.