summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtest/003-omnibus-opcodes/javac_post.sh (renamed from test/003-omnibus-opcodes/javac_wrapper.sh)1
-rwxr-xr-xtest/004-ReferenceMap/javac_post.sh (renamed from test/004-ReferenceMap/javac_wrapper.sh)0
-rwxr-xr-xtest/004-StackWalk/javac_post.sh (renamed from test/004-StackWalk/javac_wrapper.sh)0
-rwxr-xr-xtest/005-annotations/javac_post.sh (renamed from test/005-annotations/javac_wrapper.sh)2
-rwxr-xr-xtest/091-override-package-private-method/javac_post.sh (renamed from test/091-override-package-private-method/javac_wrapper.sh)2
-rwxr-xr-xtest/111-unresolvable-exception/javac_post.sh (renamed from test/111-unresolvable-exception/javac_wrapper.sh)2
-rwxr-xr-xtest/124-missing-classes/javac_post.sh (renamed from test/124-missing-classes/javac_wrapper.sh)5
-rwxr-xr-xtest/126-miranda-multidex/generate-sources1
-rwxr-xr-xtest/126-miranda-multidex/javac_post.sh21
-rwxr-xr-xtest/126-miranda-multidex/javac_wrapper.sh28
-rwxr-xr-xtest/127-checker-secondarydex/javac_post.sh (renamed from test/127-checker-secondarydex/javac_wrapper.sh)2
-rwxr-xr-xtest/138-duplicate-classes-check2/javac_post.sh (renamed from test/138-duplicate-classes-check2/javac_wrapper.sh)2
-rwxr-xr-xtest/829-unresolved-enclosing/javac_post.sh (renamed from test/829-unresolved-enclosing/javac_wrapper.sh)2
-rw-r--r--test/952-invoke-custom/build.py4
-rwxr-xr-xtest/952-invoke-custom/javac_post.sh (renamed from test/952-invoke-custom/javac_wrapper.sh)19
-rwxr-xr-xtest/979-const-method-handle/generate-sources3
-rwxr-xr-xtest/979-const-method-handle/javac_post.sh (renamed from test/979-const-method-handle/javac_wrapper.sh)6
-rwxr-xr-xtest/run_test_build.py33
18 files changed, 48 insertions, 85 deletions
diff --git a/test/003-omnibus-opcodes/javac_wrapper.sh b/test/003-omnibus-opcodes/javac_post.sh
index 62e94f8fef..6065423231 100755
--- a/test/003-omnibus-opcodes/javac_wrapper.sh
+++ b/test/003-omnibus-opcodes/javac_post.sh
@@ -16,5 +16,4 @@
set -e # Stop on error - the caller script may not have this set.
-$JAVAC "$@"
rm -f classes/UnresClass.class
diff --git a/test/004-ReferenceMap/javac_wrapper.sh b/test/004-ReferenceMap/javac_post.sh
index bb5b349240..bb5b349240 100755
--- a/test/004-ReferenceMap/javac_wrapper.sh
+++ b/test/004-ReferenceMap/javac_post.sh
diff --git a/test/004-StackWalk/javac_wrapper.sh b/test/004-StackWalk/javac_post.sh
index 603ce39d7b..603ce39d7b 100755
--- a/test/004-StackWalk/javac_wrapper.sh
+++ b/test/004-StackWalk/javac_post.sh
diff --git a/test/005-annotations/javac_wrapper.sh b/test/005-annotations/javac_post.sh
index 69e616181a..abec8b015c 100755
--- a/test/005-annotations/javac_wrapper.sh
+++ b/test/005-annotations/javac_post.sh
@@ -16,8 +16,6 @@
set -e # Stop on error - the caller script may not have this set.
-$JAVAC "$@"
-
# Classes available at compile time, but not at runtime.
rm -f classes/android/test/anno/MissingAnnotation.class
rm -f 'classes/android/test/anno/ClassWithInnerAnnotationClass$MissingInnerAnnotationClass.class'
diff --git a/test/091-override-package-private-method/javac_wrapper.sh b/test/091-override-package-private-method/javac_post.sh
index 0e2b2e1d88..d2dd7e69c2 100755
--- a/test/091-override-package-private-method/javac_wrapper.sh
+++ b/test/091-override-package-private-method/javac_post.sh
@@ -15,6 +15,6 @@
# limitations under the License.
set -e # Stop on error - the caller script may not have this set.
-$JAVAC "$@"
+
mkdir -p classes-ex
mv classes/OverridePackagePrivateMethodSuper.class classes-ex
diff --git a/test/111-unresolvable-exception/javac_wrapper.sh b/test/111-unresolvable-exception/javac_post.sh
index 9e4d2a20ee..355f792f03 100755
--- a/test/111-unresolvable-exception/javac_wrapper.sh
+++ b/test/111-unresolvable-exception/javac_post.sh
@@ -16,7 +16,5 @@
set -e # Stop on error - the caller script may not have this set.
-$JAVAC "$@"
-
# Remove class available at compile time but not at run time.
rm classes/TestException.class
diff --git a/test/124-missing-classes/javac_wrapper.sh b/test/124-missing-classes/javac_post.sh
index c6c234d980..39e26bbc6e 100755
--- a/test/124-missing-classes/javac_wrapper.sh
+++ b/test/124-missing-classes/javac_post.sh
@@ -16,8 +16,5 @@
set -e # Stop on error - the caller script may not have this set.
-# Some classes are available at compile time...
-$JAVAC "$@"
-
-# ...but not at run time.
+# Some classes are available at compile time but not at run time.
rm 'classes/MissingClass.class' 'classes/Main$MissingInnerClass.class'
diff --git a/test/126-miranda-multidex/generate-sources b/test/126-miranda-multidex/generate-sources
index b35d5ef1c1..f42ba10a2a 100755
--- a/test/126-miranda-multidex/generate-sources
+++ b/test/126-miranda-multidex/generate-sources
@@ -19,3 +19,4 @@ set -e
# Signal to default-build that this is a multidex test.
mkdir src-multidex
+touch src-multidex/Empty.java
diff --git a/test/126-miranda-multidex/javac_post.sh b/test/126-miranda-multidex/javac_post.sh
new file mode 100755
index 0000000000..79a9cefd0a
--- /dev/null
+++ b/test/126-miranda-multidex/javac_post.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+#
+# Copyright (C) 2022 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -e # Stop on error - the caller script may not have this set.
+
+if [[ "$1" == "classes2" ]]; then
+ mv classes/MirandaInterface.class classes2
+fi
diff --git a/test/126-miranda-multidex/javac_wrapper.sh b/test/126-miranda-multidex/javac_wrapper.sh
deleted file mode 100755
index 71cafa1957..0000000000
--- a/test/126-miranda-multidex/javac_wrapper.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2022 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-set -e # Stop on error - the caller script may not have this set.
-
-if [[ "$*" != *"classes2"* ]]; then
- # First invocation: compile src/ files.
- $JAVAC "$@"
-else
- # Second invocation: move MirandaInterface.class for placement in
- # a secondary dex file. There are no other source files for the
- # secondary DEX so no compilation required.
- mv classes/MirandaInterface.class classes2
-fi
-exit $?
diff --git a/test/127-checker-secondarydex/javac_wrapper.sh b/test/127-checker-secondarydex/javac_post.sh
index 7fe6a557b1..e9d5d18377 100755
--- a/test/127-checker-secondarydex/javac_wrapper.sh
+++ b/test/127-checker-secondarydex/javac_post.sh
@@ -16,7 +16,5 @@
set -e # Stop on error - the caller script may not have this set.
-$JAVAC "$@"
-
mkdir classes-ex
mv classes/Super.class classes-ex
diff --git a/test/138-duplicate-classes-check2/javac_wrapper.sh b/test/138-duplicate-classes-check2/javac_post.sh
index 68c352fe51..ce8b82f925 100755
--- a/test/138-duplicate-classes-check2/javac_wrapper.sh
+++ b/test/138-duplicate-classes-check2/javac_post.sh
@@ -16,7 +16,5 @@
set -e # Stop on error - the caller script may not have this set.
-$JAVAC "$@"
-
# Remove one A.class from classes-ex
rm -f classes-ex/A.class
diff --git a/test/829-unresolved-enclosing/javac_wrapper.sh b/test/829-unresolved-enclosing/javac_post.sh
index e3dc1e3a23..93875d446d 100755
--- a/test/829-unresolved-enclosing/javac_wrapper.sh
+++ b/test/829-unresolved-enclosing/javac_post.sh
@@ -16,7 +16,5 @@
set -e # Stop on error - the caller script may not have this set.
-$JAVAC "$@"
-
# Remove class available at compile time but not at run time.
rm classes/MissingSuperClass.class
diff --git a/test/952-invoke-custom/build.py b/test/952-invoke-custom/build.py
index c640b9e3da..166d3a8e23 100644
--- a/test/952-invoke-custom/build.py
+++ b/test/952-invoke-custom/build.py
@@ -16,4 +16,6 @@
def build(ctx):
ctx.bash("./generate-sources")
- ctx.default_build(use_desugar=False, api_level=28)
+ ctx.default_build(use_desugar=False,
+ api_level=28,
+ javac_classpath=[ctx.test_dir / "transformer.jar"])
diff --git a/test/952-invoke-custom/javac_wrapper.sh b/test/952-invoke-custom/javac_post.sh
index c8e0716b5d..be5d8cfda3 100755
--- a/test/952-invoke-custom/javac_wrapper.sh
+++ b/test/952-invoke-custom/javac_post.sh
@@ -18,25 +18,6 @@ set -e # Stop on error - the caller script may not have this set.
export ASM_JAR="${ANDROID_BUILD_TOP}/prebuilts/misc/common/asm/asm-9.2.jar"
-# Update arguments to add transformer and ASM to the compiler classpath.
-classpath="./transformer.jar:$ASM_JAR"
-args=(-cp $classpath)
-while [ $# -ne 0 ] ; do
- case $1 in
- -cp|-classpath|--class-path)
- shift
- shift
- ;;
- *)
- args+=("$1")
- shift
- ;;
- esac
-done
-
-# Compile.
-$JAVAC "${args[@]}"
-
# Move original classes to intermediate location.
mv classes intermediate-classes
mkdir classes
diff --git a/test/979-const-method-handle/generate-sources b/test/979-const-method-handle/generate-sources
index d102d73c38..0cd94d1fd7 100755
--- a/test/979-const-method-handle/generate-sources
+++ b/test/979-const-method-handle/generate-sources
@@ -24,3 +24,6 @@ mkdir classes
${JAVAC:-javac} ${JAVAC_ARGS} -cp "${ASM_JAR}" -d classes $(find util-src -name '*.java')
${SOONG_ZIP} --jar -o transformer.jar -C classes -D classes
rm -rf classes
+
+# Add annotation src files to our compiler inputs.
+cp -r util-src/annotations src/
diff --git a/test/979-const-method-handle/javac_wrapper.sh b/test/979-const-method-handle/javac_post.sh
index 5ed848150b..1be31d5b8e 100755
--- a/test/979-const-method-handle/javac_wrapper.sh
+++ b/test/979-const-method-handle/javac_post.sh
@@ -18,12 +18,6 @@ set -e
export ASM_JAR="${ANDROID_BUILD_TOP}/prebuilts/misc/common/asm/asm-9.2.jar"
-# Add annotation src files to our compiler inputs.
-asrcs=util-src/annotations/*.java
-
-# Compile.
-$JAVAC "$@" $asrcs
-
# Move original classes to intermediate location.
mv classes intermediate-classes
mkdir classes
diff --git a/test/run_test_build.py b/test/run_test_build.py
index 13458dd739..6c3a21291b 100755
--- a/test/run_test_build.py
+++ b/test/run_test_build.py
@@ -48,6 +48,11 @@ USE_RBE = 100 # Percentage of tests that can use RBE (between 0 and 100)
lock_file = None # Keep alive as long as this process is alive.
+RBE_D8_DISABLED_FOR = {
+ "089-many-methods", # D8 compilation intentionally fails.
+ "952-invoke-custom", # b/228312861: RBE uses wrong inputs.
+ "979-const-method-handle", # b/228312861: RBE uses wrong inputs.
+}
class BuildTestContext:
def __init__(self, args, android_build_top, test_dir):
@@ -80,7 +85,8 @@ class BuildTestContext:
if "RBE_server_address" in os.environ and USE_RBE > (hash(self.test_name) % 100):
self.rbe_exec_root = os.environ.get("RBE_exec_root")
self.rbe_rewrapper = self.android_build_top / "prebuilts/remoteexecution-client/live/rewrapper"
- self.d8 = functools.partial(self.rbe_d8, args.d8.absolute())
+ if self.test_name not in RBE_D8_DISABLED_FOR:
+ self.d8 = functools.partial(self.rbe_d8, args.d8.absolute())
self.javac = functools.partial(self.rbe_javac, self.javac_path)
self.smali = functools.partial(self.rbe_smali, args.smali.absolute())
@@ -106,7 +112,7 @@ class BuildTestContext:
env=self.bash_env,
check=True)
- def run(self, executable: pathlib.Path, args: List[str]):
+ def run(self, executable: pathlib.Path, args: List[Union[pathlib.Path, str]]):
assert isinstance(executable, pathlib.Path), executable
cmd: List[Union[pathlib.Path, str]] = []
if executable.suffix == ".sh":
@@ -191,11 +197,13 @@ class BuildTestContext:
zip_align_bytes=None,
api_level:Union[int, str]=26, # Can also be named alias (string).
javac_args=[],
+ javac_classpath: List[Path]=[],
d8_flags=[],
smali_args=[],
use_smali=True,
use_jasmin=True,
):
+ javac_classpath = javac_classpath.copy() # Do not modify default value.
# Wrap "pathlib.Path" with our own version that ensures all paths are absolute.
# Plain filenames are assumed to be relative to self.test_dir and made absolute.
@@ -222,11 +230,6 @@ class BuildTestContext:
api_level = API_LEVEL[api_level]
assert isinstance(api_level, int), api_level
- # If wrapper script exists, use it instead of the default javac.
- javac_wrapper = Path("javac_wrapper.sh")
- if javac_wrapper.exists():
- self.javac = functools.partial(self.run, javac_wrapper)
-
def zip(zip_target: Path, *files: Path):
zip_args = ["-o", zip_target, "-C", zip_target.parent]
if zip_compression_method == "store":
@@ -258,9 +261,6 @@ class BuildTestContext:
["--output", dst_dex] + sorted(src_dir.glob("**/*.smali")))
return dst_dex
-
- java_classpath: List[Path] = []
-
def make_java(dst_dir: Path, *src_dirs: Path) -> Optional[Path]:
if not any(src_dir.exists() for src_dir in src_dirs):
return None # No sources to compile.
@@ -269,11 +269,14 @@ class BuildTestContext:
args += ["-implicit:none", "-encoding", "utf8", "-d", dst_dir]
if not self.jvm:
args += ["-bootclasspath", self.bootclasspath]
- if java_classpath:
- args += ["-classpath", java_classpath]
+ if javac_classpath:
+ args += ["-classpath", javac_classpath]
for src_dir in src_dirs:
args += sorted(src_dir.glob("**/*.java"))
self.javac(args)
+ javac_post = Path("javac_post.sh")
+ if javac_post.exists():
+ self.run(javac_post, [dst_dir])
return dst_dir
@@ -332,10 +335,10 @@ class BuildTestContext:
return
if make_jasmin(Path("jasmin_classes"), Path("jasmin")):
- java_classpath.append(Path("jasmin_classes"))
+ javac_classpath.append(Path("jasmin_classes"))
if make_jasmin(Path("jasmin_classes2"), Path("jasmin-multidex")):
- java_classpath.append(Path("jasmin_classes2"))
+ javac_classpath.append(Path("jasmin_classes2"))
# To allow circular references, compile src/, src-multidex/, src-aotex/,
# src-bcpex/, src-ex/ together and pass the output as class path argument.
@@ -347,7 +350,7 @@ class BuildTestContext:
if (Path("src").exists() and
any(Path(p).exists() for p in extra_srcs + replacement_srcs)):
make_java(Path("classes-tmp-all"), Path("src"), *map(Path, extra_srcs))
- java_classpath.append(Path("classes-tmp-all"))
+ javac_classpath.append(Path("classes-tmp-all"))
if make_java(Path("classes-aotex"), Path("src-aotex")) and need_dex:
make_dex(Path("classes-aotex"))