]> iEval git - gruntmaster-daemon.git/blame - lib/Gruntmaster/Daemon/Runner/Verifier.pm
Default Verifier/Interactive result to 'Ok'
[gruntmaster-daemon.git] / lib / Gruntmaster / Daemon / Runner / Verifier.pm
CommitLineData
5c5cd38a
MG
1package Gruntmaster::Daemon::Runner::Verifier;
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/;
10use Try::Tiny;
11
3e7fd903 12our $VERSION = '5999.000_004';
bc372959 13
5c5cd38a
MG
14##################################################
15
16sub run{
a722431b
MG
17 my ($test, $meta) = @_;
18 get_logger->trace("Running on test $test...");
11ddb278 19 $meta->{files}{prog}{run}->($meta->{files}{prog}{name}, fds => [qw/0 input 1 >output/], map { $_ => $meta->{$_} } qw/timeout olimit mlimit/);
5c5cd38a 20
a722431b
MG
21 try {
22 $meta->{files}{ver}{run}->($meta->{files}{ver}{name}, fds => [qw/0 input 3 output 1 >result/], args => [$test]);
23 } catch {
99d37110 24 die [WA, 'Wrong answer'] ## no critic (RequireCarping)
a722431b 25 };
34a91d9a 26 scalar slurp 'result' or 'Ok';
5c5cd38a
MG
27}
28
bc372959
MG
291;
30__END__
31
32=encoding utf-8
33
34=head1 NAME
35
36Gruntmaster::Daemon::Runner::Verifier - Check the program output with a verifier
37
38=head1 SYNOPSIS
39
40 use Gruntmaster::Daemon::Runner::Verifier;
0005d3ad 41 Gruntmaster::Daemon::Runner::Verifier::run(5, $meta);
bc372959
MG
42
43=head1 DESCRIPTION
44
45Gruntmaster::Daemon::Runner::Verifier is a runner which uses a verifier program to check the correctness of the output.
46
47The verifier program, C<< $meta->{files}{ver} >>, reads the test input from stdin and the output from fd 3. If the output is incorrect, it should return a nonzero value. Otherwise, it should print the score on this test and then return 0.
48
49=head1 AUTHOR
50
51Marius Gavrilescu E<lt>marius@ieval.roE<gt>
52
53=head1 COPYRIGHT AND LICENSE
54
55Copyright (C) 2014 by Marius Gavrilescu
56
57This library is free software: you can redistribute it and/or modify
58it under the terms of the GNU Affero General Public License as published by
59the Free Software Foundation, either version 3 of the License, or
60(at your option) any later version.
61
62
63=cut
This page took 0.05879 seconds and 4 git commands to generate.