def main(dirs): for dirname in dirs: debug.log('reprocessing %s' % dirname) debug.verbose('parse %s/description.txt for test' % dirname) testname = test = None f = open(os.path.join(dirname, 'description.txt'), 'r') for line in f: m = re.match(r'test:\s+(.*)', line) if m: testname = m.group(1) break f.close() if not testname: debug.error('unable to parse description for %s, skipped' % dirname) continue debug.verbose('locate test "%s"' % testname) for t in tests.all_tests: if t.name.lower() == testname.lower(): test = t(None) # XXX: dummy options if not test: debug.error('unknown test "%s" in %s, skipped' % (testname, dirname)) continue debug.verbose('reprocess results') harness.process_results(test, dirname)
def main(options): retval = True # everything was OK co = checkout.Checkout(options.sourcedir) # determine build architectures buildarchs = set() for m in options.machines: buildarchs |= set(m.get_buildarchs()) buildarchs = list(buildarchs) testcases = [] for build in options.builds: debug.log('starting build: %s' % build.name) build.configure(co, buildarchs) for machine in options.machines: for test in options.tests: debug.log('running test %s on %s, cwd is %s' % (test.name, machine.name, os.getcwd())) path = make_results_dir(options, build, machine, test) write_description(options, co, build, machine, test, path) start_timestamp = datetime.datetime.now() try: harness.run_test(build, machine, test, path) except TimeoutError: retval = False msg = 'Timeout while running test' if options.keepgoing: msg += ' (attempting to continue)' debug.error(msg) end_timestamp = datetime.datetime.now() testcases.append(write_errorcase(build, machine, test, path, msg, start_timestamp, end_timestamp) ) if options.keepgoing: continue else: if options.xml: write_xml_report(testcases, path) return retval except Exception: retval = False msg = 'Exception while running test' if options.keepgoing: msg += ' (attempting to continue):' debug.error(msg) end_timestamp = datetime.datetime.now() testcases.append(write_errorcase(build, machine, test, path, msg, start_timestamp, end_timestamp) ) if options.keepgoing: traceback.print_exc() continue else: if options.xml: write_xml_report(testcases, path) raise end_timestamp = datetime.datetime.now() debug.log('test complete, processing results') try: passed = harness.process_results(test, path) debug.log('result: %s' % ("PASS" if passed else "FAIL")) except Exception: retval = False msg = 'Exception while processing results' if options.keepgoing: msg += ' (attempting to continue):' debug.error(msg) if options.keepgoing: traceback.print_exc() else: if options.xml: write_xml_report(testcases, path) raise if not passed: retval = False testcases.append( write_testcase(build, machine, test, path, passed, start_timestamp, end_timestamp)) # produce JUnit style xml report if requested if options.xml: path = make_run_dir(options, build, machine) write_xml_report(testcases, path) debug.log('all done!') return retval
def main(options): retval = True # everything was OK co = checkout.Checkout(options.sourcedir) # determine build architectures buildarchs = set() for m in options.machines: buildarchs |= set(m.get_buildarchs()) buildarchs = list(buildarchs) for build in options.builds: debug.log('starting build: %s' % build.name) build.configure(co, buildarchs) for machine in options.machines: for test in options.tests: debug.log('running test %s on %s, cwd is %s' % (test.name, machine.name, os.getcwd())) path = make_results_dir(options, build, machine, test) write_description(options, co, build, machine, test, path) try: harness.run_test(build, machine, test, path) except TimeoutError: retval = False msg = 'Timeout while running test' if options.keepgoing: msg += ' (attempting to continue)' debug.error(msg) if options.keepgoing: continue else: return retval except Exception: retval = False msg = 'Exception while running test' if options.keepgoing: msg += ' (attempting to continue):' debug.error(msg) if options.keepgoing: traceback.print_exc() continue else: raise debug.log('test complete, processing results') try: passed = harness.process_results(test, path) debug.log('result: %s' % ("PASS" if passed else "FAIL")) except Exception: retval = False msg = 'Exception while processing results' if options.keepgoing: msg += ' (attempting to continue):' debug.error(msg) if options.keepgoing: traceback.print_exc() else: raise if not passed: retval = False debug.log('all done!') return retval
def main(options): retval = True # everything was OK co = checkout.Checkout(options.sourcedir) # determine build architectures buildarchs = set() for m in options.machines: buildarchs |= set(m.get_buildarchs()) buildarchs = list(buildarchs) for build in options.builds: debug.log('starting build: %s' % build.name) build.configure(co, buildarchs) for machine in options.machines: for test in options.tests: debug.log('running test %s on %s, cwd is %s' % (test.name, machine.name, os.getcwd())) path = make_results_dir(options, build, machine, test) write_description(options, co, build, machine, test, path) try: harness.run_test(build, machine, test, path) except TimeoutError: retval = False msg = 'Timeout while running test' if options.keepgoing: msg += ' (attempting to continue)' debug.error(msg) if options.keepgoing: continue else: return retval except Exception: retval = False msg = 'Exception while running test' if options.keepgoing: msg += ' (attempting to continue):' debug.error(msg) if options.keepgoing: traceback.print_exc() continue else: raise debug.log('test complete, processing results') try: passed = harness.process_results(test, path) except Exception: retval = False msg = 'Exception while processing results' if options.keepgoing: msg += ' (attempting to continue):' debug.error(msg) if options.keepgoing: traceback.print_exc() else: raise if not passed: retval = False debug.log('all done!') return retval