[Lldb-commits] [lldb] r154699 - /lldb/trunk/test/types/AbstractBase.py

Johnny Chen johnny.chen at apple.com
Fri Apr 13 13:40:52 PDT 2012


Author: johnny
Date: Fri Apr 13 15:40:52 2012
New Revision: 154699

URL: http://llvm.org/viewvc/llvm-project?rev=154699&view=rev
Log:
First step to make the test suite runnable for remote platforms.

For the types directory, we were running lldbtest.system() to execute the compiled program
on the test host to collect golden output in order to compare with the output of various
lldb debugger commands as performed later.  This won't work for the remote platform
scenario where the architecture of the target and host platforms are different.

Modify the AbstractBase class to use lldb to launch the inferior while specifying the
output file, from which the golden output is collected and grokked.  How to bootstrap and
to connect to the remote platform is still being worked at.

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=154699&r1=154698&r2=154699&view=diff
==============================================================================
--- lldb/trunk/test/types/AbstractBase.py (original)
+++ lldb/trunk/test/types/AbstractBase.py Fri Apr 13 15:40:52 2012
@@ -29,6 +29,12 @@
         # used for all the test cases.
         self.exe_name = self.testMethodName
 
+    def tearDown(self):
+        """Cleanup the test byproducts."""
+        TestBase.tearDown(self)
+        #print "Removing golden-output.txt..."
+        os.remove("golden-output.txt")
+
     #==========================================================================#
     # Functions build_and_run() and build_and_run_expr() are generic functions #
     # which are called from the Test*Types*.py test cases.  The API client is  #
@@ -75,9 +81,14 @@
     def generic_type_tester(self, exe_name, atoms, quotedDisplay=False, blockCaptured=False):
         """Test that variables with basic types are displayed correctly."""
 
+        self.runCmd("file %s" % exe_name, CURRENT_EXECUTABLE_SET)
+
         # First, capture the golden output emitted by the oracle, i.e., the
         # series of printf statements.
-        go = system("./%s" % exe_name, sender=self)[0]
+        self.runCmd("process launch -o golden-output.txt")
+        with open("golden-output.txt") as f:
+            go = f.read()
+
         # This golden list contains a list of (variable, value) pairs extracted
         # from the golden output.
         gl = []
@@ -98,7 +109,6 @@
 
         # Bring the program to the point where we can issue a series of
         # 'frame variable -T' command.
-        self.runCmd("file %s" % exe_name, CURRENT_EXECUTABLE_SET)
         if blockCaptured:
             break_line = line_number ("basic_type.cpp", "// Break here to test block captured variables.")
         else:
@@ -148,9 +158,14 @@
     def generic_type_expr_tester(self, exe_name, atoms, quotedDisplay=False, blockCaptured=False):
         """Test that variable expressions with basic types are evaluated correctly."""
 
+        self.runCmd("file %s" % exe_name, CURRENT_EXECUTABLE_SET)
+
         # First, capture the golden output emitted by the oracle, i.e., the
         # series of printf statements.
-        go = system("./%s" % exe_name, sender=self)[0]
+        self.runCmd("process launch -o golden-output.txt")
+        with open("golden-output.txt") as f:
+            go = f.read()
+
         # This golden list contains a list of (variable, value) pairs extracted
         # from the golden output.
         gl = []
@@ -171,7 +186,6 @@
 
         # Bring the program to the point where we can issue a series of
         # 'expr' command.
-        self.runCmd("file %s" % exe_name, CURRENT_EXECUTABLE_SET)
         if blockCaptured:
             break_line = line_number ("basic_type.cpp", "// Break here to test block captured variables.")
         else:





More information about the lldb-commits mailing list