Make gruntmasterd use Redis
[gruntmaster-daemon.git] / lib / Gruntmaster / Daemon / Runner / File.pm
1 package Gruntmaster::Daemon::Runner::File;
2
3 use 5.014000;
4 use strict;
5 use warnings;
6
7 use Gruntmaster::Daemon::Constants qw/WA/;
8 use File::Slurp qw/slurp/;
9 use Log::Log4perl qw/get_logger/;
10
11 ##################################################
12
13 sub 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';
18 my $ok = $meta->{okfile}[$test - 1];
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
31 1
This page took 0.042505 seconds and 4 git commands to generate.