From f43e690147ef5633108ecbd38a38760b16c2db15 Mon Sep 17 00:00:00 2001 From: "Nicolas B. Pierron" Date: Fri, 26 Feb 2021 11:19:59 +0000 Subject: [PATCH] Bug 1692178 - Android Jit tests: Only push jit-test tests files. r=jandem This patch removes the tests directory upload (196 MB) and replace it by 3 files upload. Some of the tests under jit-test directory are using library files of the tests directory. This patch changes multiple things to make this work: - `tests/**/*.js` files are now aliased under jit-test/lib. - jit-test tests are updated to only reference jit-test/lib. - Replace lib files by their aliased versions when uploading the test suite. Thus avoiding references to `../../tests/`. - The remote_root_directory no longer changed to be under the tests directory. - The prologue.js path is updated accordingly. Differential Revision: https://phabricator.services.mozilla.com/D106472 --- js/src/jit-test/jit_test.py | 4 +--- js/src/jit-test/lib/asserts.js | 2 +- js/src/jit-test/lib/math.js | 1 + js/src/jit-test/lib/non262.js | 1 + js/src/jit-test/tests/basic/hypot-approx.js | 2 +- js/src/jit-test/tests/ion/pow-base-power-of-two.js | 2 +- js/src/tests/lib/tasks_adb_remote.py | 14 +++++++++----- 7 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 js/src/jit-test/lib/math.js create mode 100644 js/src/jit-test/lib/non262.js diff --git a/js/src/jit-test/jit_test.py b/js/src/jit-test/jit_test.py index 4a7db9fff678..f5d7794d1558 100755 --- a/js/src/jit-test/jit_test.py +++ b/js/src/jit-test/jit_test.py @@ -517,9 +517,7 @@ def main(argv): ) prologue = os.path.join(jittests.LIB_DIR, "prologue.js") if options.remote: - prologue = posixpath.join( - options.remote_test_root, "tests", "tests", "lib", "prologue.js" - ) + prologue = posixpath.join(options.remote_test_root, "lib", "prologue.js") prefix += ["-f", prologue] diff --git a/js/src/jit-test/lib/asserts.js b/js/src/jit-test/lib/asserts.js index 0124e064886a..6a76e7bab546 100644 --- a/js/src/jit-test/lib/asserts.js +++ b/js/src/jit-test/lib/asserts.js @@ -3,7 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -load(libdir + "../../tests/non262/shell.js"); +load(libdir + "non262.js"); if (typeof assertWarning === 'undefined') { var assertWarning = function assertWarning(f, pattern) { diff --git a/js/src/jit-test/lib/math.js b/js/src/jit-test/lib/math.js new file mode 100644 index 000000000000..116ed477d8b4 --- /dev/null +++ b/js/src/jit-test/lib/math.js @@ -0,0 +1 @@ +loadRelativeToScript("../../tests/non262/Math/shell.js"); diff --git a/js/src/jit-test/lib/non262.js b/js/src/jit-test/lib/non262.js new file mode 100644 index 000000000000..e840038a7e2c --- /dev/null +++ b/js/src/jit-test/lib/non262.js @@ -0,0 +1 @@ +loadRelativeToScript("../../tests/non262/shell.js"); diff --git a/js/src/jit-test/tests/basic/hypot-approx.js b/js/src/jit-test/tests/basic/hypot-approx.js index 639a9793f819..b848b1fe607d 100644 --- a/js/src/jit-test/tests/basic/hypot-approx.js +++ b/js/src/jit-test/tests/basic/hypot-approx.js @@ -1,4 +1,4 @@ -loadRelativeToScript("../../../tests/non262/Math/shell.js"); +load(libdir + "math.js"); for (var i = -20; i < 20; i++) { assertEq(Math.hypot(+0, i), Math.abs(i)); diff --git a/js/src/jit-test/tests/ion/pow-base-power-of-two.js b/js/src/jit-test/tests/ion/pow-base-power-of-two.js index 35ae52a28d34..7e3baf82efb4 100644 --- a/js/src/jit-test/tests/ion/pow-base-power-of-two.js +++ b/js/src/jit-test/tests/ion/pow-base-power-of-two.js @@ -1,7 +1,7 @@ // Lowering provides a specialisation when the base operand is a constant which // is a power of two. -loadRelativeToScript("../../../tests/non262/Math/shell.js"); +load(libdir + "math.js"); function test(x, y, z) { function pow(x, y) { return `Math.pow(${x}, ${y})` }; diff --git a/js/src/tests/lib/tasks_adb_remote.py b/js/src/tests/lib/tasks_adb_remote.py index 80fa6638aebd..219df3a556ca 100644 --- a/js/src/tests/lib/tasks_adb_remote.py +++ b/js/src/tests/lib/tasks_adb_remote.py @@ -105,18 +105,22 @@ def setup_device(prefix, options): try: device = init_device(options) + def replace_lib_file(path, name): + localfile = os.path.join(JS_TESTS_DIR, *path) + remotefile = posixpath.join(options.remote_test_root, "lib", name) + device.push(localfile, remotefile, timeout=10) + prefix[0] = posixpath.join(options.remote_test_root, "bin", "js") tempdir = posixpath.join(options.remote_test_root, "tmp") # Update the test root to point to our test directory. jit_tests_dir = posixpath.join(options.remote_test_root, "tests") - options.remote_test_root = posixpath.join(jit_tests_dir, "tests") - jtd_tests = posixpath.join(options.remote_test_root) init_remote_dir(device, jit_tests_dir) - device.push(JS_TESTS_DIR, jtd_tests, timeout=600) - device.chmod(jtd_tests, recursive=True) - device.push(os.path.dirname(TEST_DIR), options.remote_test_root, timeout=600) + # Substitute lib files which are aliasing non262 files. + replace_lib_file(["non262", "shell.js"], "non262.js") + replace_lib_file(["non262", "reflect-parse", "Match.js"], "match.js") + replace_lib_file(["non262", "Math", "shell.js"], "math.js") device.chmod(options.remote_test_root, recursive=True) print("tasks_adb_remote.py : Device initialization completed")