[Lldb-commits] [lldb] r155018 - in /lldb/branches/lldb-platform-work/test: dotest.py lldb-pre-post-flight.py lldbtest.py

Johnny Chen johnny.chen at apple.com
Wed Apr 18 11:26:24 PDT 2012


Author: johnny
Date: Wed Apr 18 13:26:24 2012
New Revision: 155018

URL: http://llvm.org/viewvc/llvm-project?rev=155018&view=rev
Log:
The 'platform connect' command requires a local cache directory to be supplied.
Also make available the printout of debug statements only when '-t', i.e., trace mode, is on.

Modified:
    lldb/branches/lldb-platform-work/test/dotest.py
    lldb/branches/lldb-platform-work/test/lldb-pre-post-flight.py
    lldb/branches/lldb-platform-work/test/lldbtest.py

Modified: lldb/branches/lldb-platform-work/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/dotest.py?rev=155018&r1=155017&r2=155018&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/dotest.py (original)
+++ lldb/branches/lldb-platform-work/test/dotest.py Wed Apr 18 13:26:24 2012
@@ -99,8 +99,7 @@
 # The pre_flight and post_flight functions come from reading a config file.
 pre_flight = None
 post_flight = None
-# So do the lldbtest_local_cache and lldbtest_remote_sandbox variables.
-lldbtest_local_cache = None
+# So does the lldbtest_remote_sandbox variable.
 lldbtest_remote_sandbox = None
 
 # The 'archs' and 'compilers' can be specified via either command line or configFile,
@@ -666,11 +665,11 @@
     # respectively.
     #
     # See also lldb-trunk/example/test/usage-config.
-    global config, pre_flight, post_flight, lldbtest_local_cache, lldbtest_remote_sandbox
+    global config, pre_flight, post_flight, lldbtest_remote_sandbox
     if configFile:
         # Pass config (a dictionary) as the locals namespace for side-effect.
         execfile(configFile, globals(), config)
-        print "config:", config
+        #print "config:", config
         if "pre_flight" in config:
             pre_flight = config["pre_flight"]
             if not callable(pre_flight):
@@ -681,8 +680,6 @@
             if not callable(post_flight):
                 print "fatal error: post_flight is not callable, exiting."
                 sys.exit(1)
-        if "lldbtest_local_cache" in config:
-            lldbtest_local_cache = config["lldbtest_local_cache"]
         if "lldbtest_remote_sandbox" in config:
             lldbtest_remote_sandbox = config["lldbtest_remote_sandbox"]
         #print "sys.stderr:", sys.stderr
@@ -1058,8 +1055,7 @@
 print "lldb.pre_flight:", getsource_if_available(lldb.pre_flight)
 print "lldb.post_flight:", getsource_if_available(lldb.post_flight)
 
-# So do the lldbtest_local_cache and lldbtest_remote_sandbox variables.
-lldb.lldbtest_local_cache = lldbtest_local_cache
+# So does the lldbtest_remote_sandbox variable.
 lldb.lldbtest_remote_sandbox = lldbtest_remote_sandbox
 
 # Put all these test decorators in the lldb namespace.

Modified: lldb/branches/lldb-platform-work/test/lldb-pre-post-flight.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lldb-pre-post-flight.py?rev=155018&r1=155017&r2=155018&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lldb-pre-post-flight.py (original)
+++ lldb/branches/lldb-platform-work/test/lldb-pre-post-flight.py Wed Apr 18 13:26:24 2012
@@ -19,11 +19,12 @@
     print "for test case:", test
     # Examples:
     #test.runCmd('platform select remote-macosx')
-    #test.runCmd('platform connect connect://localhost:12345 -r -R "-avz"')
+    #test.runCmd('platform connect -c /tmp/cache connect://localhost:12345 -r -R "-avz"')
+    lldbtest_local_cache = os.environ['LLDBTEST_LOCAL_CACHE'] if 'LLDBTEST_LOCAL_CACHE' in os.environ else '/tmp/cache'
     lldbtest_platform = os.environ['LLDBTEST_PLATFORM'] if 'LLDBTEST_PLATFORM' in os.environ else 'remote-macosx'
     lldbtest_platform_url = os.environ['LLDBTEST_PLATFORM_URL'] if 'LLDBTEST_PLATFORM_URL' in os.environ else 'connect://localhost:12345 -r -R "-avz"'
     test.runCmd('platform select %s' % lldbtest_platform)
-    test.runCmd('platform connect %s' % lldbtest_platform_url)
+    test.runCmd('platform connect %s -c %s' % (lldbtest_platform_url, lldbtest_local_cache))
 
 def post_flight(test):
     __import__("lldb")
@@ -33,5 +34,4 @@
     print "for test case:", test
     test.runCmd('platform disconnect')
 
-lldbtest_local_cache = os.environ['LLDBTEST_LOCAL_CACHE'] if 'LLDBTEST_LOCAL_CACHE' in os.environ else '/tmp/cache'
 lldbtest_remote_sandbox = os.environ['LLDBTEST_REMOTE_SANDBOX'] if 'LLDBTEST_REMOTE_SANDBOX' in os.environ else None

Modified: lldb/branches/lldb-platform-work/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lldbtest.py?rev=155018&r1=155017&r2=155018&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lldbtest.py (original)
+++ lldb/branches/lldb-platform-work/test/lldbtest.py Wed Apr 18 13:26:24 2012
@@ -1114,21 +1114,22 @@
         if not cmd or len(cmd) == 0:
             raise Exception("Bad 'cmd' parameter encountered")
 
+        trace = (True if traceAlways else trace)
+
         # This is an opportunity to insert the 'platform target-install' command if we are told so
         # via the settig of lldb.lldbtest_remote_sandbox.
         if cmd.startswith("file ") and lldb.lldbtest_remote_sandbox:
-            target = cmd.split("file ")[1]
-            print "Found a file command, target=%s" % target
-            fpath, fname = os.path.split(target)
-            parent_dir = os.path.split(fpath)[0]
-            platform_target_install_command = 'platform target-install %s %s' % (fpath, lldb.lldbtest_remote_sandbox)
-            print "Insert this command to be run first: %s" % platform_target_install_command
-            self.ci.HandleCommand(platform_target_install_command, self.res)
-            # And this is the file command we want to execute, instead.
-            cmd = "file -P %s %s" % (target.replace(parent_dir, lldb.lldbtest_remote_sandbox), target)
-            print "And this is the replaced file command: %s" % cmd
-
-        trace = (True if traceAlways else trace)
+            with recording(self, trace) as sbuf:
+                target = cmd.split("file ")[1]
+                print >> sbuf, "Found a file command, target=%s" % target
+                fpath, fname = os.path.split(target)
+                parent_dir = os.path.split(fpath)[0]
+                platform_target_install_command = 'platform target-install %s %s' % (fpath, lldb.lldbtest_remote_sandbox)
+                print >> sbuf, "Insert this command to be run first: %s" % platform_target_install_command
+                self.ci.HandleCommand(platform_target_install_command, self.res)
+                # And this is the file command we want to execute, instead.
+                cmd = "file -P %s %s" % (target.replace(parent_dir, lldb.lldbtest_remote_sandbox), target)
+                print >> sbuf, "And this is the replaced file command: %s" % cmd
 
         running = (cmd.startswith("run") or cmd.startswith("process launch"))
 





More information about the lldb-commits mailing list