Description:
merge
Commit status:
[Not Reviewed]
References:
merge java
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r243:b409073698a0 - - 1 file changed: 5 inserted, 2 deleted

@@ -91,46 +91,49
91 91 def count_testruns(testcase_dir, raw_prefix)
92 92 n = 0
93 93 begin
94 94 # check for test case n+1
95 95 if ((Dir["#{testcase_dir}/#{raw_prefix}#{n+1}.in"].length==0) and
96 96 (Dir["#{testcase_dir}/#{raw_prefix}#{n+1}[a-z].in"].length==0))
97 97 return n
98 98 end
99 99 n += 1
100 100 end while true
101 101 end
102 102
103 - def create_dir_if_not_exists(dir)
103 + def create_dir_if_not_exists(dir, options = {} )
104 104 if ! FileTest.exists? dir
105 105 FileUtils.mkdir(dir)
106 106 end
107 +
108 + FileUtils.rm_rf(Dir.glob("#{dir}/*")) if options[:clear]
107 109 end
108 110
109 111 def import_problem(ev_dir, problem, testcase_dir, num_testruns, raw_prefix, check_script, options)
110 112 testrun_info = build_testrun_info_from_dir(num_testruns, testcase_dir, raw_prefix)
111 113
112 114 if !(FileTest.exists? ev_dir)
113 115 puts "Testdata dir (#{ev_dir}) not found."
114 116 return
115 117 end
116 118
117 119 problem_dir = "#{ev_dir}/#{problem}"
118 120
119 121 # start working
120 122 puts "creating directories"
121 123
122 124 create_dir_if_not_exists("#{problem_dir}")
123 125 create_dir_if_not_exists("#{problem_dir}/script")
124 - create_dir_if_not_exists("#{problem_dir}/test_cases")
126 + create_dir_if_not_exists("#{problem_dir}/test_cases",clear: true)
127 + # clear test cases directory
125 128
126 129 puts "copying testcases"
127 130
128 131 tr_num = 0
129 132
130 133 num_testcases = 0
131 134
132 135 testrun_info.each do |testrun|
133 136 tr_num += 1
134 137 puts "testrun: #{tr_num}"
135 138
136 139 testrun.each do |testcase_info|
You need to be logged in to leave comments. Login now