From: Marius Gavrilescu Date: Fri, 31 Jan 2014 21:53:54 +0000 (+0200) Subject: Update documentation and version X-Git-Tag: 5999.000_001~13 X-Git-Url: http://git.ieval.ro/?p=gruntmaster-daemon.git;a=commitdiff_plain;h=bc3729599a66921e1efd9f801222e814c626ea76;hp=ad77b7d3dee6e61405535dd0dabd117398731ad1 Update documentation and version --- diff --git a/lib/Gruntmaster/Daemon.pm b/lib/Gruntmaster/Daemon.pm index a4d1902..f2b1ede 100644 --- a/lib/Gruntmaster/Daemon.pm +++ b/lib/Gruntmaster/Daemon.pm @@ -4,7 +4,7 @@ use 5.014000; use strict; use warnings; -our $VERSION = '0.001'; +our $VERSION = '5999-TRIAL'; use Gruntmaster::Daemon::Constants qw/ERR/; use Gruntmaster::Daemon::Format qw/prepare_files/; @@ -139,48 +139,32 @@ sub run{ 1; __END__ -# Below is stub documentation for your module. You'd better edit it! =head1 NAME -Gruntmaster::Daemon - Perl extension for blah blah blah +Gruntmaster::Daemon - Gruntmaster 6000 Online Judge -- daemon =head1 SYNOPSIS use Gruntmaster::Daemon; - blah blah blah + Gruntmaster::Daemon->run; =head1 DESCRIPTION -Stub documentation for Gruntmaster::Daemon, created by h2xs. It looks like the -author of the extension was negligent enough to leave the stub -unedited. - -Blah blah blah. - - -=head1 SEE ALSO - -Mention other useful documentation such as the documentation of -related modules or operating system documentation (such as man pages -in UNIX), or any relevant external documentation such as RFCs or -standards. - -If you have a mailing list set up for your module, mention it here. - -If you have a web site set up for your module, mention it here. +Gruntmaster::Daemon is the daemon component of the Gruntmaster 6000 online judge. =head1 AUTHOR -Marius Gavrilescu, Emarius@E +Marius Gavrilescu Emarius@ieval.roE =head1 COPYRIGHT AND LICENSE -Copyright (C) 2013 by Marius Gavrilescu +Copyright (C) 2014 by Marius Gavrilescu -This library is free software; you can redistribute it and/or modify -it under the same terms as Perl itself, either Perl version 5.18.1 or, -at your option, any later version of Perl 5 you may have available. +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. =cut diff --git a/lib/Gruntmaster/Daemon/Constants.pm b/lib/Gruntmaster/Daemon/Constants.pm index 189aabe..5117cdd 100644 --- a/lib/Gruntmaster/Daemon/Constants.pm +++ b/lib/Gruntmaster/Daemon/Constants.pm @@ -5,7 +5,7 @@ use strict; use warnings; use parent qw/Exporter/; -our $VERSION = '0.001'; +our $VERSION = "5999-TRIAL"; use constant +{ # Accepted @@ -24,3 +24,61 @@ use constant +{ }; our @EXPORT_OK = qw/AC ERR WA NZX TLE OLE DIED REJ/; + +1; +__END__ + +=encoding utf-8 + +=head1 NAME + +Gruntmaster::Daemon::Constants - Constants for the Gruntmaster daemon + +=head1 SYNOPSIS + + use Gruntmaster::Daemon::Constants qw/WA NZX/; + ... + return [NZX, 'Non-zero exit status'] if $status; + return [WA, 'Wrong answer'] unless is_correct($answer); + +=head1 DESCRIPTION + +Gruntmaster::Daemon::Constants provides constants which are used in more than one module. + +The constants are: + +=over + +=item B The 'Accepted' job result. + +=item B The 'Internal server error' job result. + +=item B The 'Wrong answer' job result. + +=item B The 'Non-zero exit status' job result. + +=item B The 'Time limit exceeded' job result. + +=item B The 'Output limit exceeded' job result. + +=item B The 'Crash' job result. Used when a program is killed by a signal. + +=item B The 'Rejected' job result. Used when none of the above is appropriate. + +=back + +=head1 AUTHOR + +Marius Gavrilescu Emarius@ieval.roE + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2014 by Marius Gavrilescu + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + + +=cut diff --git a/lib/Gruntmaster/Daemon/Format.pm b/lib/Gruntmaster/Daemon/Format.pm index 3c0a84e..86c194a 100644 --- a/lib/Gruntmaster/Daemon/Format.pm +++ b/lib/Gruntmaster/Daemon/Format.pm @@ -13,7 +13,7 @@ use Time::HiRes qw/alarm/; use List::MoreUtils qw/natatime/; use IPC::Signal qw/sig_name sig_num/; -our $VERSION = '0.001'; +our $VERSION = "5999-TRIAL"; our @EXPORT_OK = qw/prepare_files/; ################################################## @@ -91,4 +91,55 @@ sub prepare_files{ } } -1 +1; +__END__ + +=encoding utf-8 + +=head1 NAME + +Gruntmaster::Daemon::Format - Utility functions for handling source files + +=head1 SYNOPSIS + + use Gruntmaster::Daemon::Format qw/prepare_files/; + prepare_files { files => { + prog => { + name => 'prog.pl', + format => 'PERL', + content => 'print "Hello, world!"' + }, + ver => { + name => 'ver.cpp', + format => 'CPP', + content => ... + }, + }}; + +=head1 DESCRIPTION + +Gruntmaster::Daemon::Format exports utility functions for handling source files. + +=over + +=item B I<$meta> + +Compiles all the source files in C<< $meta->{files} >>. + +=back + +=head1 AUTHOR + +Marius Gavrilescu Emarius@ieval.roE + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2014 by Marius Gavrilescu + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + + +=cut diff --git a/lib/Gruntmaster/Daemon/Generator/File.pm b/lib/Gruntmaster/Daemon/Generator/File.pm index 0531def..5a809eb 100644 --- a/lib/Gruntmaster/Daemon/Generator/File.pm +++ b/lib/Gruntmaster/Daemon/Generator/File.pm @@ -7,7 +7,7 @@ use warnings; use File::Slurp qw/write_file/; use Log::Log4perl qw/get_logger/; -our $VERSION = '0.001'; +our $VERSION = "5999-TRIAL"; ################################################## @@ -17,4 +17,36 @@ sub generate{ write_file 'input', $meta->{infile}[$test - 1] } -1 +1; +__END__ + +=encoding utf-8 + +=head1 NAME + +Gruntmaster::Daemon::Generator::File - Generate tests from files + +=head1 SYNOPSIS + + use Gruntmaster::Daemon::Generator::File; + Gruntmaster::Daemon::Generator::File->generate(5, $meta); + +=head1 DESCRIPTION + +Gruntmaster::Daemon::Generator::File is a static test generator. Test C<$i> is C<< $meta->{infile}[$i - 1] >>. + +=head1 AUTHOR + +Marius Gavrilescu Emarius@ieval.roE + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2014 by Marius Gavrilescu + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + + +=cut diff --git a/lib/Gruntmaster/Daemon/Generator/Run.pm b/lib/Gruntmaster/Daemon/Generator/Run.pm index 54e1118..b3e0e4e 100644 --- a/lib/Gruntmaster/Daemon/Generator/Run.pm +++ b/lib/Gruntmaster/Daemon/Generator/Run.pm @@ -17,4 +17,36 @@ sub generate{ $gen->{run}->($gen->{name}, args => [ $test ], fds => [qw/1 >input/]); } -1 +1; +__END__ + +=encoding utf-8 + +=head1 NAME + +Gruntmaster::Daemon::Generator::Run - Generate tests from program output + +=head1 SYNOPSIS + + use Gruntmaster::Daemon::Generator::Run; + Gruntmaster::Daemon::Generator::Run->generate(5, $meta); + +=head1 DESCRIPTION + +Gruntmaster::Daemon::Generator::Run is a dynamic test generator. Test C<$i> is the output of running C<< $meta->{files}{gen} >> with argument C<$i>. + +=head1 AUTHOR + +Marius Gavrilescu Emarius@ieval.roE + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2014 by Marius Gavrilescu + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + + +=cut diff --git a/lib/Gruntmaster/Daemon/Generator/Undef.pm b/lib/Gruntmaster/Daemon/Generator/Undef.pm index 836a4be..7ccb887 100644 --- a/lib/Gruntmaster/Daemon/Generator/Undef.pm +++ b/lib/Gruntmaster/Daemon/Generator/Undef.pm @@ -6,7 +6,7 @@ use warnings; use Log::Log4perl qw/get_logger/; -our $VERSION = '0.001'; +our $VERSION = "5999-TRIAL"; ################################################## @@ -14,4 +14,36 @@ sub generate{ get_logger->trace("Pretending to generate test $_[0]..."); } -1 +1; +__END__ + +=encoding utf-8 + +=head1 NAME + +Gruntmaster::Daemon::Generator::Undef - Pretend to generate tests + +=head1 SYNOPSIS + + use Gruntmaster::Daemon::Generator::Undef; + Gruntmaster::Daemon::Generator::Undef->generate(5, $meta); + +=head1 DESCRIPTION + +Gruntmaster::Daemon::Generator::Undef is a noop test generator. It is useful for L problems, where there is no input. + +=head1 AUTHOR + +Marius Gavrilescu Emarius@ieval.roE + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2014 by Marius Gavrilescu + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + + +=cut diff --git a/lib/Gruntmaster/Daemon/Judge/Absolute.pm b/lib/Gruntmaster/Daemon/Judge/Absolute.pm index 2adea01..f6792c3 100644 --- a/lib/Gruntmaster/Daemon/Judge/Absolute.pm +++ b/lib/Gruntmaster/Daemon/Judge/Absolute.pm @@ -6,7 +6,7 @@ use warnings; use Gruntmaster::Daemon::Constants qw/AC/; -our $VERSION = '0.001'; +our $VERSION = '5999-TRIAL'; ################################################## diff --git a/lib/Gruntmaster/Daemon/Judge/Points.pm b/lib/Gruntmaster/Daemon/Judge/Points.pm index e75aeb2..6e6563b 100644 --- a/lib/Gruntmaster/Daemon/Judge/Points.pm +++ b/lib/Gruntmaster/Daemon/Judge/Points.pm @@ -7,7 +7,8 @@ use warnings; use Gruntmaster::Daemon::Constants qw/AC REJ/; use List::Util qw/sum/; use Log::Log4perl qw/get_logger/; -our $VERSION = '0.001'; + +our $VERSION = '5999-TRIAL'; ################################################## diff --git a/lib/Gruntmaster/Daemon/Runner/File.pm b/lib/Gruntmaster/Daemon/Runner/File.pm index 50f5186..00d38fd 100644 --- a/lib/Gruntmaster/Daemon/Runner/File.pm +++ b/lib/Gruntmaster/Daemon/Runner/File.pm @@ -8,6 +8,8 @@ use Gruntmaster::Daemon::Constants qw/WA/; use File::Slurp qw/slurp/; use Log::Log4perl qw/get_logger/; +our $VERSION = "5999-TRIAL"; + ################################################## sub run{ @@ -28,4 +30,36 @@ sub run{ $meta->{tests}[$test - 1] // 0 } -1 +1; +__END__ + +=encoding utf-8 + +=head1 NAME + +Gruntmaster::Daemon::Runner::File - Compare output with static text files + +=head1 SYNOPSIS + + use Gruntmaster::Daemon::Runner::File; + Gruntmaster::Daemon::Runner::File->run(5, $meta); + +=head1 DESCRIPTION + +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. + +=head1 AUTHOR + +Marius Gavrilescu Emarius@ieval.roE + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2014 by Marius Gavrilescu + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + + +=cut diff --git a/lib/Gruntmaster/Daemon/Runner/Interactive.pm b/lib/Gruntmaster/Daemon/Runner/Interactive.pm index 9c4580f..2d2fe91 100644 --- a/lib/Gruntmaster/Daemon/Runner/Interactive.pm +++ b/lib/Gruntmaster/Daemon/Runner/Interactive.pm @@ -10,6 +10,8 @@ use Log::Log4perl qw/get_logger/; use POSIX qw/mkfifo/; use Try::Tiny; +our $VERSION = '5999-TRIAL'; + ################################################## sub run{ @@ -36,5 +38,4 @@ sub run{ scalar slurp 'result' } -1; -__END__ +1 diff --git a/lib/Gruntmaster/Daemon/Runner/Verifier.pm b/lib/Gruntmaster/Daemon/Runner/Verifier.pm index 5a0b5ed..070fd0a 100644 --- a/lib/Gruntmaster/Daemon/Runner/Verifier.pm +++ b/lib/Gruntmaster/Daemon/Runner/Verifier.pm @@ -9,6 +9,8 @@ use File::Slurp qw/slurp/; use Log::Log4perl qw/get_logger/; use Try::Tiny; +our $VERSION = '5999-TRIAL'; + ################################################## sub run{ @@ -24,4 +26,38 @@ sub run{ scalar slurp 'result'; } -1 +1; +__END__ + +=encoding utf-8 + +=head1 NAME + +Gruntmaster::Daemon::Runner::Verifier - Check the program output with a verifier + +=head1 SYNOPSIS + + use Gruntmaster::Daemon::Runner::Verifier; + Gruntmaster::Daemon::Runner::Verifier->run(5, $meta); + +=head1 DESCRIPTION + +Gruntmaster::Daemon::Runner::Verifier is a runner which uses a verifier program to check the correctness of the output. + +The 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. + +=head1 AUTHOR + +Marius Gavrilescu Emarius@ieval.roE + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2014 by Marius Gavrilescu + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + + +=cut