def _main_compile_only(self): """ Main function when only compiling """ 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) self._compile(compile._buildDir, compile.compileCmd(), simulator_if) return True
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()