summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author David Srbecky <dsrbecky@google.com> 2025-03-19 15:21:10 +0000
committer David Srbecky <dsrbecky@google.com> 2025-03-20 07:31:29 -0700
commit8badd481972993739e7711258f03a44638ca87a5 (patch)
tree2eaaab32b255ddc6d569cf3e255eb1acae79f9b8
parentaa42bf962cdd12abac143a26a8590f563910f7b6 (diff)
Run-test: Remove intermediate files from the build output.
This removes 90%+ of files in the data for run-tests, which is needed to build but not to execute the tests. (original source code and java-bytecode class files) Trade-fed has its own implementation of 'adb push', which is very slow, so the extra files considerably slowed everything down. Test: ./art/test.py -r --jvm --host --target --optimizing --64 Change-Id: Ie4da1b9c9e94f0d265fdb384948a073593983ac5
-rw-r--r--test/674-hiddenapi/build.py2
-rw-r--r--test/817-hiddenapi/build.py2
-rwxr-xr-xtest/default_run.py2
-rwxr-xr-xtest/run-test2
-rwxr-xr-xtest/run_test_build.py12
5 files changed, 15 insertions, 5 deletions
diff --git a/test/674-hiddenapi/build.py b/test/674-hiddenapi/build.py
index c3ebb50de5..24ad35b3c5 100644
--- a/test/674-hiddenapi/build.py
+++ b/test/674-hiddenapi/build.py
@@ -26,7 +26,7 @@ import os
def build(ctx):
if ctx.jvm:
return # The test does not build on JVM
- ctx.default_build(use_hiddenapi=True)
+ ctx.default_build(use_hiddenapi=True, delete_srcs=False)
# Move the jar file into the resource folder to be bundled with the test.
os.mkdir(ctx.test_dir / "res")
diff --git a/test/817-hiddenapi/build.py b/test/817-hiddenapi/build.py
index 37b8cd5bb7..e08a351d99 100644
--- a/test/817-hiddenapi/build.py
+++ b/test/817-hiddenapi/build.py
@@ -27,7 +27,7 @@ def build(ctx):
# hidden API access flags in dex files. DexFileVerifier is not invoked on boot
# class path dex files, so the boot jar loads fine in the latter case.
- ctx.default_build(use_hiddenapi=True)
+ ctx.default_build(use_hiddenapi=True, delete_srcs=False)
# Move the jar file into the resource folder to be bundled with the test.
os.mkdir(ctx.test_dir / "res")
diff --git a/test/default_run.py b/test/default_run.py
index 86e4996ca1..85cf4a97ad 100755
--- a/test/default_run.py
+++ b/test/default_run.py
@@ -924,7 +924,7 @@ def default_run(ctx, args, **kwargs):
args = []
for arg in cmdline.split(" "):
if arg == "--class-loader-context=&":
- arg = "--class-loader-context=\&"
+ arg = r"--class-loader-context=\&"
args.append(arg)
return " ".join(args)
diff --git a/test/run-test b/test/run-test
index 1117e07a10..8cca59fddf 100755
--- a/test/run-test
+++ b/test/run-test
@@ -908,7 +908,7 @@ if True:
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)
+ txt = re.sub(r'\[run-test:\d+\]', '[run-test:(line-number)]', txt)
dst.write_text(txt)
if args.create_runner or save_runner_dir:
diff --git a/test/run_test_build.py b/test/run_test_build.py
index 464b36180e..3b6ac73a33 100755
--- a/test/run_test_build.py
+++ b/test/run_test_build.py
@@ -253,7 +253,8 @@ class BuildTestContext:
use_smali=True,
use_jasmin=True,
javac_source_arg="1.8",
- javac_target_arg="1.8"
+ javac_target_arg="1.8",
+ delete_srcs=True,
):
javac_classpath = javac_classpath.copy() # Do not modify default value.
@@ -505,6 +506,15 @@ class BuildTestContext:
else:
make_hiddenapi(Path("classes.dex"))
+ # Clean up intermediate files.
+ if self.target or self.host:
+ for f in self.test_dir.glob("**/*.class"):
+ f.unlink()
+ if delete_srcs and "-checker-" not in self.test_name:
+ for ext in ["java", "smali", "j"]:
+ for f in self.test_dir.glob(f"**/*.{ext}"):
+ f.unlink()
+
# Create a single dex jar with two dex files for multidex.
if need_dex:
if Path("classes2.dex").exists():