[Lldb-commits] [lldb] r144919 - in /lldb/trunk/test: dotest.py lldbtest.py

Johnny Chen johnny.chen at apple.com
Thu Nov 17 11:57:27 PST 2011


Author: johnny
Date: Thu Nov 17 13:57:27 2011
New Revision: 144919

URL: http://llvm.org/viewvc/llvm-project?rev=144919&view=rev
Log:
Add an option '-S' to skip the build and cleanup while running the test.
Use this option with care as you would need to build the inferior(s) by hand
and build the executable(s) with the correct name(s).  This option can be used
with '-# n' to stress test certain test cases for n number of times.

An example:

[11:55:11] johnny:/Volumes/data/lldb/svn/trunk/test/python_api/value $ ls
Makefile		TestValueAPI.pyc	linked_list
TestValueAPI.py		change_values		main.c
[11:55:14] johnny:/Volumes/data/lldb/svn/trunk/test/python_api/value $ make EXE=test_with_dsym
clang -gdwarf-2 -O0  -arch x86_64   -c -o main.o main.c
clang -gdwarf-2 -O0  -arch x86_64   main.o -o "test_with_dsym"
/usr/bin/dsymutil  -o "test_with_dsym.dSYM" "test_with_dsym"
[11:55:20] johnny:/Volumes/data/lldb/svn/trunk/test/python_api/value $ cd ../..
[11:55:24] johnny:/Volumes/data/lldb/svn/trunk/test $ ./dotest.py -v -# 10 -S -f ValueAPITestCase.test_with_dsym
LLDB build dir: /Volumes/data/lldb/svn/trunk/build/Debug
LLDB-89
Path: /Volumes/data/lldb/svn/trunk
URL: https://johnny@llvm.org/svn/llvm-project/lldb/trunk
Repository Root: https://johnny@llvm.org/svn/llvm-project
Repository UUID: 91177308-0d34-0410-b5e6-96231b3b80d8
Revision: 144914
Node Kind: directory
Schedule: normal
Last Changed Author: gclayton
Last Changed Rev: 144911
Last Changed Date: 2011-11-17 09:22:31 -0800 (Thu, 17 Nov 2011)



Session logs for test failures/errors/unexpected successes will go into directory '2011-11-17-11_55_29'
Command invoked: python ./dotest.py -v -# 10 -S -f ValueAPITestCase.test_with_dsym
----------------------------------------------------------------------
Collected 1 test

1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 1.163s

OK
1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 0.200s

OK
1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 0.198s

OK
1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 0.199s

OK
1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 0.239s

OK
1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 1.215s

OK
1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 0.105s

OK
1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 0.098s

OK
1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 0.195s

OK
1: test_with_dsym (TestValueAPI.ValueAPITestCase)
   Exercise some SBValue APIs. ... ok

----------------------------------------------------------------------
Ran 1 test in 1.197s

OK
[11:55:34] johnny:/Volumes/data/lldb/svn/trunk/test $ 

Modified:
    lldb/trunk/test/dotest.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=144919&r1=144918&r2=144919&view=diff
==============================================================================
--- lldb/trunk/test/dotest.py (original)
+++ lldb/trunk/test/dotest.py Thu Nov 17 13:57:27 2011
@@ -128,8 +128,11 @@
 # Ignore the build search path relative to this script to locate the lldb.py module.
 ignore = False
 
+# By default, we do not skip build and cleanup.  Use '-S' option to override.
+skip_build_and_cleanup = False
+
 # By default, we skip long running test case.  Use '-l' option to override.
-skipLongRunningTest = True
+skip_long_running_test = True
 
 # By default, we print the build dir, lldb version, and svn info.  Use '-n' option to
 # turn it off.
@@ -210,6 +213,11 @@
 -r   : specify a dir to relocate the tests and their intermediate files to;
        the directory must not exist before running this test driver;
        no cleanup of intermediate test files is performed in this case
+-S   : skip the build and cleanup while running the test
+       use this option with care as you would need to build the inferior(s) by hand
+       and build the executable(s) with the correct name(s)
+       this can be used with '-# n' to stress test certain test cases for n number of
+       times
 -s   : specify the name of the dir created to store the session files of tests
        with errored or failed status; if not specified, the test driver uses the
        timestamp as the session dir name
@@ -337,7 +345,8 @@
     global fs4all
     global ignore
     global runHooks
