From: Marius Gavrilescu Date: Sun, 9 Feb 2014 17:25:54 +0000 (+0200) Subject: Support problem parameters outside meta X-Git-Tag: 5999.000_002~7 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=6d590c603e3b14f1dc198e3635a85543565d1016;p=gruntmaster-daemon.git Support problem parameters outside meta --- diff --git a/lib/Gruntmaster/Daemon.pm b/lib/Gruntmaster/Daemon.pm index 82da6b8..7166a42 100644 --- a/lib/Gruntmaster/Daemon.pm +++ b/lib/Gruntmaster/Daemon.pm @@ -58,9 +58,19 @@ sub process{ try { $meta = job_inmeta $job; if (job_problem $job) { - my $pbmeta = problem_meta job_problem $job; + local $_ = job_problem $job; + my $pbmeta = problem_meta; my %files = exists $meta->{files} ? %{$meta->{files}} : (); - $meta = {%$meta, %$pbmeta}; + $meta = { + %$meta, + (defined problem_generator() ? (generator => problem_generator) : ()), + (defined problem_runner() ? (runner => problem_runner) : ()), + (defined problem_judge() ? (judge => problem_judge) : ()), + (defined problem_testcnt() ? (testcnt => problem_testcnt) : ()), + (defined problem_timeout() ? (timeout => problem_timeout) : ()), + (defined problem_olimit() ? (olimit => problem_olimit) : ()), + %$pbmeta + }; $meta->{files} = {%files, %{$pbmeta->{files}}} if exists $pbmeta->{files}; } diff --git a/t/FakeData.pm b/t/FakeData.pm index fe64241..f83c7c8 100644 --- a/t/FakeData.pm +++ b/t/FakeData.pm @@ -18,8 +18,14 @@ sub set_job_results { $jobs[$_[0]]{results} = $_[1] }; sub set_job_errors { $jobs[$_[0]]{errors} = $_[1] }; sub set_job_daemon { $jobs[$_[0]]{daemon} = $_[1] }; -sub problem_meta { $problems{$_[0]}{meta} } +sub problem_meta { $problems{$_}{meta} } sub set_problem_meta { $problems{$_[0]}{meta} = $_[1] } +sub problem_generator {} +sub problem_runner {} +sub problem_judge {} +sub problem_testcnt {} +sub problem_timeout {} +sub problem_olimit {} sub get_job { $jobs[$_[0]] }