Description:
[grader] test_request: fixed error when input file is not found, or input file remains in problem home git-svn-id: http://theory.cpe.ku.ac.th/grader/judge/trunk/scripts@171 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

r45:dafc790ec9b7 - - 1 file changed: 17 inserted, 2 deleted

@@ -75,7 +75,17
75 75 end
76 76
77 77 def link_input_file(test_request,problem_home)
78 - cmd = "ln -s #{test_request.input_file_name} #{problem_home}/test_cases/1/input-1.txt"
78 + input_fname = "#{test_request.input_file_name}"
79 + if !File.exists?(input_fname)
80 + raise "Test Request: input file not found."
81 + end
82 +
83 + input_fname_problem_home = "#{problem_home}/test_cases/1/input-1.txt"
84 + if File.exists?(input_fname_problem_home)
85 + FileUtils.rm([input_fname_problem_home], :force => true)
86 + end
87 +
88 + cmd = "ln -s #{input_fname} #{input_fname_problem_home}"
79 89 system_and_raise_when_fail(cmd,"Test Request: cannot link input file")
80 90 end
81 91
@@ -104,7 +114,12
104 114 end
105 115
106 116 def report_error(test_request, msg)
107 - save_result(test_request, {:running_stat => {:msg => "#{msg}"}})
117 + save_result(test_request, {:running_stat => {
118 + :msg => "#{msg}",
119 + :running_time => nil,
120 + :exit_status => "Some error occured. Program did not run",
121 + :memory_usage => nil
122 + }})
108 123 end
109 124
110 125 protected
You need to be logged in to leave comments. Login now