29 sys.path.append(
"@PERFTEST_SCRIPTS_SRC_DIR@/misc_modules/")
32 summarize_results=
True 33 except ImportError, e:
34 print "WARNING: I wont summarize results because I could not import modules: ", e
35 summarize_results=
False 128 short_regression_tests = short_tests
129 regression_tests = short_tests + medium_tests
130 full_regression_tests = short_tests + medium_tests + long_tests
132 all_tests = short_tests + medium_tests + long_tests + other_tests
139 sys.stderr.write(
'ERROR: '+message+
'\n')
140 if status != 0 : sys.exit(status)
146 error(
"Could not find test " + str(v))
150 print "\nUsage: test.py -t test_name [-n #times] [-a|-s|-m|-l|-r] [-t test_name] [-h]" 152 print "\t-n #times : Run each test #times times. (default = ",ntimes_dft,
")" 153 print "\t-a : Run all tests." 154 print "\t-s : Run short tests." 155 print "\t-m : Run medium tests." 156 print "\t-l : Run long tests." 157 print "\t-r res_dir : Run daily regression tests and move results to \"res_dir\" directory." 158 print "\t-F res_dir : Run full regression tests and move results to \"res_dir\" directory." 159 print "\t-S res_dir : Run short regression tests and move results to \"res_dir\" directory." 160 print "\t-t test_name : Run test test_name." 161 print "\nDESCRIPTION" 162 print "\tExecutes a set of performance tests. The following tests are available:" 163 print "\tShort tests:" 164 for t
in short_tests :
166 print "\tMedium tests:" 167 for t
in medium_tests :
169 print "\tLong tests:" 170 for t
in long_tests :
172 print "\tRegression tests:" 173 for t
in regression_tests :
175 print "\tFull regression tests:" 176 for t
in full_regression_tests :
178 print "\tShort regression tests:" 179 for t
in short_regression_tests :
184 if __name__ ==
"__main__":
191 opts, extra_args = getopt.getopt(sys.argv[1:],
't:n:hasmlr:S:F:')
192 except getopt.GetoptError, e:
196 for t
in short_tests : tests_to_run[t[0]] = t
197 for t
in medium_tests : tests_to_run[t[0]] = t
198 for t
in long_tests : tests_to_run[t[0]] = t
199 for t
in regression_tests : tests_to_run[t[0]] = t
200 for t
in full_regression_tests : tests_to_run[t[0]] = t
201 for t
in short_regression_tests : tests_to_run[t[0]] = t
202 elif f ==
'-n': ntimes=int(v)
203 elif f ==
'-t': tests_to_run[v] =
get_test(v)
205 for t
in short_tests : tests_to_run[t[0]] = t
207 for t
in medium_tests : tests_to_run[t[0]] = t
209 for t
in long_tests : tests_to_run[t[0]] = t
211 for t
in regression_tests : tests_to_run[t[0]] = t
214 for t
in full_regression_tests : tests_to_run[t[0]] = t
217 for t
in short_regression_tests : tests_to_run[t[0]] = t
219 elif f ==
'-h':
usage()
224 for f, t
in tests_to_run.iteritems() :
228 status,rdt_files = obj.run_test(ntimes)
229 all_results[test_name]=(status,obj.short_description(),obj.long_description(),rdt_files)
231 error(
'Could not run test '+test_name,0)
232 all_results[test_name]=(-1,obj.short_description(),obj.long_description(),{})
235 for k, v
in all_results.iteritems() :
241 print '** ' + test_name +
' **' 242 print 'desc: ', s_desc
245 print "Status [FAILED] ("+str(status)+
")" 248 print "Results summary ----------------------------" 250 for rdt_id,v
in rdt_files.iteritems() :
251 if summarize_results :
259 print "WARNING: Could not compute average for results at", fn,
"(", e,
")" 264 print "WARNING: Could not compute confidence interval for results at", fn,
"(", e,
")" 267 print "WARNING: error when summarizing results for", fn,
"(", e,
")" 270 print '{0:15s} : {1:>16f} +- {2:<16f} : {3:s}'.format(rdt_id, av, ci, v[1])
272 print '{0:15s} : {1:s} : {2:s}'.format(rdt_id,v[0],v[1])
273 print "--------------------------------------------" 275 if results_dir != 0 :
278 result_dir = os.path.join(results_dir,test_name)
279 if not os.path.isdir(result_dir) :
281 os.makedirs(result_dir)
285 result_info = os.path.join(results_dir,test_name+
".info")
287 f = open(result_info,
'w+')
288 f.write(
"test_name : "+test_name+
"\n")
289 f.write(
"test_desc : "+s_desc+
"\n")
290 f.write(
"test_status : "+str(status)+
"\n")
292 for rdt_id,v
in rdt_files.iteritems() :
293 f.write(rdt_id+
" : "+v[1]+
"\n")
299 for rdt_id,v
in rdt_files.iteritems() :
304 shutil.copy2(rdt_fn,result_dir)
305 except (IOError, os.error)
as why :
def conf_int(vlist, conf_level)
def get_column_values(rdt_d, field)
def error(message, status)