summaryrefslogtreecommitdiffstats
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 (GMT)
committershiqian <shiqian@861a406c-534a-0410-8894-cb66d6ee9925>2008-09-18 21:18:11 (GMT)
commite79c3ccb73d68543e8ad98d69179dee74abff7ab (patch)
tree3754cd4cd0ddc726c95c456944e7235826a34e3e /test/gtest_xml_output_unittest.py
parentf6b0dc0b408f38bb04079b14198d6bdf703e5e56 (diff)
downloadgoogletest-e79c3ccb73d68543e8ad98d69179dee74abff7ab.zip
googletest-e79c3ccb73d68543e8ad98d69179dee74abff7ab.tar.gz
googletest-e79c3ccb73d68543e8ad98d69179dee74abff7ab.tar.bz2
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.
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)