Description:
removed commented dir clear scripts
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r138:34806c3fad9c - - 1 file changed: 1 inserted, 1 deleted
@@ -45,97 +45,97 | |||
|
45 | 45 | # TODO: this is another hack so that output only task can be judged |
|
46 | 46 | if submission.language!=nil |
|
47 | 47 | language = submission.language.name |
|
48 | 48 | lang_ext = submission.language.ext |
|
49 | 49 | else |
|
50 | 50 | language = 'c' |
|
51 | 51 | lang_ext = 'c' |
|
52 | 52 | end |
|
53 | 53 | |
|
54 | 54 | # This is needed because older version of std-scripts/compile |
|
55 | 55 | # only look for c++. |
|
56 | 56 | if language == 'cpp' |
|
57 | 57 | language = 'c++' |
|
58 | 58 | end |
|
59 | 59 | |
|
60 | 60 | # COMMENT: should it be only source.ext? |
|
61 | 61 | if problem!=nil |
|
62 | 62 | source_name = "#{problem.name}.#{lang_ext}" |
|
63 | 63 | else |
|
64 | 64 | source_name = "source.#{lang_ext}" |
|
65 | 65 | end |
|
66 | 66 | |
|
67 | 67 | begin |
|
68 | 68 | grading_dir = @room_maker.produce_grading_room(submission) |
|
69 | 69 | @room_maker.save_source(submission,source_name) |
|
70 | 70 | problem_home = @room_maker.find_problem_home(submission) |
|
71 | 71 | |
|
72 | 72 | # puts "GRADING DIR: #{grading_dir}" |
|
73 | 73 | # puts "PROBLEM DIR: #{problem_home}" |
|
74 | 74 | |
|
75 | 75 | if !FileTest.exist?(problem_home) |
|
76 | 76 | raise "No test data." |
|
77 | 77 | end |
|
78 | 78 | |
|
79 | 79 | dinit = DirInit::Manager.new(problem_home) |
|
80 | 80 | |
|
81 | 81 | dinit.setup do |
|
82 | 82 | copy_log = copy_script(problem_home) |
|
83 | 83 | save_copy_log(problem_home,copy_log) |
|
84 | 84 | end |
|
85 | 85 | |
|
86 | 86 | call_judge(problem_home,language,grading_dir,source_name) |
|
87 | 87 | |
|
88 | 88 | @reporter.report(submission,"#{grading_dir}/test-result") |
|
89 | 89 | |
|
90 | 90 | dinit.teardown do |
|
91 | 91 | copy_log = load_copy_log(problem_home) |
|
92 | 92 | clear_copy_log(problem_home) |
|
93 |
- |
|
|
93 | + clear_script(copy_log,problem_home) | |
|
94 | 94 | end |
|
95 | 95 | |
|
96 | 96 | rescue RuntimeError => msg |
|
97 | 97 | @reporter.report_error(submission, msg) |
|
98 | 98 | |
|
99 | 99 | ensure |
|
100 | 100 | @room_maker.clean_up(submission) |
|
101 | 101 | Dir.chdir(current_dir) # this is really important |
|
102 | 102 | end |
|
103 | 103 | end |
|
104 | 104 | |
|
105 | 105 | protected |
|
106 | 106 | |
|
107 | 107 | def talk(str) |
|
108 | 108 | if @config.talkative |
|
109 | 109 | puts str |
|
110 | 110 | end |
|
111 | 111 | end |
|
112 | 112 | |
|
113 | 113 | def call_judge(problem_home,language,grading_dir,fname) |
|
114 | 114 | ENV['PROBLEM_HOME'] = problem_home |
|
115 | 115 | |
|
116 | 116 | talk grading_dir |
|
117 | 117 | Dir.chdir grading_dir |
|
118 | 118 | cmd = "#{problem_home}/script/judge #{language} #{fname}" |
|
119 | 119 | talk "CMD: #{cmd}" |
|
120 | 120 | system(cmd) |
|
121 | 121 | end |
|
122 | 122 | |
|
123 | 123 | def get_std_script_dir |
|
124 | 124 | GRADER_ROOT + '/std-script' |
|
125 | 125 | end |
|
126 | 126 | |
|
127 | 127 | def copy_script(problem_home) |
|
128 | 128 | script_dir = "#{problem_home}/script" |
|
129 | 129 | std_script_dir = get_std_script_dir |
|
130 | 130 | |
|
131 | 131 | raise "std-script directory not found" if !FileTest.exist?(std_script_dir) |
|
132 | 132 | |
|
133 | 133 | scripts = Dir[std_script_dir + '/*'] |
|
134 | 134 | |
|
135 | 135 | copied = [] |
|
136 | 136 | |
|
137 | 137 | scripts.each do |s| |
|
138 | 138 | fname = File.basename(s) |
|
139 | 139 | next if FileTest.directory?(s) |
|
140 | 140 | if !FileTest.exist?("#{script_dir}/#{fname}") |
|
141 | 141 | copied << fname |
You need to be logged in to leave comments.
Login now