Bug 1440714 - handle su-rooted devices, r=gbrown, jonco
authorBob Clary <bclary@bclary.com>
Fri, 20 Apr 2018 00:29:28 -0700
changeset 468273 94dbb9a11fb3e810fedfb8f2afd09491a207ce66
parent 468272 096da0066db8e6b4c825e82024491c69762a4ae7
child 468274 f12bb3ab364dce8f15204425922b995bb094b118
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgbrown, jonco
bugs1440714
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1440714 - handle su-rooted devices, r=gbrown, jonco
js/src/tests/lib/jittests.py
--- a/js/src/tests/lib/jittests.py
+++ b/js/src/tests/lib/jittests.py
@@ -695,48 +695,59 @@ def push_libs(options, device):
     # to the device but needs to be updated if the dependencies change.
     required_libs = ['libnss3.so', 'libmozglue.so', 'libnspr4.so',
                      'libplc4.so', 'libplds4.so']
 
     for file in os.listdir(options.local_lib):
         if file in required_libs:
             remote_file = posixpath.join(options.remote_test_root, file)
             device.push(os.path.join(options.local_lib, file), remote_file)
+            device.chmod(remote_file, root=True)
 
 def push_progs(options, device, progs):
     for local_file in progs:
         remote_file = posixpath.join(options.remote_test_root,
                                      os.path.basename(local_file))
         device.push(local_file, remote_file)
+        device.chmod(remote_file, root=True)
+
+def init_remote_dir(device, path, root=True):
+    device.rm(path, recursive=True, force=True, root=root)
+    device.mkdir(path, parents=True, root=root)
+    device.chmod(path, recursive=True, root=root)
 
 def run_tests_remote(tests, num_tests, prefix, options, slog):
     # Setup device with everything needed to run our tests.
     from mozdevice import ADBAndroid
     device = ADBAndroid(device=options.device_serial,
                         test_root=options.remote_test_root)
 
+    init_remote_dir(device, options.remote_test_root)
+
     # Update the test root to point to our test directory.
     jit_tests_dir = posixpath.join(options.remote_test_root, 'jit-tests')
     options.remote_test_root = posixpath.join(jit_tests_dir, 'jit-tests')
 
     # Push js shell and libraries.
-    device.rm(jit_tests_dir, force=True, recursive=True)
-    device.mkdir(options.remote_test_root, parents=True)
+    init_remote_dir(device, jit_tests_dir)
     push_libs(options, device)
     push_progs(options, device, [prefix[0]])
     device.chmod(options.remote_test_root, recursive=True, root=True)
 
     JitTest.CacheDir = posixpath.join(options.remote_test_root, '.js-cache')
-    device.mkdir(JitTest.CacheDir)
+    init_remote_dir(device, JitTest.CacheDir)
 
-    device.push(JS_TESTS_DIR, posixpath.join(jit_tests_dir, 'tests'),
-                timeout=600)
+    jtd_tests = posixpath.join(jit_tests_dir, 'tests')
+    init_remote_dir(device, jtd_tests)
+    device.push(JS_TESTS_DIR, jtd_tests, timeout=600)
+    device.chmod(jtd_tests, recursive=True, root=True)
 
     device.push(os.path.dirname(TEST_DIR), options.remote_test_root,
                 timeout=600)
+    device.chmod(options.remote_test_root, recursive=True, root=True)
     prefix[0] = os.path.join(options.remote_test_root, 'js')
 
     # Run all tests.
     pb = create_progressbar(num_tests, options)
     gen = get_remote_results(tests, device, prefix, options)
     ok = process_test_results(gen, num_tests, pb, options, slog)
     return ok