summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2015-10-29 13:44:09 +0000
committerPavel Labath <labath@google.com>2015-10-29 13:44:09 +0000
commit7d557910c6aa04396235da74bc6fe5341b0cc5c8 (patch)
tree77023f045c4cb12a39664074ba7cf358606ae1dc /lldb/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py
parent689724e578fcb596d33b4b273ec32921edb06ff5 (diff)
downloadbcm5719-llvm-7d557910c6aa04396235da74bc6fe5341b0cc5c8.tar.gz
bcm5719-llvm-7d557910c6aa04396235da74bc6fe5341b0cc5c8.zip
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
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py11
1 files changed, 8 insertions, 3 deletions
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()
OpenPOWER on IntegriCloud