Bug 824724 - Allow --remoteTestRoot option in remotecppunittests.py; r=jmaher
authorGeoff Brown <gbrown@mozilla.com>
Thu, 03 Jan 2013 13:02:01 -0700
changeset 117489 386333461d424e5f1e5db7ee619f6c6143a5d1ef
parent 117488 348e89acb5f3dc8bc5d4cb71d7ab2c903ea3b331
child 117490 05cfc19ac6e1e99d9f193ba7ed515440448e33e3
push idunknown
push userunknown
push dateunknown
reviewersjmaher
bugs824724
milestone20.0a1
Bug 824724 - Allow --remoteTestRoot option in remotecppunittests.py; r=jmaher
testing/remotecppunittests.py
--- a/testing/remotecppunittests.py
+++ b/testing/remotecppunittests.py
@@ -126,16 +126,23 @@ class RemoteCPPUnittestOptions(cppunitte
                         help = "do not copy any files to device (to be used only if device is already setup)")
         defaults["setup"] = True
 
         self.add_option("--localLib", action="store",
                         type = "string", dest = "local_lib",
                         help = "location of libraries to push -- preferably stripped")
         defaults["local_lib"] = None
 
+        self.add_option("--remoteTestRoot", action = "store",
+                    type = "string", dest = "remote_test_root",
+                    help = "remote directory to use as test root (eg. /data/local/tests)")
+        # /data/local/tests is used because it is usually not possible to set +x permissions
+        # on binaries on /mnt/sdcard
+        defaults["remote_test_root"] = "/data/local/tests"
+
         self.set_defaults(**defaults)
 
 def main():
     parser = RemoteCPPUnittestOptions()
     options, args = parser.parse_args()
     if not args:
         print >>sys.stderr, """Usage: %s <test binary> [<test binary>...]""" % sys.argv[0]
         sys.exit(1)
@@ -145,21 +152,21 @@ def main():
     if not os.path.isdir(options.local_lib):
         print >>sys.stderr, """Error: --localLib directory %s not found""" % options.local_lib
         sys.exit(1)
     if not options.xre_path:
         print >>sys.stderr, """Error: --xre-path is required"""
         sys.exit(1)
     if options.dm_trans == "adb":
         if options.device_ip:
-            dm = devicemanagerADB.DeviceManagerADB(options.device_ip, options.device_port, packageName=None)
+            dm = devicemanagerADB.DeviceManagerADB(options.device_ip, options.device_port, packageName=None, deviceRoot=options.remote_test_root)
         else:
-            dm = devicemanagerADB.DeviceManagerADB(packageName=None)
+            dm = devicemanagerADB.DeviceManagerADB(packageName=None, deviceRoot=options.remote_test_root)
     else:
-        dm = devicemanagerSUT.DeviceManagerSUT(options.device_ip, options.device_port)
+        dm = devicemanagerSUT.DeviceManagerSUT(options.device_ip, options.device_port, deviceRoot=options.remote_test_root)
         if not options.device_ip:
             print "Error: you must provide a device IP to connect to via the --deviceIP option"
             sys.exit(1)
     options.xre_path = os.path.abspath(options.xre_path)
     progs = [os.path.abspath(p) for p in args]
     tester = RemoteCPPUnitTests(dm, options, progs)
     try:
         result = tester.run_tests(progs, options.xre_path, options.symbols_path)