[Lldb-commits] [lldb] r158809 - in /lldb/trunk/test: functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py lldbtest.py settings/TestSettings.py terminal/TestSTTYBeforeAndAfter.py warnings/uuid/TestUUIDMismatchWanring.py

Filipe Cabecinhas me at filcab.net
Wed Jun 20 03:13:40 PDT 2012


Author: filcab
Date: Wed Jun 20 05:13:40 2012
New Revision: 158809

URL: http://llvm.org/viewvc/llvm-project?rev=158809&view=rev
Log:
Continue the cleanup started on r158737

Adds a utility class method to TestBase that checks and removes a temp
file.
Removed every use of system() to execute rm -f.

Modified:
    lldb/trunk/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
    lldb/trunk/test/lldbtest.py
    lldb/trunk/test/settings/TestSettings.py
    lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py
    lldb/trunk/test/warnings/uuid/TestUUIDMismatchWanring.py

Modified: lldb/trunk/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py?rev=158809&r1=158808&r2=158809&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py (original)
+++ lldb/trunk/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py Wed Jun 20 05:13:40 2012
@@ -14,7 +14,8 @@
     @classmethod
     def classCleanup(cls):
         """Cleanup the test byproduct of breakpoint_command_sequence(self)."""
-        system(["/bin/sh", "-c", "rm -f output.txt output2.txt"])
+        cls.RemoveTempFile("output.txt")
+        cls.RemoveTempFile("output2.txt")
 
     @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
     @dsym_test
@@ -109,10 +110,8 @@
                      patterns = ["Breakpoint created: [0-9]+: source regex = \"is about to return \[12\]0\", locations = 1"])
       
         # Run the program.  Remove 'output.txt' if it exists.
-        if os.path.exists('output.txt'):
-            os.remove('output.txt')
-        if os.path.exists('output2.txt'):
-            os.remove('output2.txt')
+        self.RemoveTempFile("output.txt")
+        self.RemoveTempFile("output2.txt")
         self.runCmd("run", RUN_SUCCEEDED)
 
         # Check that the file 'output.txt' exists and contains the string "lldb".

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=158809&r1=158808&r2=158809&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Wed Jun 20 05:13:40 2012
@@ -1222,3 +1222,8 @@
             return
 
         print child
+
+    @classmethod
+    def RemoveTempFile(cls, file):
+        if os.path.exists(file):
+            os.remove(file)

Modified: lldb/trunk/test/settings/TestSettings.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/settings/TestSettings.py?rev=158809&r1=158808&r2=158809&view=diff
==============================================================================
--- lldb/trunk/test/settings/TestSettings.py (original)
+++ lldb/trunk/test/settings/TestSettings.py Wed Jun 20 05:13:40 2012
@@ -14,10 +14,10 @@
     @classmethod
     def classCleanup(cls):
         """Cleanup the test byproducts."""
-        system(["/bin/sh", "-c", "rm -f output1.txt"])
-        system(["/bin/sh", "-c", "rm -f output2.txt"])
-        system(["/bin/sh", "-c", "rm -f stderr.txt"])
-        system(["/bin/sh", "-c", "rm -f stdout.txt"])
+        cls.RemoveTempFile("output1.txt")
+        cls.RemoveTempFile("output2.txt")
+        cls.RemoveTempFile("stderr.txt")
+        cls.RemoveTempFile("stdout.txt")
 
     def test_apropos_should_also_search_settings_description(self):
         """Test that 'apropos' command should also search descriptions for the settings variables."""

Modified: lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py?rev=158809&r1=158808&r2=158809&view=diff
==============================================================================
--- lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py (original)
+++ lldb/trunk/test/terminal/TestSTTYBeforeAndAfter.py Wed Jun 20 05:13:40 2012
@@ -15,10 +15,10 @@
     @classmethod
     def classCleanup(cls):
         """Cleanup the test byproducts."""
-        system(["/bin/sh", "-c", "rm -f child_send1.txt"])
-        system(["/bin/sh", "-c", "rm -f child_read1.txt"])
-        system(["/bin/sh", "-c", "rm -f child_send2.txt"])
-        system(["/bin/sh", "-c", "rm -f child_read2.txt"])
+        cls.RemoveTempFile("child_send1.txt")
+        cls.RemoveTempFile("child_read1.txt")
+        cls.RemoveTempFile("child_send2.txt")
+        cls.RemoveTempFile("child_read2.txt")
 
     def test_stty_dash_a_before_and_afetr_invoking_lldb_command(self):
         """Test that 'stty -a' displays the same output before and after running the lldb command."""

Modified: lldb/trunk/test/warnings/uuid/TestUUIDMismatchWanring.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/warnings/uuid/TestUUIDMismatchWanring.py?rev=158809&r1=158808&r2=158809&view=diff
==============================================================================
--- lldb/trunk/test/warnings/uuid/TestUUIDMismatchWanring.py (original)
+++ lldb/trunk/test/warnings/uuid/TestUUIDMismatchWanring.py Wed Jun 20 05:13:40 2012
@@ -14,8 +14,8 @@
     @classmethod
     def classCleanup(cls):
         """Cleanup the test byproducts."""
-        system(["/bin/sh", "-c", "rm -f child_send.txt"])
-        system(["/bin/sh", "-c", "rm -f child_read.txt"])
+        cls.RemoveTempFile("child_send.txt")
+        cls.RemoveTempFile("child_read.txt")
 
     def setUp(self):
         TestBase.setUp(self)





More information about the lldb-commits mailing list