[Lldb-commits] [lldb] r251626 - Fix flakyness in TestChangeProcessGroup

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 29 06:44:10 PDT 2015


Author: labath
Date: Thu Oct 29 08:44:09 2015
New Revision: 251626

URL: http://llvm.org/viewvc/llvm-project?rev=251626&view=rev
Log:
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.

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py?rev=251626&r1=251625&r2=251626&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_group/TestChangeProcessGroup.py Thu Oct 29 08:44:09 2015
@@ -77,11 +77,14 @@ class ChangeProcessGroupTestCase(TestBas
         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(TestBas
 
         # 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()




More information about the lldb-commits mailing list