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

Johnny Chen johnny.chen at apple.com
Tue Apr 17 19:11:52 PDT 2012


Author: johnny
Date: Tue Apr 17 21:11:52 2012
New Revision: 154979

URL: http://llvm.org/viewvc/llvm-project?rev=154979&view=rev
Log:
Make the remote_sandbox and local_cache configurable via the config file.  This is required for the work in progress
to make some of the test suite executed remotely on another macosx machine.

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=154979&r1=154978&r2=154979&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/dotest.py (original)
+++ lldb/branches/lldb-platform-work/test/dotest.py Tue Apr 17 21:11:52 2012
@@ -99,6 +99,9 @@
 # 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
+lldbtest_remote_sandbox = None
 
 # The 'archs' and 'compilers' can be specified via either command line or configFile,
 # with the command line overriding the configFile.  When specified, they should be
@@ -663,7 +666,7 @@
     # respectively.
     #
     # See also lldb-trunk/example/test/usage-config.
-    global config, pre_flight, post_flight
+    global config, pre_flight, post_flight, lldbtest_local_cache, lldbtest_remote_sandbox
     if configFile:
         # Pass config (a dictionary) as the locals namespace for side-effect.
         execfile(configFile, globals(), config)
@@ -678,6 +681,10 @@
             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
         #print "sys.stdout:", sys.stdout
 
@@ -1051,6 +1058,10 @@
 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
+lldb.lldbtest_remote_sandbox = lldbtest_remote_sandbox
+
 # Put all these test decorators in the lldb namespace.
 lldb.dont_do_python_api_test = dont_do_python_api_test
 lldb.just_do_python_api_test = just_do_python_api_test

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=154979&r1=154978&r2=154979&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 Tue Apr 17 21:11:52 2012
@@ -33,3 +33,5 @@
     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=154979&r1=154978&r2=154979&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lldbtest.py (original)
+++ lldb/branches/lldb-platform-work/test/lldbtest.py Tue Apr 17 21:11:52 2012
@@ -1110,9 +1110,24 @@
         return status.
         """
         # Fail fast if 'cmd' is not meaningful.
+        cmd = cmd.strip()
         if not cmd or len(cmd) == 0:
             raise Exception("Bad 'cmd' parameter encountered")
 
+        # 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)
 
         running = (cmd.startswith("run") or cmd.startswith("process launch"))





More information about the lldb-commits mailing list