[Lldb-commits] [lldb] r117148 - in /lldb/trunk: docs/testsuite/best-practices.txt test/breakpoint_command/TestBreakpointCommand.py test/settings/TestSettings.py

Johnny Chen johnny.chen at apple.com
Fri Oct 22 14:06:04 PDT 2010


Author: johnny
Date: Fri Oct 22 16:06:04 2010
New Revision: 117148

URL: http://llvm.org/viewvc/llvm-project?rev=117148&view=rev
Log:
Add text about test class cleanup.

Modified:
    lldb/trunk/docs/testsuite/best-practices.txt
    lldb/trunk/test/breakpoint_command/TestBreakpointCommand.py
    lldb/trunk/test/settings/TestSettings.py

Modified: lldb/trunk/docs/testsuite/best-practices.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/testsuite/best-practices.txt?rev=117148&r1=117147&r2=117148&view=diff
==============================================================================
--- lldb/trunk/docs/testsuite/best-practices.txt (original)
+++ lldb/trunk/docs/testsuite/best-practices.txt Fri Oct 22 16:06:04 2010
@@ -69,3 +69,25 @@
 the cleanup when we are finished with a test instance, during
 TestBase.tearDown(self).
 
+o Class-wise cleanup after yourself.
+
+TestBase.tearDownClass(cls) provides a mechanism to invoke the platform-specific
+cleanup after finishing with a test class. A test class can have more than one
+test methods, so the tearDownClass(cls) method gets run after all the test
+methods have been executed by the test harness.
+
+The default cleanup action performed by the plugins/darwin.py module invokes the
+"make clean" os command.
+
+If this default cleanup is not enough, individual class can provide an extra
+cleanup hook with a class method named classCleanup , for example,
+in test/breakpoint_command/TestBreakpointCommand.py:
+
+    @classmethod
+    def classCleanup(cls):
+        system(["/bin/sh", "-c", "rm -f output.txt"])
+
+The 'output.txt' file gets generated during the test run, so it makes sense to
+explicitly spell out the action in the same TestBreakpointCommand.py file to do
+the cleanup instead of artificially adding it as part of the default cleanup
+action which serves to cleanup those intermediate and a.out files. 

Modified: lldb/trunk/test/breakpoint_command/TestBreakpointCommand.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/breakpoint_command/TestBreakpointCommand.py?rev=117148&r1=117147&r2=117148&view=diff
==============================================================================
--- lldb/trunk/test/breakpoint_command/TestBreakpointCommand.py (original)
+++ lldb/trunk/test/breakpoint_command/TestBreakpointCommand.py Fri Oct 22 16:06:04 2010
@@ -13,6 +13,7 @@
 
     @classmethod
     def classCleanup(cls):
+        """Cleanup the test byproduct of breakpoint_command_sequence(self)."""
         system(["/bin/sh", "-c", "rm -f output.txt"])
 
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")

Modified: lldb/trunk/test/settings/TestSettings.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/settings/TestSettings.py?rev=117148&r1=117147&r2=117148&view=diff
==============================================================================
--- lldb/trunk/test/settings/TestSettings.py (original)
+++ lldb/trunk/test/settings/TestSettings.py Fri Oct 22 16:06:04 2010
@@ -13,6 +13,7 @@
 
     @classmethod
     def classCleanup(cls):
+        """Cleanup the test byproducts."""
         system(["/bin/sh", "-c", "rm -f output.txt"])
         system(["/bin/sh", "-c", "rm -f stdout.txt"])
 





More information about the lldb-commits mailing list