my %files = exists $meta->{files} ? %{$meta->{files}} : ();
$meta = {
%$meta,
+ problem => $_,
(defined problem_generator() ? (generator => problem_generator) : ()),
(defined problem_runner() ? (runner => problem_runner) : ()),
(defined problem_judge() ? (judge => problem_judge) : ()),
use strict;
use warnings;
+use File::Copy qw/copy/;
use File::Slurp qw/write_file/;
use Log::Log4perl qw/get_logger/;
sub generate{
my ($test, $meta) = @_;
get_logger->trace("Generating test $test ...");
- write_file 'input', $meta->{infile}[$test - 1]
+ if (exists $meta->{infile}) {
+ write_file 'input', $meta->{infile}[$test - 1]
+ } else {
+ copy "/var/lib/gruntmasterd/pb/$meta->{problem}/$test.in", 'input'
+ }
}
1;
get_logger->trace("Running on test $test...");
$meta->{files}{prog}{run}->($meta->{files}{prog}{name}, fds => [qw/0 input 1 >output/], map {defined $meta->{$_} ? ($_ => $meta->{$_}) : () } qw/timeout olimit mlimit/);
my $out = slurp 'output';
- my $ok = $meta->{okfile}[$test - 1];
+ my $ok;
+ if (exists $meta->{okfile}) {
+ $ok = $meta->{okfile}[$test - 1]
+ } else {
+ $ok = slurp "/var/lib/gruntmasterd/pb/$meta->{problem}/$test.ok"
+ }
$out =~ s/^\s+//;
$ok =~ s/^\s+//;
/usr/(local/)?bin/gruntmaster-exec gen_context(system_u:object_r:gruntmaster_job_exec_t, s0)
/usr/(local/)?bin/gruntmaster-paged gen_context(system_u:object_r:gruntmaster_paged_exec_t, s0)
/etc/gruntmasterd(/.*)? gen_context(system_u:object_r:gruntmasterd_etc_t, s0)
+/var/lib/gruntmasterd(/.*)? gen_context(system_u:object_r:gruntmasterd_var_lib_t, s0)
/var/log/gruntmasterd gen_context(system_u:object_r:gruntmasterd_log_t, s0)
type gruntmasterd_exec_t;
type gruntmasterd_log_t;
type gruntmasterd_tmp_t;
+type gruntmasterd_var_lib_t;
type gruntmaster_job_t;
type gruntmaster_job_exec_t;
type gruntmaster_compile_t;
type_transition gruntmasterd_t tmp_t : dir gruntmasterd_tmp_t;
files_type(gruntmasterd_tmp_t)
files_type(gruntmasterd_etc_t)
+files_type(gruntmasterd_var_lib_t)
# Daemon permissions
allow gruntmasterd_t { gruntmaster_compile_t gruntmaster_job_t } : process { sigkill siginh rlimitinh transition };
gruntmaster_read(bin_t)
gruntmaster_read(gruntmaster_compile_exec_t)
gruntmaster_read(gruntmasterd_etc_t)
+gruntmaster_read(gruntmasterd_var_lib_t)
gruntmaster_read(gruntmaster_job_exec_t)
gruntmaster_read(httpd_sys_content_t)
gruntmaster_read(lib_t)