summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib
diff options
context:
space:
mode:
authorGreg Fitzgerald <gregf@codeaurora.org>2014-05-14 22:49:46 +0000
committerGreg Fitzgerald <gregf@codeaurora.org>2014-05-14 22:49:46 +0000
commita310d98ff1ccf7498beaf9614764eeff1291c986 (patch)
treee4117dca0385cd2527b1f6b9b28b3622a3f48b5f /compiler-rt/lib
parent5def41ee40bdfb7930a86d5ca599d948f5b86f98 (diff)
downloadbcm5719-llvm-a310d98ff1ccf7498beaf9614764eeff1291c986.tar.gz
bcm5719-llvm-a310d98ff1ccf7498beaf9614764eeff1291c986.zip
add script to ensure lit test contains %run
llvm-svn: 208819
Diffstat (limited to 'compiler-rt/lib')
-rwxr-xr-xcompiler-rt/lib/sanitizer_common/scripts/check_lint.sh5
-rwxr-xr-xcompiler-rt/lib/sanitizer_common/scripts/litlint.py27
2 files changed, 31 insertions, 1 deletions
diff --git a/compiler-rt/lib/sanitizer_common/scripts/check_lint.sh b/compiler-rt/lib/sanitizer_common/scripts/check_lint.sh
index e425fe1724f..0b7aea1ae27 100755
--- a/compiler-rt/lib/sanitizer_common/scripts/check_lint.sh
+++ b/compiler-rt/lib/sanitizer_common/scripts/check_lint.sh
@@ -7,10 +7,12 @@ if [ "${LLVM_CHECKOUT}" == "" ]; then
LLVM_CHECKOUT="${SCRIPT_DIR}/../../../../../"
fi
-# Cpplint setup
+# python tools setup
CPPLINT=${SCRIPT_DIR}/cpplint.py
+LITLINT=${SCRIPT_DIR}/litlint.py
if [ "${PYTHON_EXECUTABLE}" != "" ]; then
CPPLINT="${PYTHON_EXECUTABLE} ${CPPLINT}"
+ LITLINT="${PYTHON_EXECUTABLE} ${LITLINT}"
fi
# Filters
@@ -48,6 +50,7 @@ run_lint() {
if [[ "${SILENT}" != "1" ]]; then
cat $TASK_LOG
fi
+ ${LITLINT} "$@" 2>>$ERROR_LOG
}
run_lint ${LLVM_LINT_FILTER} --filter=${LLVM_LINT_FILTER} \
diff --git a/compiler-rt/lib/sanitizer_common/scripts/litlint.py b/compiler-rt/lib/sanitizer_common/scripts/litlint.py
new file mode 100755
index 00000000000..15b496ff4fc
--- /dev/null
+++ b/compiler-rt/lib/sanitizer_common/scripts/litlint.py
@@ -0,0 +1,27 @@
+#!/usr/bin/python
+#
+# lit-lint
+#
+# Check that the RUN commands in lit tests can be executed with an emulator.
+#
+
+import argparse
+import re
+import sys
+
+parser = argparse.ArgumentParser(description='lint lit tests')
+parser.add_argument('filenames', nargs='+')
+parser.add_argument('--filter') # ignored
+args = parser.parse_args()
+
+runRegex = re.compile(r'(?<!-o)(?<!%run) %t\s')
+errorMsg = "litlint: {}:{}: error: missing %run before %t.\n\t{}"
+
+def LintFile(p):
+ with open(p, 'r') as f:
+ for i, s in enumerate(f.readlines()):
+ if runRegex.search(s):
+ sys.stderr.write(errorMsg.format(p, i, s))
+
+for p in args.filenames:
+ LintFile(p)
OpenPOWER on IntegriCloud