Description:
added quick hack on running scripts, and compiler calls
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r111:06c23d391544 - - 4 files changed: 13 inserted, 11 deleted

@@ -117,7 +117,7
117 Dir.chdir grading_dir
117 Dir.chdir grading_dir
118 cmd = "#{problem_home}/script/judge #{language} #{fname}"
118 cmd = "#{problem_home}/script/judge #{language} #{fname}"
119 talk "CMD: #{cmd}"
119 talk "CMD: #{cmd}"
120 - system(cmd)
120 + system("ruby " + cmd)
121 end
121 end
122
122
123 def get_std_script_dir
123 def get_std_script_dir
@@ -23,9 +23,9
23 end
23 end
24 end
24 end
25
25
26 - C_COMPILER = "/usr/bin/gcc"
26 + C_COMPILER = "gcc"
27 - CPLUSPLUS_COMPILER = "/usr/bin/g++"
27 + CPLUSPLUS_COMPILER = "g++"
28 - PASCAL_COMPILER = "/usr/bin/fpc"
28 + PASCAL_COMPILER = "fpc"
29
29
30 C_OPTIONS = "-O2 -s -static -std=c99 -DCONTEST -lm -Wall"
30 C_OPTIONS = "-O2 -s -static -std=c99 -DCONTEST -lm -Wall"
31 CPLUSPLUS_OPTIONS = "-O2 -s -static -DCONTEST -lm -Wall"
31 CPLUSPLUS_OPTIONS = "-O2 -s -static -DCONTEST -lm -Wall"
@@ -98,9 +98,11
98 log "ERROR: Cannot change directory to #{sandbox_dir}."
98 log "ERROR: Cannot change directory to #{sandbox_dir}."
99 exit(127)
99 exit(127)
100 end
100 end
101 - execute("#{problem_home}/script/compile #{language} #{source_file}", "Compilation error!")
101 + execute("ruby #{problem_home}/script/compile #{language} #{source_file}", "Compilation error!")
102 - compile_message = open("compiler_message").read
102 + open("compiler_message") do |f|
103 - compile_message.strip!
103 + compile_message = f.read
104 + compile_message.strip!
105 + end
104 call_and_log("Cannot move the compiler message to #{test_result_dir}.") {
106 call_and_log("Cannot move the compiler message to #{test_result_dir}.") {
105 FileUtils.mv("compiler_message", test_result_dir)
107 FileUtils.mv("compiler_message", test_result_dir)
106 }
108 }
@@ -134,7 +136,7
134 FileUtils.cp("#{test_result_dir}/a.out", sandbox_dir)
136 FileUtils.cp("#{test_result_dir}/a.out", sandbox_dir)
135 }
137 }
136 begin
138 begin
137 - execute("#{problem_home}/script/run #{language} #{test_num}", "Error occured during execution of the run script")
139 + execute("ruby #{problem_home}/script/run #{language} #{test_num}", "Error occured during execution of the run script")
138 rescue
140 rescue
139 # do nothing
141 # do nothing
140 end
142 end
@@ -166,7 +168,7
166 log "ERROR: Cannot change directory to #{test_result_dir}."
168 log "ERROR: Cannot change directory to #{test_result_dir}."
167 exit(127)
169 exit(127)
168 end
170 end
169 - execute("#{problem_home}/script/grade", "An error occured during grading!")
171 + execute("ruby #{problem_home}/script/grade", "An error occured during grading!")
170
172
171 log
173 log
172 log "All done!"
174 log "All done!"
@@ -73,7 +73,7
73 #`cp #{problem_home}/test_cases/#{test_num}/#{input_file_name} .`
73 #`cp #{problem_home}/test_cases/#{test_num}/#{input_file_name} .`
74
74
75 # check if box is there, if not, compile it!
75 # check if box is there, if not, compile it!
76 - if !File.exists?("#{problem_home}/script/box")
76 + if !File.exists?("#{problem_home}/script/box") and !File.exists?("#{problem_home}/script/box.exe")
77 log "WARNING: Compiling box: to increase efficiency, it should be compile manually"
77 log "WARNING: Compiling box: to increase efficiency, it should be compile manually"
78 compile_box("#{problem_home}/script/box.cc",
78 compile_box("#{problem_home}/script/box.cc",
79 "#{problem_home}/script/box")
79 "#{problem_home}/script/box")
@@ -145,7 +145,7
145 check_command = "#{problem_home}/script/check #{language} #{test_num}"
145 check_command = "#{problem_home}/script/check #{language} #{test_num}"
146 log "Checking the output..."
146 log "Checking the output..."
147 log check_command
147 log check_command
148 - if not system(check_command)
148 + if not system("ruby " + check_command)
149 log "Problem with check script"
149 log "Problem with check script"
150 report.call("Incorrect",0,"Check script error.\n")
150 report.call("Incorrect",0,"Check script error.\n")
151 exit(127)
151 exit(127)
You need to be logged in to leave comments. Login now