Description:
more commenting on script
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r257:98303143aafa - - 3 files changed: 24 inserted, 2 deleted
@@ -78,6 +78,7 | |||||
|
78 | end |
|
78 | end |
|
79 |
|
79 | ||
|
80 | talk "ENGINE: grading dir at #{grading_dir} is created" |
|
80 | talk "ENGINE: grading dir at #{grading_dir} is created" |
|
|
81 | + talk "ENGINE: located problem home at #{problem_home} is created" | ||
|
81 |
|
82 | ||
|
82 | # copy the source script, using lock |
|
83 | # copy the source script, using lock |
|
83 | dinit = DirInit::Manager.new(problem_home) |
|
84 | dinit = DirInit::Manager.new(problem_home) |
@@ -158,6 +158,8 | |||||
|
158 | # do nothing |
|
158 | # do nothing |
|
159 | end |
|
159 | end |
|
160 |
|
160 | ||
|
|
161 | + | ||
|
|
162 | + #copy the output of run script to each test-result folder | ||
|
161 | call_and_log("Cannot create directory #{test_result_dir}/#{test_num}") { |
|
163 | call_and_log("Cannot create directory #{test_result_dir}/#{test_num}") { |
|
162 | FileUtils.mkdir "#{test_result_dir}/#{test_num}" |
|
164 | FileUtils.mkdir "#{test_result_dir}/#{test_num}" |
|
163 | } |
|
165 | } |
@@ -1,5 +1,19 | |||||
|
1 | #!/usr/bin/env ruby |
|
1 | #!/usr/bin/env ruby |
|
2 |
|
2 | ||
|
|
3 | + ## | ||
|
|
4 | + # This program should be run in the sandbox dir containing the compiled file | ||
|
|
5 | + # (or source file for script language). It will call the sandbox program with | ||
|
|
6 | + # the given input and process the output of the sandbox | ||
|
|
7 | + # | ||
|
|
8 | + # If sandbox exit normally, this program will call the "check" script to do | ||
|
|
9 | + # scoring. Otherwise, it would record the error accordingly | ||
|
|
10 | + # | ||
|
|
11 | + # This program produces several file | ||
|
|
12 | + # * result - the result from check script | ||
|
|
13 | + # * comment - comment from sandbox | ||
|
|
14 | + # * output - output of the program | ||
|
|
15 | + # | ||
|
|
16 | + | ||
|
3 | require 'fileutils' |
|
17 | require 'fileutils' |
|
4 |
|
18 | ||
|
5 | def log(str='') |
|
19 | def log(str='') |
@@ -29,6 +43,11 | |||||
|
29 | system("g++ #{source} -o #{bin}") |
|
43 | system("g++ #{source} -o #{bin}") |
|
30 | end |
|
44 | end |
|
31 |
|
45 | ||
|
|
46 | + #------------------------------------------ | ||
|
|
47 | + # MAIN | ||
|
|
48 | + #------------------------------------------ | ||
|
|
49 | + | ||
|
|
50 | + #parse parameter | ||
|
32 | if ARGV.length < 2 || ARGV.length > 3 |
|
51 | if ARGV.length < 2 || ARGV.length > 3 |
|
33 | puts "Usage: run <language> <test-num> [<program-name>]" |
|
52 | puts "Usage: run <language> <test-num> [<program-name>]" |
|
34 | exit(127) |
|
53 | exit(127) |
@@ -51,13 +70,13 | |||||
|
51 | sandbox_dir = Dir.getwd |
|
70 | sandbox_dir = Dir.getwd |
|
52 |
|
71 | ||
|
53 | if problem.well_formed? == false |
|
72 | if problem.well_formed? == false |
|
54 | - log "RUN: The problem specification is not well formed." |
|
73 | + log "RUN: ERROR: The problem specification is not well formed." |
|
55 | exit(127) |
|
74 | exit(127) |
|
56 | end |
|
75 | end |
|
57 |
|
76 | ||
|
58 | # Check if the test number is okay. |
|
77 | # Check if the test number is okay. |
|
59 | if test_num <= 0 || test_num > problem.num_tests |
|
78 | if test_num <= 0 || test_num > problem.num_tests |
|
60 | - log "RUN: You have specified a wrong test number." |
|
79 | + log "RUN: ERROR: You have specified a wrong test number." |
|
61 | exit(127) |
|
80 | exit(127) |
|
62 | end |
|
81 | end |
|
63 |
|
82 |
You need to be logged in to leave comments.
Login now