summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author David Srbecky <dsrbecky@google.com> 2024-10-17 23:44:24 +0100
committer David Srbecky <dsrbecky@google.com> 2024-10-18 14:08:51 +0000
commit9e9f0bcd84ace54d313c3bcc039b8b576bda850d (patch)
tree60949dd66c37efd3ffa05583faf6a1e382887505
parente7fffca5a424b368b44a6c84e6003be3524f2088 (diff)
Run-test: Add option to save runner script for debugging
This is useful for testing other refactoring/clean-up CLs. As long as the generated runner scripts are exactly identical, there is high confidence that the CL has no breaking changes. Test: "./art/test.py -r -j256" and save runners in git direcotry Change-Id: Ia20d02bfcefcfa440f3b6af4c356ca78e2c66c87
-rwxr-xr-xtest/run-test14
-rwxr-xr-xtest/testrunner/testrunner.py4
2 files changed, 14 insertions, 4 deletions
diff --git a/test/run-test b/test/run-test
index 870649a0d7..6dc4b8ba80 100755
--- a/test/run-test
+++ b/test/run-test
@@ -15,6 +15,7 @@
# limitations under the License.
import os, sys, glob, re, shutil, subprocess, shlex, resource, atexit
+import urllib.parse
import default_run as default_run_module
@@ -897,6 +898,19 @@ if True:
print(f"{test_dir}: Create runner script...")
runner = create_runner_script()
+ # Script debugging feature - just export the runner script into a directory,
+ # so that it can be compared before/after runner script refactoring.
+ save_runner_dir = os.environ.get("RUN_TEST_DEBUG__SAVE_RUNNER_DIR")
+ if save_runner_dir:
+ name = urllib.parse.quote(" ".join(sys.argv[1:]), safe=' ')
+ dst = Path(save_runner_dir) / TEST_NAME / name
+ os.makedirs(dst.parent, exist_ok=True)
+ txt = runner.read_text()
+ txt = txt.replace(Path(tmp_dir).name, "${TMP_DIR}") # Make it deterministic.
+ txt = re.sub('\[run-test:\d+\]', '[run-test:(line-number)]', txt)
+ dst.write_text(txt)
+ sys.exit(0)
+
print(f"{test_dir}: Run...")
if target_mode == "yes":
# Prepare the on-device test directory
diff --git a/test/testrunner/testrunner.py b/test/testrunner/testrunner.py
index c92f18369b..7971b2ed8b 100755
--- a/test/testrunner/testrunner.py
+++ b/test/testrunner/testrunner.py
@@ -568,10 +568,6 @@ def run_tests(tests):
if address_size == '64':
args_test += ['--64']
- # b/36039166: Note that the path lengths must kept reasonably short.
- temp_path = tempfile.mkdtemp(dir=env.ART_HOST_TEST_DIR)
- args_test = ['--temp-path', temp_path] + args_test
-
# Run the run-test script using the prebuilt python.
python3_bin = env.ANDROID_BUILD_TOP + "/prebuilts/build-tools/path/linux-x86/python3"
run_test_sh = env.ANDROID_BUILD_TOP + '/art/test/run-test'