[Lldb-commits] [lldb] r107357 - in /lldb/trunk/test: array_types/TestArrayTypes.py class_types/TestClassTypes.py help/TestHelp.py

Johnny Chen johnny.chen at apple.com
Wed Jun 30 17:18:39 PDT 2010


Author: johnny
Date: Wed Jun 30 19:18:39 2010
New Revision: 107357

URL: http://llvm.org/viewvc/llvm-project?rev=107357&view=rev
Log:
Added some delay (100 ms) after executing each 'command interpreter' command;
this seems to alleviate the intermittent failure observed while running the
whole test suite.

Modified:
    lldb/trunk/test/array_types/TestArrayTypes.py
    lldb/trunk/test/class_types/TestClassTypes.py
    lldb/trunk/test/help/TestHelp.py

Modified: lldb/trunk/test/array_types/TestArrayTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/array_types/TestArrayTypes.py?rev=107357&r1=107356&r2=107357&view=diff
==============================================================================
--- lldb/trunk/test/array_types/TestArrayTypes.py (original)
+++ lldb/trunk/test/array_types/TestArrayTypes.py Wed Jun 30 19:18:39 2010
@@ -1,6 +1,6 @@
 """Test breakpoint by file/line number; and list variables with array types."""
 
-import os
+import os, time
 import lldb
 import unittest
 
@@ -13,6 +13,8 @@
         if ("LLDB_TEST" in os.environ):
             os.chdir(os.path.join(os.environ["LLDB_TEST"], "array_types"));
         self.dbg = lldb.SBDebugger.Create()
+        if not self.dbg.IsValid():
+            raise Exception('Invalid debugger instance')
         self.dbg.SetAsync(False)
         self.ci = self.dbg.GetCommandInterpreter()
         if not self.ci:
@@ -27,24 +29,29 @@
         res = lldb.SBCommandReturnObject()
         exe = os.path.join(os.getcwd(), "a.out")
         self.ci.HandleCommand("file " + exe, res)
+        time.sleep(0.1)
         self.assertTrue(res.Succeeded())
 
         # Break on line 42 inside main().
         self.ci.HandleCommand("breakpoint set -f main.c -l 42", res)
+        time.sleep(0.1)
         self.assertTrue(res.Succeeded())
         self.assertTrue(res.GetOutput().startswith(
             "Breakpoint created: 1: file ='main.c', line = 42, locations = 1"))
 
         self.ci.HandleCommand("run", res)
+        time.sleep(0.1)
         self.assertTrue(res.Succeeded())
 
         # The breakpoint should have a hit count of 1.
         self.ci.HandleCommand("breakpoint list", res)
+        time.sleep(0.1)
         self.assertTrue(res.Succeeded())
         self.assertTrue(res.GetOutput().find('resolved, hit count = 1'))
 
         # And the stop reason of the thread should be breakpoint.
         self.ci.HandleCommand("thread list", res)
+        time.sleep(0.1)
         self.assertTrue(res.Succeeded())
         self.assertTrue(res.GetOutput().find('state is Stopped') and
                         res.GetOutput().find('stop reason = breakpoint'))
@@ -52,6 +59,7 @@
         # Issue 'variable list' command on several array-type variables.
 
         self.ci.HandleCommand("variable list strings", res);
+        time.sleep(0.1)
         self.assertTrue(res.Succeeded())
         output = res.GetOutput()
         self.assertTrue(output.startswith('(char *[4])') and
@@ -65,19 +73,23 @@
                         output.find('Guten Tag'))
 
         self.ci.HandleCommand("variable list char_16", res);
+        time.sleep(0.1)
         self.assertTrue(res.Succeeded())
         self.assertTrue(res.GetOutput().find('(char) char_16[0]') and
                         res.GetOutput().find('(char) char_16[15]'))
 
         self.ci.HandleCommand("variable list ushort_matrix", res);
+        time.sleep(0.1)
         self.assertTrue(res.Succeeded())
         self.assertTrue(res.GetOutput().startswith('(unsigned short [2][3])'))
 
         self.ci.HandleCommand("variable list long_6", res);
+        time.sleep(0.1)
         self.assertTrue(res.Succeeded())
         self.assertTrue(res.GetOutput().startswith('(long [6])'))
 
         self.ci.HandleCommand("continue", res)
+        time.sleep(0.1)
         self.assertTrue(res.Succeeded())
 
 

