[Lldb-commits] [lldb] r115368 - in /lldb/trunk/test: dotest.py foundation/TestDisassemble.py lldbtest.py
Johnny Chen
johnny.chen at apple.com
Fri Oct 1 15:59:49 PDT 2010
Author: johnny
Date: Fri Oct 1 17:59:49 2010
New Revision: 115368
URL: http://llvm.org/viewvc/llvm-project?rev=115368&view=rev
Log:
o Added a new feature to the test framework to skip long running tests conditionally.
To not skip long running tests, pass '-l' to the test driver (dotest.py).
An example:
@unittest2.skipIf(TestBase.skipLongRunningTest(), "Skip this long running test")
def test_foundation_disasm(self):
...
o Added a long running disassemble test to the foundation directory, which iterates
the code symbols from Foundation.framework and kicks off a disassemble command for
for the named function symbol. Found a crasher: rdar://problem/8504895.
o Plus added/updated some comments for the TestBase class.
Modified:
lldb/trunk/test/dotest.py
lldb/trunk/test/foundation/TestDisassemble.py
lldb/trunk/test/lldbtest.py
Modified: lldb/trunk/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dotest.py?rev=115368&r1=115367&r2=115368&view=diff
==============================================================================
--- lldb/trunk/test/dotest.py (original)
+++ lldb/trunk/test/dotest.py Fri Oct 1 17:59:49 2010
@@ -57,6 +57,9 @@
# Ignore the build search path relative to this script to locate the lldb.py module.
ignore = False
+# By default, we skip long running test case. Use "-l" option to override.
+skipLongRunningTest = True
+
# The regular expression pattern to match against eligible filenames as our test cases.
regexp = None
@@ -80,6 +83,7 @@
-d : delay startup for 10 seconds (in order for the debugger to attach)
-i : ignore (don't bailout) if 'lldb.py' module cannot be located in the build
tree relative to this script; use PYTHONPATH to locate the module
+-l : don't skip long running test
-p : specify a regexp filename pattern for inclusion in the test suite
-t : trace lldb command execution and result
-v : do verbose mode of unittest framework
@@ -114,6 +118,7 @@
global configFile
global delay
global ignore
+ global skipLongRunningTest
global regexp
global verbose
global testdirs
@@ -146,6 +151,9 @@
elif sys.argv[index].startswith('-i'):
ignore = True
index += 1
+ elif sys.argv[index].startswith('-l'):
+ skipLongRunningTest = False
+ index += 1
elif sys.argv[index].startswith('-p'):
# Increment by 1 to fetch the reg exp pattern argument.
index += 1
@@ -335,6 +343,11 @@
doDelay(10)
#
+# If '-l' is specified, do not skip the long running tests.
+if not skipLongRunningTest:
+ os.environ["LLDB_SKIP_LONG_RUNNING_TEST"] = "NO"
+
+#
# Walk through the testdirs while collecting test cases.
#
for testdir in testdirs:
Modified: lldb/trunk/test/foundation/TestDisassemble.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/foundation/TestDisassemble.py?rev=115368&r1=115367&r2=115368&view=diff
==============================================================================
--- lldb/trunk/test/foundation/TestDisassemble.py (original)
+++ lldb/trunk/test/foundation/TestDisassemble.py Fri Oct 1 17:59:49 2010
@@ -12,6 +12,39 @@
mydir = "foundation"
+ # rdar://problem/8504895
+ # Crash while doing 'disassemble -n "-[NSNumber descriptionWithLocale:]"
+ @unittest2.skipIf(TestBase.skipLongRunningTest(), "Skip this long running test")
+ def test_foundation_disasm(self):
+ """Do 'disassemble -n func' on each and every 'Code' symbol entry from the Foundation.framework."""
+ self.buildDefault()
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ self.runCmd("image list")
+ raw_output = self.res.GetOutput()
+ # Grok the full path to the foundation framework.
+ for line in raw_output.split(os.linesep):
+ match = re.search(" (/.*/Foundation.framework/.*)$", line)
+ if match:
+ foundation_framework = match.group(1)
+ break
+
+ self.assertTrue(match, "Foundation.framework path located")
+ self.runCmd("image dump symtab %s" % foundation_framework)
+ raw_output = self.res.GetOutput()
+ # Now, grab every 'Code' symbol and feed it into the 'disassemble -n func' command.
+ for line in raw_output.split(os.linesep):
+ # The symbol name is on the last column and trails the flag column which ends with '0000'.
+ match = re.search(" Code .+0000 (.+)$", line)
+ if match:
+ func = match.group(1)
+ print "line:", line
+ print "func:", func
+ self.runCmd('disassemble -n "%s"' % func)
+
+
def test_simple_disasm_with_dsym(self):
"""Test the lldb 'disassemble' command"""
self.buildDsym()
Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=115368&r1=115367&r2=115368&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Fri Oct 1 17:59:49 2010
@@ -264,6 +264,17 @@
class TestBase(unittest2.TestCase):
"""This LLDB abstract base class is meant to be subclassed."""
+ @classmethod
+ def skipLongRunningTest(cls):
+ """
+ By default, we skip long running test case.
+ This can be overridden by passing '-l' to the test driver (dotest.py).
+ """
+ if "LLDB_SKIP_LONG_RUNNING_TEST" in os.environ and "NO" == os.environ["LLDB_SKIP_LONG_RUNNING_TEST"]:
+ return False
+ else:
+ return True
+
# The concrete subclass should override this attribute.
mydir = None
@@ -286,6 +297,11 @@
@classmethod
def setUpClass(cls):
+ """
+ Python unittest framework class setup fixture.
+ Do current directory manipulation.
+ """
+
# Fail fast if 'mydir' attribute is not overridden.
if not cls.mydir or len(cls.mydir) == 0:
raise Exception("Subclasses must override the 'mydir' attribute.")
@@ -301,7 +317,10 @@
@classmethod
def tearDownClass(cls):
- """Do class-wide cleanup."""
+ """
+ Python unittest framework class teardown fixture.
+ Do class-wide cleanup.
+ """
# First, let's do the platform-specific cleanup.
module = __import__(sys.platform)
More information about the lldb-commits
mailing list