[UBSan] Make sure ASan and UBSan interact properly by running each test from UBSan test suite with and without ASan
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@194698 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/ubsan/lit_tests/lit.common.cfg b/lib/ubsan/lit_tests/lit.common.cfg
new file mode 100644
index 0000000..23c85e9
--- /dev/null
+++ b/lib/ubsan/lit_tests/lit.common.cfg
@@ -0,0 +1,31 @@
+# -*- Python -*-
+
+import os
+
+def get_required_attr(config, attr_name):
+ attr_value = getattr(config, attr_name, None)
+ if not attr_value:
+ lit_config.fatal(
+ "No attribute %r in test configuration! You may need to run "
+ "tests from your build directory or add this attribute "
+ "to lit.site.cfg " % attr_name)
+ return attr_value
+
+# Setup source root.
+ubsan_lit_tests_dir = get_required_attr(config, 'ubsan_lit_tests_dir')
+config.test_source_root = os.path.join(ubsan_lit_tests_dir, 'TestCases')
+
+def DisplayNoConfigMessage():
+ lit_config.fatal("No site specific configuration available! " +
+ "Try running your test from the build tree or running " +
+ "make check-ubsan")
+
+# Default test suffixes.
+config.suffixes = ['.c', '.cc', '.cpp']
+
+# UndefinedBehaviorSanitizer tests are currently supported on
+# Linux and Darwin only.
+if config.host_os not in ['Linux', 'Darwin']:
+ config.unsupported = True
+
+config.pipefail = False