Description:
fixed: grader crashes when the problem has no test data git-svn-id: http://theory.cpe.ku.ac.th/grader/judge/trunk/scripts@431 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r83:285efa98811f - - 1 file changed: 5 inserted, 1 deleted

@@ -62,12 +62,16
62 @room_maker.save_source(submission,source_name)
62 @room_maker.save_source(submission,source_name)
63 problem_home = @room_maker.find_problem_home(submission)
63 problem_home = @room_maker.find_problem_home(submission)
64
64
65 # puts "GRADING DIR: #{grading_dir}"
65 # puts "GRADING DIR: #{grading_dir}"
66 # puts "PROBLEM DIR: #{problem_home}"
66 # puts "PROBLEM DIR: #{problem_home}"
67
67
68 + if !FileTest.exist?(problem_home)
69 + raise "No test data."
70 + end
71 +
68 dinit = DirInit::Manager.new(problem_home)
72 dinit = DirInit::Manager.new(problem_home)
69
73
70 dinit.setup do
74 dinit.setup do
71 copy_log = copy_script(problem_home)
75 copy_log = copy_script(problem_home)
72 save_copy_log(problem_home,copy_log)
76 save_copy_log(problem_home,copy_log)
73 end
77 end
@@ -80,13 +84,13
80 copy_log = load_copy_log(problem_home)
84 copy_log = load_copy_log(problem_home)
81 clear_copy_log(problem_home)
85 clear_copy_log(problem_home)
82 clear_script(copy_log,problem_home)
86 clear_script(copy_log,problem_home)
83 end
87 end
84
88
85 rescue RuntimeError => msg
89 rescue RuntimeError => msg
86 - @reporter.report_error(submission,"Grading error: #{msg}")
90 + @reporter.report_error(submission, msg)
87
91
88 ensure
92 ensure
89 @room_maker.clean_up(submission)
93 @room_maker.clean_up(submission)
90 Dir.chdir(current_dir) # this is really important
94 Dir.chdir(current_dir) # this is really important
91 end
95 end
92 end
96 end
You need to be logged in to leave comments. Login now