def _configureExpectedResult(self, litConfig): testName = self.getTestName() self.expectedResult = None if testName in litConfig.expected_results.get(self.config.name, dict()): self.expectedResult = litConfig.expected_results[ self.config.name][testName] else: currentPrefix = "" for prefix, result in litConfig.expected_results.get( self.config.name, dict()).items(): if testName == prefix: self.expectedResult = result break elif testName.startswith( prefix) and len(prefix) > len(currentPrefix): currentPrefix = prefix self.expectedResult = result if self.expectedResult is not None: if self.expectedResult == SKIPPED: return Result(SKIPPED, 'This test was explicitly marked as skipped') elif self.config.unsupported: return Result(UNSUPPORTED, 'This test was marked as unsupported by a lit.cfg') return None
def configureTest(self, litConfig): self.compileFlags = [] self.cxx = None self.fileDependencies = [] self.flags = [] self.isenseRspPath = None self.linkFlags = [] self.testType = None result = self._configureExpectedResult(litConfig) if result: return result result = self._handleEnvlst(litConfig) if result: return result self._parseTest() self._parseFlags() missing_required_features = self.getMissingRequiredFeatures() if missing_required_features: msg = ', '.join(missing_required_features) return Result(UNSUPPORTED, "Test requires the following unavailable features: %s" % msg) unsupported_features = self.getUnsupportedFeatures() if unsupported_features: msg = ', '.join(unsupported_features) return Result(UNSUPPORTED, "Test does not support the following features and/or targets: %s" % msg) if not self.isWithinFeatureLimits(): msg = ', '.join(self.config.limit_to_features) return Result(UNSUPPORTED, "Test does not require any of the features specified in limit_to_features: %s" % msg) if 'edg_drop' in self.config.available_features: if not 'edg' in self.requires: return Result(UNSUPPORTED, 'We only run /BE tests with the edg drop') _, tmpBase = self.getTempPaths() self.isenseRspPath = tmpBase + '.isense.rsp' self.compileFlags.extend(['/dE--write-isense-rsp', '/dE' + self.isenseRspPath]) self._configureTestType() forceFail = self.expectedResult and self.expectedResult.isFailure buildFail = forceFail and TestType.COMPILE|TestType.LINK in self.testType if (litConfig.build_only and buildFail): self.xfails = ['*'] elif (not litConfig.build_only and forceFail): self.xfails = ['*'] return None
def _handleEnvlst(self, litConfig): envCompiler = self.envlstEntry.getEnvVal('PM_COMPILER', 'cl') cxx = None if os.path.isfile(envCompiler): cxx = envCompiler else: cxx = _compilerPathCache.get(envCompiler, None) if not cxx: searchPaths = self.config.environment['PATH'] cxx = shutil.which(envCompiler, path=searchPaths) _compilerPathCache[envCompiler] = cxx if not cxx: litConfig.warning('Could not find: %r' % envCompiler) return Result( SKIPPED, 'This test was skipped because the compiler, "' + envCompiler + '", could not be found') self.flags = copy.deepcopy(litConfig.flags[self.config.name]) self.compileFlags = copy.deepcopy( litConfig.compile_flags[self.config.name]) self.linkFlags = copy.deepcopy(litConfig.link_flags[self.config.name]) self.compileFlags.extend( self.envlstEntry.getEnvVal('PM_CL', '').split()) self.linkFlags.extend( self.envlstEntry.getEnvVal('PM_LINK', '').split()) if ('clang'.casefold() in os.path.basename(cxx).casefold()): self._addCustomFeature('clang') targetArch = litConfig.target_arch.casefold() if (targetArch == 'x64'.casefold()): self.compileFlags.append('-m64') elif (targetArch == 'x86'.casefold()): self.compileFlags.append('-m32') elif (targetArch == 'arm'.casefold()): return Result(UNSUPPORTED, 'clang targeting arm is not supported') elif (targetArch == 'arm64'.casefold()): self.compileFlags.append('--target=arm64-pc-windows-msvc') elif ('nvcc'.casefold() in os.path.basename(cxx).casefold()): self._addCustomFeature('nvcc') # nvcc only supports targeting x64 self.requires.append('x64') else: self._addCustomFeature('cl') self.cxx = os.path.normpath(cxx) return None