def run(self): """ Run selected test cases within the test suite Returns a dictionary of test results """ results = {} for name in self._test_cases: results[name] = FAILED # Ensure result file exists ostools.write_file(get_result_file_name(self._testWordDir), "") sim_ok = self._simulate() results = self._read_test_results( file_name=get_result_file_name(self._testWordDir)) # Do not run post check unless all passed for status in results.values(): if status != PASSED: return results #if not self._config.call_post_check(output_path, read_output): # for name in self._test_cases: # results[name] = FAILED return results
def _main_run(self, post_run): """ Main with running tests support single testcase running several rounds with specified seed or random seed or running a group of testcases(each testcase with specified option) """ simulator_if = self._create_simulator_if() if self._args.group: compile = groupTestCompile(cli=self._cli, simulator_if=simulator_if) compile.prepareEnv() else: compile = singleTestCompile(cli=self._cli, simulator_if=simulator_if) compile.prepareEnv() test_list = self._create_tests(compile._testCaseWorkDir, compile.simCmd(), simulator_if) if not self._args.simOnly: self._compile(compile._buildDir, compile.compileCmd(), simulator_if) start_time = ostools.get_time() report = TestReport(printer=self._printer, filePath=compile._buildDir) try: self._run_test(test_list, report) except KeyboardInterrupt: print() LOGGER.debug("_main: Caught Ctrl-C shutting down") finally: del test_list report.set_real_total_time(ostools.get_time() - start_time) report.print_str() if post_run is not None: post_run(results=Results(simulator_if)) del simulator_if if self._args.xunit_xml is not None: xml = report.to_junit_xml_str(self._args.xunit_xml_format) ostools.write_file(self._args.xunit_xml, xml) return report.all_ok()