[test-suite] r260356 - lit: Add function to determine the main executable of a .test file
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 9 19:56:39 PST 2016
Author: matze
Date: Tue Feb 9 21:56:38 2016
New Revision: 260356
URL: http://llvm.org/viewvc/llvm-project?rev=260356&view=rev
Log:
lit: Add function to determine the main executable of a .test file
Modified:
test-suite/trunk/litsupport/shellcommand.py
Modified: test-suite/trunk/litsupport/shellcommand.py
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/litsupport/shellcommand.py?rev=260356&r1=260355&r2=260356&view=diff
==============================================================================
--- test-suite/trunk/litsupport/shellcommand.py (original)
+++ test-suite/trunk/litsupport/shellcommand.py Tue Feb 9 21:56:38 2016
@@ -1,4 +1,5 @@
import shlex
+import logging
# Loosely modeled after posix specification for sh
reserved_words = [ '!', '{', '}', 'case', 'do', 'done', 'elif', 'else', 'esac',
@@ -60,3 +61,30 @@ def parse(commandline):
token)
result.arguments.append(token)
return result
+
+
+# Some executables are just used to cleanup/prepare for a test run, ignore them
+# here.
+_ignore_executables = set(['cd', 'rm'])
+
+
+def getMainExecutable(context):
+ """Collect md5sum of tested executable"""
+ if hasattr(context, 'executable'):
+ return context.executable
+
+ executable = None
+ for line in context.original_runscript:
+ cmd = parse(line)
+ if cmd.executable in _ignore_executables:
+ continue
+ # We only support one executable yet for collecting md5sums
+ if cmd.executable != executable and executable is not None:
+ logging.warning("More than one executable used in test %s",
+ context.test.getFullName())
+ executable = cmd.executable
+ if executable is None:
+ logging.warning("No executable found for test %s",
+ context.test.getFullName())
+ context.executable = executable
+ return executable
More information about the llvm-commits
mailing list