Modified: lldb/trunk/test/class_types/TestClassTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/class_types/TestClassTypes.py?rev=107357&r1=107356&r2=107357&view=diff
==============================================================================
--- lldb/trunk/test/class_types/TestClassTypes.py (original)
+++ lldb/trunk/test/class_types/TestClassTypes.py Wed Jun 30 19:18:39 2010
@@ -1,6 +1,6 @@
 """Test breakpoint on a class constructor; and variable list the this object."""
 
-import os
+import os, time
 import lldb
 import unittest
 
@@ -13,6 +13,8 @@
         if ("LLDB_TEST" in os.environ):
             os.chdir(os.path.join(os.environ["LLDB_TEST"], "class_types"));
         self.dbg = lldb.SBDebugger.Create()
+        if not self.dbg.IsValid():
+            raise Exception('Invalid debugger instance')
         self.dbg.SetAsync(False)
         self.ci = self.dbg.GetCommandInterpreter()
         if not self.ci:
@@ -27,34 +29,41 @@
         res = lldb.SBCommandReturnObject()
         exe = os.path.join(os.getcwd(), "a.out")
         self.ci.HandleCommand("file " + exe, res)
+        time.sleep(0.1)
         self.assertTrue(res.Succeeded())
 
         # Break on the ctor function of class C.
         self.ci.HandleCommand("breakpoint set -f main.cpp -l 73", res)
+        time.sleep(0.1)
         self.assertTrue(res.Succeeded())
         self.assertTrue(res.GetOutput().startswith(
             "Breakpoint created: 1: file ='main.cpp', line = 73, locations = 1"))
 
         self.ci.HandleCommand("run", res)
+        time.sleep(0.1)
         self.assertTrue(res.Succeeded())
 
         # The breakpoint should have a hit count of 1.
         self.ci.HandleCommand("breakpoint list", res)
+        time.sleep(0.1)
         self.assertTrue(res.Succeeded())
         self.assertTrue(res.GetOutput().find('resolved, hit count = 1'))
 
         # And the stop reason of the thread should be breakpoint.
         self.ci.HandleCommand("thread list", res)
+        time.sleep(0.1)
         self.assertTrue(res.Succeeded())
         self.assertTrue(res.GetOutput().find('state is Stopped') and
                         res.GetOutput().find('stop reason = breakpoint'))
 
         # We should be stopped on the ctor function of class C.
         self.ci.HandleCommand("variable list this", res);
+        time.sleep(0.1)
         self.assertTrue(res.Succeeded())
         self.assertTrue(res.GetOutput().startswith('(class C *const) this = '))
 
         self.ci.HandleCommand("continue", res)
+        time.sleep(0.1)
         self.assertTrue(res.Succeeded())
 
 

Modified: lldb/trunk/test/help/TestHelp.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/help/TestHelp.py?rev=107357&r1=107356&r2=107357&view=diff
==============================================================================
--- lldb/trunk/test/help/TestHelp.py (original)
+++ lldb/trunk/test/help/TestHelp.py Wed Jun 30 19:18:39 2010
@@ -1,6 +1,6 @@
 """Test lldb help command."""
 
-import os
+import os, time
 import lldb
 import unittest
 
@@ -13,6 +13,8 @@
         if ("LLDB_TEST" in os.environ):
             os.chdir(os.path.join(os.environ["LLDB_TEST"], "help"));
         self.dbg = lldb.SBDebugger.Create()
+        if not self.dbg.IsValid():
+            raise Exception('Invalid debugger instance')
         self.dbg.SetAsync(False)
         self.ci = self.dbg.GetCommandInterpreter()
         if not self.ci:
@@ -26,6 +28,7 @@
         """A simple test of 'help' command and its output."""
         res = lldb.SBCommandReturnObject()
         self.ci.HandleCommand("help", res)
+        time.sleep(0.1)
         self.assertTrue(res.Succeeded())
         self.assertTrue(res.GetOutput().startswith(
             'The following is a list of built-in, permanent debugger commands'))
@@ -34,8 +37,10 @@
         """Command 'set term-width 0' should not hang the help command."""
         res = lldb.SBCommandReturnObject()
         self.ci.HandleCommand("set term-width 0", res)
+        time.sleep(0.1)
         self.assertTrue(res.Succeeded())
         self.ci.HandleCommand("help", res)
+        time.sleep(0.1)
         self.assertTrue(res.Succeeded())
         self.assertTrue(res.GetOutput().startswith(
             'The following is a list of built-in, permanent debugger commands'))





More information about the lldb-commits mailing list