diff options
author | Greg Fitzgerald <gregf@codeaurora.org> | 2014-05-14 22:49:46 +0000 |
---|---|---|
committer | Greg Fitzgerald <gregf@codeaurora.org> | 2014-05-14 22:49:46 +0000 |
commit | a310d98ff1ccf7498beaf9614764eeff1291c986 (patch) | |
tree | e4117dca0385cd2527b1f6b9b28b3622a3f48b5f /compiler-rt/lib/sanitizer_common/scripts/litlint.py | |
parent | 5def41ee40bdfb7930a86d5ca599d948f5b86f98 (diff) | |
download | bcm5719-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/sanitizer_common/scripts/litlint.py')
-rwxr-xr-x | compiler-rt/lib/sanitizer_common/scripts/litlint.py | 27 |
1 files changed, 27 insertions, 0 deletions
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) |