summaryrefslogtreecommitdiffstats
path: root/test/gtest_test_utils.py
diff options
context:
space:
mode:
authorvladlosev <vladlosev@861a406c-534a-0410-8894-cb66d6ee9925>2008-11-22 02:26:23 (GMT)
committervladlosev <vladlosev@861a406c-534a-0410-8894-cb66d6ee9925>2008-11-22 02:26:23 (GMT)
commit514265c415e072caf92fb4eed57aacdfea9964f1 (patch)
treee84cbd75742ebe5fe28f0811afdadc3d2a27e93e /test/gtest_test_utils.py
parentd4e57d12d49bae66811d1ac2249abc7004b580e6 (diff)
downloadgoogletest-514265c415e072caf92fb4eed57aacdfea9964f1.zip
googletest-514265c415e072caf92fb4eed57aacdfea9964f1.tar.gz
googletest-514265c415e072caf92fb4eed57aacdfea9964f1.tar.bz2
Fixed two of the failing tests mentioned in issue 9
Diffstat (limited to 'test/gtest_test_utils.py')
-rwxr-xr-xtest/gtest_test_utils.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/gtest_test_utils.py b/test/gtest_test_utils.py
index f454774..a3f0138 100755
--- a/test/gtest_test_utils.py
+++ b/test/gtest_test_utils.py
@@ -116,6 +116,31 @@ def GetExitStatus(exit_code):
return -1
+def RunCommandSuppressOutput(command, working_dir=None):
+ """Changes into a specified directory, if provided, and executes a command.
+ Restores the old directory afterwards.
+
+ Args:
+ command: A command to run.
+ working_dir: A directory to change into.
+ """
+
+ old_dir = None
+ try:
+ if working_dir is not None:
+ old_dir = os.getcwd()
+ os.chdir(working_dir)
+ f = os.popen(command, 'r')
+ f.read()
+ ret_code = f.close()
+ finally:
+ if old_dir is not None:
+ os.chdir(old_dir)
+ if ret_code is None:
+ ret_code = 0
+ return ret_code
+
+
def Main():
"""Runs the unit test."""