-    global skipLongRunningTest
+    global skip_build_and_cleanup
+    global skip_long_running_test
     global noHeaders
     global regexp
     global rdir
@@ -448,7 +457,7 @@
             runHooks.append(sys.argv[index])
             index += 1
         elif sys.argv[index].startswith('-l'):
-            skipLongRunningTest = False
+            skip_long_running_test = False
             index += 1
         elif sys.argv[index].startswith('-n'):
             noHeaders = True
@@ -470,6 +479,9 @@
                 print "Relocated directory:", rdir, "must not exist!"
                 usage()
             index += 1
+        elif sys.argv[index].startswith('-S'):
+            skip_build_and_cleanup = True
+            index += 1
         elif sys.argv[index].startswith('-s'):
             # Increment by 1 to fetch the session dir name.
             index += 1
@@ -895,7 +907,7 @@
 
 #
 # If '-l' is specified, do not skip the long running tests.
-if not skipLongRunningTest:
+if not skip_long_running_test:
     os.environ["LLDB_SKIP_LONG_RUNNING_TEST"] = "NO"
 
 #
@@ -927,6 +939,9 @@
 lldb.just_do_python_api_test = just_do_python_api_test
 lldb.just_do_benchmarks_test = just_do_benchmarks_test
 
+# Do we need to skip build and cleanup?
+lldb.skip_build_and_cleanup = skip_build_and_cleanup
+
 # Put bmExecutable, bmBreakpointSpec, and bmIterationCount into the lldb namespace, too.
 lldb.bmExecutable = bmExecutable
 lldb.bmBreakpointSpec = bmBreakpointSpec

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=144919&r1=144918&r2=144919&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Thu Nov 17 13:57:27 2011
@@ -438,7 +438,7 @@
         Do class-wide cleanup.
         """
 
-        if doCleanup:
+        if doCleanup and not lldb.skip_build_and_cleanup:
             # First, let's do the platform-specific cleanup.
             module = builder_module()
             if not module.cleanup():
@@ -673,17 +673,13 @@
 
         # Perform registered teardown cleanup.
         if doCleanup and self.doTearDownCleanup:
-            module = builder_module()
-            if not module.cleanup(self, dictionary=self.dict):
-                raise Exception("Don't know how to do cleanup with dictionary: " + self.dict)
+            self.cleanup(dictionary=self.dict)
 
         # In rare cases where there are multiple teardown cleanups added.
         if doCleanup and self.doTearDownCleanups:
-            module = builder_module()
             if self.dicts:
                 for dict in reversed(self.dicts):
-                    if not module.cleanup(self, dictionary=dict):
-                        raise Exception("Don't know how to do cleanup with dictionary: " + dict)
+                    self.cleanup(dictionary=dict)
 
         # Decide whether to dump the session info.
         self.dumpSessionInfo()
@@ -832,27 +828,35 @@
 
     def buildDefault(self, architecture=None, compiler=None, dictionary=None):
         """Platform specific way to build the default binaries."""
+        if lldb.skip_build_and_cleanup:
+            return
         module = builder_module()
         if not module.buildDefault(self, architecture, compiler, dictionary):
             raise Exception("Don't know how to build default binary")
 
     def buildDsym(self, architecture=None, compiler=None, dictionary=None):
         """Platform specific way to build binaries with dsym info."""
+        if lldb.skip_build_and_cleanup:
+            return
         module = builder_module()
         if not module.buildDsym(self, architecture, compiler, dictionary):
             raise Exception("Don't know how to build binary with dsym")
 
     def buildDwarf(self, architecture=None, compiler=None, dictionary=None):
         """Platform specific way to build binaries with dwarf maps."""
+        if lldb.skip_build_and_cleanup:
+            return
         module = builder_module()
         if not module.buildDwarf(self, architecture, compiler, dictionary):
             raise Exception("Don't know how to build binary with dwarf")
 
     def cleanup(self, dictionary=None):
         """Platform specific way to do cleanup after build."""
+        if lldb.skip_build_and_cleanup:
+            return
         module = builder_module()
         if not module.cleanup(self, dictionary):
-            raise Exception("Don't know how to do cleanup")
+            raise Exception("Don't know how to do cleanup with dictionary: "+dictionary)
 
 
 class TestBase(Base):





More information about the lldb-commits mailing list