aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Yasskin <jyasskin@google.com>2010-02-05 18:09:19 +0000
committerJeffrey Yasskin <jyasskin@google.com>2010-02-05 18:09:19 +0000
commit8d280fb50a1c35a4b598bf722038b7f0d71e90d0 (patch)
tree6a8c357d4993aac1b9fff18ef479a9fef6c2992c
parent7acca6707bf91173bc1c5970bffc0ed55b285f85 (diff)
downloadexternal_llvm-8d280fb50a1c35a4b598bf722038b7f0d71e90d0.zip
external_llvm-8d280fb50a1c35a4b598bf722038b7f0d71e90d0.tar.gz
external_llvm-8d280fb50a1c35a4b598bf722038b7f0d71e90d0.tar.bz2
Make lit's gtest support honor config.environment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95398 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--utils/lit/lit/TestFormats.py20
-rw-r--r--utils/lit/lit/Util.py5
2 files changed, 17 insertions, 8 deletions
diff --git a/utils/lit/lit/TestFormats.py b/utils/lit/lit/TestFormats.py
index 5dfd54a..fba0ce2 100644
--- a/utils/lit/lit/TestFormats.py
+++ b/utils/lit/lit/TestFormats.py
@@ -9,13 +9,19 @@ class GoogleTest(object):
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 @@ class GoogleTest(object):
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 @@ class GoogleTest(object):
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,''
diff --git a/utils/lit/lit/Util.py b/utils/lit/lit/Util.py
index 66c5e46..414b714 100644
--- a/utils/lit/lit/Util.py
+++ b/utils/lit/lit/Util.py
@@ -39,11 +39,12 @@ def mkdir_p(path):
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