[llvm-commits] [llvm] r95398 - in /llvm/trunk/utils/lit/lit: TestFormats.py Util.py
Jeffrey Yasskin
jyasskin at google.com
Fri Feb 5 10:09:19 PST 2010
Author: jyasskin
Date: Fri Feb 5 12:09:19 2010
New Revision: 95398
URL: http://llvm.org/viewvc/llvm-project?rev=95398&view=rev
Log:
Make lit's gtest support honor config.environment.
Modified:
llvm/trunk/utils/lit/lit/TestFormats.py
llvm/trunk/utils/lit/lit/Util.py
Modified: llvm/trunk/utils/lit/lit/TestFormats.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestFormats.py?rev=95398&r1=95397&r2=95398&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/TestFormats.py (original)
+++ llvm/trunk/utils/lit/lit/TestFormats.py Fri Feb 5 12:09:19 2010
@@ -9,13 +9,19 @@
self.test_sub_dir = str(test_sub_dir)
self.test_suffix = str(test_suffix)
- def getGTestTests(self, path, litConfig):
+ def getGTestTests(self, path, litConfig, localConfig):
"""getGTestTests(path) - [name]
-
- Return the tests available in gtest executable."""
+
+ Return the tests available in gtest executable.
+
+ Args:
+ path: String path to a gtest executable
+ litConfig: LitConfig instance
+ localConfig: TestingConfig instance"""
try:
- lines = Util.capture([path, '--gtest_list_tests']).split('\n')
+ lines = Util.capture([path, '--gtest_list_tests'],
+ env=localConfig.environment).split('\n')
except:
litConfig.error("unable to discover google-tests in %r" % path)
raise StopIteration
@@ -52,7 +58,8 @@
execpath = os.path.join(filepath, subfilename)
# Discover the tests in this executable.
- for name in self.getGTestTests(execpath, litConfig):
+ for name in self.getGTestTests(execpath, litConfig,
+ localConfig):
testPath = path_in_suite + (filename, subfilename, name)
yield Test.Test(testSuite, testPath, localConfig)
@@ -65,7 +72,8 @@
testName = os.path.join(namePrefix, testName)
cmd = [testPath, '--gtest_filter=' + testName]
- out, err, exitCode = TestRunner.executeCommand(cmd)
+ out, err, exitCode = TestRunner.executeCommand(
+ cmd, env=test.config.environment)
if not exitCode:
return Test.PASS,''
Modified: llvm/trunk/utils/lit/lit/Util.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/Util.py?rev=95398&r1=95397&r2=95398&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/Util.py (original)
+++ llvm/trunk/utils/lit/lit/Util.py Fri Feb 5 12:09:19 2010
@@ -39,11 +39,12 @@
if e.errno != errno.EEXIST:
raise
-def capture(args):
+def capture(args, env=None):
import subprocess
"""capture(command) - Run the given command (or argv list) in a shell and
return the standard output."""
- p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
+ env=env)
out,_ = p.communicate()
return out
More information about the llvm-commits
mailing list