[compiler-rt] r208819 - add script to ensure lit test contains %run

Greg Fitzgerald gregf at codeaurora.org
Wed May 14 15:49:46 PDT 2014


Author: garious
Date: Wed May 14 17:49:46 2014
New Revision: 208819

URL: http://llvm.org/viewvc/llvm-project?rev=208819&view=rev
Log:
add script to ensure lit test contains %run

Added:
    compiler-rt/trunk/lib/sanitizer_common/scripts/litlint.py   (with props)
Modified:
    compiler-rt/trunk/lib/sanitizer_common/scripts/check_lint.sh

Modified: compiler-rt/trunk/lib/sanitizer_common/scripts/check_lint.sh
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/scripts/check_lint.sh?rev=208819&r1=208818&r2=208819&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/scripts/check_lint.sh (original)
+++ compiler-rt/trunk/lib/sanitizer_common/scripts/check_lint.sh Wed May 14 17:49:46 2014
@@ -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} \

Added: compiler-rt/trunk/lib/sanitizer_common/scripts/litlint.py
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/scripts/litlint.py?rev=208819&view=auto
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/scripts/litlint.py (added)
+++ compiler-rt/trunk/lib/sanitizer_common/scripts/litlint.py Wed May 14 17:49:46 2014
@@ -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)

Propchange: compiler-rt/trunk/lib/sanitizer_common/scripts/litlint.py
------------------------------------------------------------------------------
    svn:executable = *





More information about the llvm-commits mailing list