summaryrefslogtreecommitdiff
path: root/test/gtest_xml_output_unittest.py
diff options
context:
space:
mode:
authorshiqian <shiqian@861a406c-534a-0410-8894-cb66d6ee9925>2008-09-18 21:18:11 +0000
committershiqian <shiqian@861a406c-534a-0410-8894-cb66d6ee9925>2008-09-18 21:18:11 +0000
commitdc8c9fa9f38a6a8fc2b78d8096e8d3f1c969cb7c (patch)
tree3754cd4cd0ddc726c95c456944e7235826a34e3e /test/gtest_xml_output_unittest.py
parent7291f9d79146744508a910a510b64bb07354435f (diff)
downloadgoogletest-dc8c9fa9f38a6a8fc2b78d8096e8d3f1c969cb7c.tar.gz
Makes the Python tests more portable by calling standard functions to interpret the result of os.system(). This could fix the broken Python tests on some users' machines.
git-svn-id: http://googletest.googlecode.com/svn/trunk@95 861a406c-534a-0410-8894-cb66d6ee9925
Diffstat (limited to 'test/gtest_xml_output_unittest.py')
-rwxr-xr-xtest/gtest_xml_output_unittest.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/test/gtest_xml_output_unittest.py b/test/gtest_xml_output_unittest.py
index af021a9..013e739 100755
--- a/test/gtest_xml_output_unittest.py
+++ b/test/gtest_xml_output_unittest.py
@@ -128,7 +128,7 @@ class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
status = os.system("cd %s && %s %s=xml &> /dev/null"
% (temp_dir, gtest_prog_path,
GTEST_OUTPUT_FLAG))
- self.assertEquals(0, status)
+ self.assertEquals(0, gtest_test_utils.GetExitStatus(status))
self.assert_(os.path.isfile(output_file))
@@ -147,14 +147,16 @@ class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
command = ("%s %s=xml:%s &> /dev/null"
% (gtest_prog_path, GTEST_OUTPUT_FLAG, xml_path))
status = os.system(command)
- signal = status & 0xff
- self.assertEquals(0, signal,
- "%s was killed by signal %d" % (gtest_prog_name, signal))
- exit_code = status >> 8
- self.assertEquals(expected_exit_code, exit_code,
- "'%s' exited with code %s, which doesn't match "
- "the expected exit code %s."
- % (command, exit_code, expected_exit_code))
+ if os.WIFSIGNALED(status):
+ signal = os.WTERMSIG(status)
+ self.assert_(False,
+ "%s was killed by signal %d" % (gtest_prog_name, signal))
+ else:
+ exit_code = gtest_test_utils.GetExitStatus(status)
+ self.assertEquals(expected_exit_code, exit_code,
+ "'%s' exited with code %s, which doesn't match "
+ "the expected exit code %s."
+ % (command, exit_code, expected_exit_code))
expected = minidom.parseString(expected_xml)
actual = minidom.parse(xml_path)