From 7d557910c6aa04396235da74bc6fe5341b0cc5c8 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Thu, 29 Oct 2015 13:44:09 +0000 Subject: Fix flakyness in TestChangeProcessGroup The test was verifying that the pid of the child is not equal to its process group by searching for text substrings. This failed in the rare cases when the pid actually *was* a substring of the process group (even though they were not equal). Change the test to use SB API and do proper numeric comparisons. llvm-svn: 251626 --- .../functionalities/process_group/TestChangeProcessGroup.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py') diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py b/lldb/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py index 8779e5e84da..b4c99918d86 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py @@ -77,11 +77,14 @@ class ChangeProcessGroupTestCase(TestBase): thread = process.GetSelectedThread() # release the child from its loop - self.expect("expr release_child_flag = 1", substrs = ["= 1"]) + value = thread.GetSelectedFrame().EvaluateExpression("release_child_flag = 1") + self.assertTrue(value.IsValid() and value.GetValueAsUnsigned(0) == 1); process.Continue() # make sure the child's process group id is different from its pid - self.expect("print (int)getpgid(0)", substrs = [pid], matching=False) + value = thread.GetSelectedFrame().EvaluateExpression("(int)getpgid(0)") + self.assertTrue(value.IsValid()) + self.assertNotEqual(value.GetValueAsUnsigned(0), int(pid)); # step over the setpgid() call thread.StepOver() @@ -89,7 +92,9 @@ class ChangeProcessGroupTestCase(TestBase): # verify that the process group has been set correctly # this also checks that we are still in full control of the child - self.expect("print (pid_t)getpgid(0)", substrs = [pid]) + value = thread.GetSelectedFrame().EvaluateExpression("(int)getpgid(0)") + self.assertTrue(value.IsValid()) + self.assertEqual(value.GetValueAsUnsigned(0), int(pid)); # run to completion process.Continue() -- cgit v1.2.3