Index: libcxx/test/lit.cfg =================================================================== --- libcxx/test/lit.cfg +++ libcxx/test/lit.cfg @@ -63,6 +63,7 @@ def _execute(self, test, lit_config): # Extract test metadata from the test file. requires = [] + requiresnot = [] with open(test.getSourcePath()) as f: for ln in f: if 'XFAIL:' in ln: @@ -71,6 +72,9 @@ elif 'REQUIRES:' in ln: items = ln[ln.index('REQUIRES:') + 9:].split(',') requires.extend([s.strip() for s in items]) + elif 'REQUIRES-NOT:' in ln: + items = ln[ln.index('REQUIRES-NOT:') + 13:].split(',') + requiresnot.extend([s.strip() for s in items]) elif not ln.startswith("//") and ln.strip(): # Stop at the first non-empty line that is not a C++ # comment. @@ -88,6 +92,13 @@ "Test requires the following features: %s" % ( ', '.join(missing_required_features),)) + incompatible_features = [f for f in requires + if f in test.config.available_features] + if incompatible_features: + return (lit.Test.UNSUPPORTED, + "Test is incompatible with the following features: %s" % ( + ', '.join(incompatible_features),)) + # Evaluate the test. return self._evaluate_test(test, lit_config) @@ -125,6 +136,8 @@ try: compile_cmd = [self.cxx_under_test, '-o', exec_path, source_path] + self.cpp_flags + self.ld_flags + if lit_config.useQEMU: + compile_cmd.append('test_wrapper.cc') cmd = compile_cmd out, err, exitCode = self.execute_command(cmd) if exitCode != 0: @@ -139,20 +152,34 @@ return lit.Test.FAIL, report cmd = [] - if self.exec_env: - cmd.append('env') - cmd.extend('%s=%s' % (name, value) - for name,value in self.exec_env.items()) + # HACK(jroelofs): fix this the 'right' way +# if self.exec_env: +# cmd.append('env') +# cmd.extend('%s=%s' % (name, value) +# for name,value in self.exec_env.items()) cmd.append(exec_path) if lit_config.useValgrind: cmd = lit_config.valgrindArgs + cmd + if lit_config.useQEMU: + cmd = lit_config.qemuArgs + cmd out, err, exitCode = self.execute_command(cmd, source_dir) - if exitCode != 0: + success = False + if lit_config.useQEMU: + if out.startswith("FAIL"): + success = False + elif out.startswith("PASS"): + success = True + else: + success = False + else: + success = exitCode != 0 + if not success: report = """Compiled With: %s\n""" % \ ' '.join(["'%s'" % a for a in compile_cmd]) report += """Command: %s\n""" % \ ' '.join(["'%s'" % a for a in cmd]) - report += """Exit Code: %d\n""" % exitCode + if not lit_config.useQEMU: + report += """Exit Code: %d\n""" % exitCode if out: report += """Standard Output:\n--\n%s--""" % out if err: @@ -185,7 +212,7 @@ clangxx = lit.util.which('clang++', config.environment['PATH']) if clangxx is not None: cxx_under_test = clangxx - lit_config.note("inferred cxx_under_test as: %r" % (cxx_under_test,)) + lit_config.note("inferred cxx_under_test as: %r" % (cxx_under_test,)) if cxx_under_test is None: lit_config.fatal('must specify user parameter cxx_under_test ' '(e.g., --param=cxx_under_test=clang++)') @@ -218,6 +245,8 @@ # locally built one; the former mode is useful for testing ABI compatibility # between the current headers and a shipping dynamic library. use_system_lib_str = lit_config.params.get('use_system_lib', None) +if use_system_lib_str is None: + use_system_lib_str = getattr(config, 'use_system_lib', None) if use_system_lib_str is not None: if use_system_lib_str.lower() in ('1', 'true'): use_system_lib = True