Show More
Commit Description:
handle the case when problem id or submission id is null. Grader will simply skip such request. Add more report on console (for command line grading)...
Commit Description:
handle the case when problem id or submission id is null. Grader will simply skip such request. Add more report on console (for command line grading) (mercurial grafted from d233105d3965c5368c9b33125f390e39b25f910e)
File last commit:
Show/Diff file:
Action:
templates/check_wrapper | 48 lines | 1.2 KiB | text/plain | TextLexer |
jittat
[grader] added check_wrapper...
r28 #!/usr/bin/ruby
#
# This is a check script wrapper. It read all required information
# and call a real check script call REAL_CHECK_SCRIPT in directory
# [problem_home]/script
#
REAL_CHECK_SCRIPT = "<%= script_name %>"
# The REAL_CHECK_SCRIPT is called with:
#
# (script) <lang> <test-num> <in-file> <out-file> <ans-file> <full-score>
#
# and REAL_CHECK_SCRIPT's output to standard out is redirected to
# 'check_result' as required by normal check script.
problem_home = ENV['PROBLEM_HOME']
require "#{problem_home}/script/test_dsl.rb"
if ARGV.length < 2
puts "Usage: check <language> <test-number> [<output-file>]"
exit(0)
end
language = ARGV[0]
test_num = ARGV[1].to_i
if ARGV.length >= 3
output_file_name = ARGV[2]
else
output_file_name = "output.txt"
end
load "#{problem_home}/test_cases/all_tests.cfg"
problem = Problem.get_instance
jittat
[grader] fixed: import_problem (error in erb calls), check_wrapper; better error handling -- will get 0 score for a particular test run that fails...
r31 answer_file_name = "#{problem_home}/test_cases/#{test_num}/answer-#{test_num}.txt"
input_file_name = "#{problem_home}/test_cases/#{test_num}/input-#{test_num}.txt"
jittat
[grader] added check_wrapper...
r28
jittat
[grader] fixed: import_problem (error in erb calls), check_wrapper; better error handling -- will get 0 score for a particular test run that fails...
r31 score = problem.get_score(test_num)
jittat
[grader] added check_wrapper...
r28
cmd = "#{problem_home}/script/#{REAL_CHECK_SCRIPT} " +
"#{language} #{test_num} #{input_file_name} #{output_file_name} " +
"#{answer_file_name} #{score} > check_result"
jittat
[grader] fixed: import_problem (error in erb calls), check_wrapper; better error handling -- will get 0 score for a particular test run that fails...
r31 #puts "wrapper-CMD: #{cmd}"
system(cmd)