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

Daniel Dunbar daniel at zuster.org
Wed Jun 30 17:40:56 PDT 2010


On Wed, Jun 30, 2010 at 5:18 PM, Johnny Chen <johnny.chen at apple.com> wrote:
> 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.

I would strongly recommend not going down this road. There are two big
problems with adding arbitrary timeouts:
 1. They are never "exactly right", and it is always possible that a
loaded machine or some other hickup will give sporadic test failures.
This is a real bane for automated testing, as it makes it hard to
generate reliable reports that people will pay attention to.
 2. Because most of the time the timeouts aren't needed, they end up
making the test suite a lot slower than it needs to be.

Our GDB buildbot hits this problem a lot and it is something I really
would hope would be fixed with LLDB. Is it possible to debug the
intermittent failure to find out exactly why it is failing, and add
explicit coordination to resolve that, instead of using a timeout?

 - Daniel

>
> 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'))
>
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>




More information about the lldb-commits mailing list