Index: lnt/tests/test_suite.py =================================================================== --- lnt/tests/test_suite.py +++ lnt/tests/test_suite.py @@ -459,6 +459,18 @@ basedir = os.path.join(self.opts.sandbox_path, build_dir_name) self._base_path = basedir + cmakecache = os.path.join(self._base_path, 'CMakeCache.txt') + self.configured = not self.opts.run_configure and \ + os.path.exists(cmakecache) + + # If we are doing diagnostics, skip the usual run and do them now. + if opts.diagnose: + return self.diagnose() + + # configure, so we can extract toolchain information from the cmake + # output. + self.configure_if_needed() + # We don't support compiling without testing as we can't get compile- # time numbers from LIT without running the tests. if opts.compile_multisample > opts.exec_multisample: @@ -483,9 +495,6 @@ fatal("Cannot detect compiler version. Specify --run-order" " to manually define it.") - # If we are doing diagnostics, skip the usual run and do them now. - if opts.diagnose: - return self.diagnose() # Now do the actual run. reports = [] json_reports = [] @@ -518,21 +527,31 @@ return self.submit(report_path, self.opts, commit=True) - def run(self, compile=True, test=True): + def _get_path(self): path = self._base_path if not os.path.exists(path): mkdir_p(path) - if self.opts.pgo: - self._collect_pgo(path) - self.trained = True + return path - if not self.configured and self._need_to_configure(path): + def configure_if_needed(self): + path = self._get_path() + if not self.configured: self._configure(path) self._clean(path) self.configured = True + def run(self, compile=True, test=True): + path = self._get_path() + + if self.opts.pgo: + self._collect_pgo(path) + self.trained = True + self.configured = False + + self.configure_if_needed() + if self.compiled and compile: self._clean(path) if not self.compiled or compile: @@ -552,10 +571,6 @@ test_samples = sum([r.tests for r in reports], []) return lnt.testing.Report(machine, run, test_samples) - def _need_to_configure(self, path): - cmakecache = os.path.join(path, 'CMakeCache.txt') - return self.opts.run_configure or not os.path.exists(cmakecache) - def _test_suite_dir(self): return self.opts.test_suite_root @@ -731,9 +746,11 @@ return not os.path.exists(os.path.join(path, name)) def _get_target_flags(self): + assert self.configured is True return shlex.split(self.opts.cppflags + self.opts.cflags) def _get_cc_info(self): + assert self.configured is True return lnt.testing.util.compilers.get_cc_info(self.opts.cc, self._get_target_flags())