[Lldb-commits] [lldb] r204258 - Check if "golden_output.txt" exists before trying to delete it rather than just raising an uncaught error.

Jim Ingham jingham at apple.com
Wed Mar 19 12:45:38 PDT 2014


Author: jingham
Date: Wed Mar 19 14:45:37 2014
New Revision: 204258

URL: http://llvm.org/viewvc/llvm-project?rev=204258&view=rev
Log:
Check if "golden_output.txt" exists before trying to delete it rather than just raising an uncaught error.

Modified:
    lldb/trunk/test/types/AbstractBase.py

Modified: lldb/trunk/test/types/AbstractBase.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/types/AbstractBase.py?rev=204258&r1=204257&r2=204258&view=diff
==============================================================================
--- lldb/trunk/test/types/AbstractBase.py (original)
+++ lldb/trunk/test/types/AbstractBase.py Wed Mar 19 14:45:37 2014
@@ -29,12 +29,14 @@ class GenericTester(TestBase):
         # module cacheing subsystem to be confused with executable name "a.out"
         # used for all the test cases.
         self.exe_name = self.testMethodName
+        self.golden_filename = os.path.join(os.getcwd(), "golden-output.txt")
 
     def tearDown(self):
         """Cleanup the test byproducts."""
         TestBase.tearDown(self)
         #print "Removing golden-output.txt..."
-        os.remove("golden-output.txt")
+        if os.path.exists(self.golden_filename):
+            os.remove(self.golden_filename)
 
     #==========================================================================#
     # Functions build_and_run() and build_and_run_expr() are generic functions #
@@ -86,8 +88,8 @@ class GenericTester(TestBase):
 
         # First, capture the golden output emitted by the oracle, i.e., the
         # series of printf statements.
-        self.runCmd("process launch -o golden-output.txt")
-        with open("golden-output.txt") as f:
+        self.runCmd('process launch -o "%s"'%(self.golden_filename))
+        with open(self.golden_filename) as f:
             go = f.read()
 
         # This golden list contains a list of (variable, value) pairs extracted
@@ -167,8 +169,8 @@ class GenericTester(TestBase):
 
         # First, capture the golden output emitted by the oracle, i.e., the
         # series of printf statements.
-        self.runCmd("process launch -o golden-output.txt")
-        with open("golden-output.txt") as f:
+        self.runCmd('process launch -o "%s"'%(self.golden_filename))
+        with open(self.golden_filename) as f:
             go = f.read()
 
         # This golden list contains a list of (variable, value) pairs extracted





More information about the lldb-commits mailing list