summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2022-02-09 16:50:44 +0000
committer Treehugger Robot <treehugger-gerrit@google.com> 2022-02-15 14:58:26 +0000
commitdd0a65de714b1673c802da170e6b61ed4f2afac0 (patch)
tree888e8116f66a69def2dfd62c1053c87944932c2c
parent7116f80c7caaebba8d45be72d28d44a8d8a6c632 (diff)
Allow more cross-referencing between run-test sources.
Allow all primary sources (src/, src-multidex/, src-aotex/, src-bcpex/, src-ex/) to reference each other and jasmin*/ classes. Allow all replacement sources (src-art/, src2/, src-ex2/) to reference the above classes. The src/ folder needs to exist for this to take place, so we moved src-art/ files to src/ in some tests. As we're now compiling more files together into the `-cp` folder "classes-tmp-all", classes defined in both src/ and src-ex/ would clash, so we moved the src-ex/ version into src-ex2/. Test: testrunner.py --host --optimizing --jvm Test: testrunner.py --target --optimizing Bug: 203171409 Change-Id: Ic890038b273f9ed7a99313f8d94323a2b612af43
-rwxr-xr-xtest/004-JniTest/build23
-rw-r--r--test/004-JniTest/src-aotex/dalvik/annotation/optimization/CriticalNative.java (renamed from test/004-JniTest/src/dalvik/annotation/optimization/CriticalNative.java)0
-rw-r--r--test/004-JniTest/src-aotex/dalvik/annotation/optimization/FastNative.java (renamed from test/004-JniTest/src/dalvik/annotation/optimization/FastNative.java)0
-rw-r--r--test/068-classloader/src-ex2/DoubledExtend.java (renamed from test/068-classloader/src-ex/DoubledExtend.java)0
-rw-r--r--test/068-classloader/src-ex2/DoubledExtendOkay.java (renamed from test/068-classloader/src-ex/DoubledExtendOkay.java)0
-rw-r--r--test/068-classloader/src-ex2/DoubledImplement.java (renamed from test/068-classloader/src-ex/DoubledImplement.java)0
-rw-r--r--test/068-classloader/src-ex2/DoubledImplement2.java (renamed from test/068-classloader/src-ex/DoubledImplement2.java)0
-rw-r--r--test/138-duplicate-classes-check2/src-ex2/A.java (renamed from test/138-duplicate-classes-check2/src-ex/A.java)0
-rw-r--r--test/142-classloader2/src-ex2/A.java (renamed from test/142-classloader2/src-ex/A.java)0
-rw-r--r--test/155-java-set-resolved-type/src-ex2/TestInterface.java (renamed from test/155-java-set-resolved-type/src-ex/TestInterface.java)0
-rw-r--r--test/612-jit-dex-cache/src-ex2/B.java (renamed from test/612-jit-dex-cache/src-ex/B.java)0
-rw-r--r--test/612-jit-dex-cache/src/A.java (renamed from test/612-jit-dex-cache/src-art/A.java)0
-rw-r--r--test/612-jit-dex-cache/src/B.java (renamed from test/612-jit-dex-cache/src-art/B.java)0
-rw-r--r--test/612-jit-dex-cache/src/Main.java (renamed from test/612-jit-dex-cache/src-art/Main.java)0
-rw-r--r--test/613-inlining-dex-cache/src-ex2/B.java (renamed from test/613-inlining-dex-cache/src-ex/B.java)0
-rw-r--r--test/613-inlining-dex-cache/src/B.java (renamed from test/613-inlining-dex-cache/src-art/B.java)0
-rw-r--r--test/613-inlining-dex-cache/src/Main.java (renamed from test/613-inlining-dex-cache/src-art/Main.java)0
-rw-r--r--test/676-resolve-field-type/src/Foo.java (renamed from test/676-resolve-field-type/src-art/Foo.java)0
-rw-r--r--test/676-resolve-field-type/src/Main.java (renamed from test/676-resolve-field-type/src-art/Main.java)0
-rwxr-xr-xtest/etc/default-build84
20 files changed, 45 insertions, 62 deletions
diff --git a/test/004-JniTest/build b/test/004-JniTest/build
index e2828f9ed4..460f2db5f8 100755
--- a/test/004-JniTest/build
+++ b/test/004-JniTest/build
@@ -17,29 +17,20 @@
#
# Perform a mostly normal build.
# Since this test imports 'dalvik.annotation.optimization.FastNative' (and CriticalNative),
-# we do a bit of trickery to allow the annotations to be used at javac-compile time,
-# but remove them afterwards so it doesn't end up in the dex file.
+# we put them to src-aotex/ to allow the annotations to be used at javac-compile time,
+# but remove compiled *-aotex* artifacts afterwards.
#
# This enables the test to compile with vanilla RI javac and work on either ART or RI.
+# TODO: The test is currently disabled for RI anyway, presumably because @CriticalNative
+# has a different ABI and cannot be tested on RI.
#
# Stop on failure.
set -e
-export ORIGINAL_JAVAC="$JAVAC"
-
-# Wrapper function for javac which invokes the compiler and applies
-# additional setup steps for the test.
-cat >javac_wrapper.sh <<"EOF"
- set -e # Stop on error - the caller script may not have this set.
- $ORIGINAL_JAVAC "$@"
- # Delete CriticalNative.java, FastNative.java annotations after building the .class files.
- find classes/dalvik -name '*.class' -exec rm {} \;
-EOF
-export JAVAC=./javac_wrapper.sh
-
-######################################################################
-
# Use release mode to check optimizations do not break JNI.
export D8_FLAGS=--release
./default-build "$@"
+
+# Remove the *-aotex build artifacts (but keep src-aotex) with dalvik.* annotations.
+rm -rf classes-aotex classes-aotex.jar $TEST_NAME-aotex.jar
diff --git a/test/004-JniTest/src/dalvik/annotation/optimization/CriticalNative.java b/test/004-JniTest/src-aotex/dalvik/annotation/optimization/CriticalNative.java
index 9c17337fb8..9c17337fb8 100644
--- a/test/004-JniTest/src/dalvik/annotation/optimization/CriticalNative.java
+++ b/test/004-JniTest/src-aotex/dalvik/annotation/optimization/CriticalNative.java
diff --git a/test/004-JniTest/src/dalvik/annotation/optimization/FastNative.java b/test/004-JniTest/src-aotex/dalvik/annotation/optimization/FastNative.java
index 3a8fbb0106..3a8fbb0106 100644
--- a/test/004-JniTest/src/dalvik/annotation/optimization/FastNative.java
+++ b/test/004-JniTest/src-aotex/dalvik/annotation/optimization/FastNative.java
diff --git a/test/068-classloader/src-ex/DoubledExtend.java b/test/068-classloader/src-ex2/DoubledExtend.java
index e99421b8cd..e99421b8cd 100644
--- a/test/068-classloader/src-ex/DoubledExtend.java
+++ b/test/068-classloader/src-ex2/DoubledExtend.java
diff --git a/test/068-classloader/src-ex/DoubledExtendOkay.java b/test/068-classloader/src-ex2/DoubledExtendOkay.java
index 9674875b74..9674875b74 100644
--- a/test/068-classloader/src-ex/DoubledExtendOkay.java
+++ b/test/068-classloader/src-ex2/DoubledExtendOkay.java
diff --git a/test/068-classloader/src-ex/DoubledImplement.java b/test/068-classloader/src-ex2/DoubledImplement.java
index bf3ebecbe3..bf3ebecbe3 100644
--- a/test/068-classloader/src-ex/DoubledImplement.java
+++ b/test/068-classloader/src-ex2/DoubledImplement.java
diff --git a/test/068-classloader/src-ex/DoubledImplement2.java b/test/068-classloader/src-ex2/DoubledImplement2.java
index 24ecb65241..24ecb65241 100644
--- a/test/068-classloader/src-ex/DoubledImplement2.java
+++ b/test/068-classloader/src-ex2/DoubledImplement2.java
diff --git a/test/138-duplicate-classes-check2/src-ex/A.java b/test/138-duplicate-classes-check2/src-ex2/A.java
index 8e52cb3a5d..8e52cb3a5d 100644
--- a/test/138-duplicate-classes-check2/src-ex/A.java
+++ b/test/138-duplicate-classes-check2/src-ex2/A.java
diff --git a/test/142-classloader2/src-ex/A.java b/test/142-classloader2/src-ex2/A.java
index d5fa1f9df7..d5fa1f9df7 100644
--- a/test/142-classloader2/src-ex/A.java
+++ b/test/142-classloader2/src-ex2/A.java
diff --git a/test/155-java-set-resolved-type/src-ex/TestInterface.java b/test/155-java-set-resolved-type/src-ex2/TestInterface.java
index 037c760765..037c760765 100644
--- a/test/155-java-set-resolved-type/src-ex/TestInterface.java
+++ b/test/155-java-set-resolved-type/src-ex2/TestInterface.java
diff --git a/test/612-jit-dex-cache/src-ex/B.java b/test/612-jit-dex-cache/src-ex2/B.java
index 4da9a1da6b..4da9a1da6b 100644
--- a/test/612-jit-dex-cache/src-ex/B.java
+++ b/test/612-jit-dex-cache/src-ex2/B.java
diff --git a/test/612-jit-dex-cache/src-art/A.java b/test/612-jit-dex-cache/src/A.java
index 415c712477..415c712477 100644
--- a/test/612-jit-dex-cache/src-art/A.java
+++ b/test/612-jit-dex-cache/src/A.java
diff --git a/test/612-jit-dex-cache/src-art/B.java b/test/612-jit-dex-cache/src/B.java
index 46c878b572..46c878b572 100644
--- a/test/612-jit-dex-cache/src-art/B.java
+++ b/test/612-jit-dex-cache/src/B.java
diff --git a/test/612-jit-dex-cache/src-art/Main.java b/test/612-jit-dex-cache/src/Main.java
index 89ebe09827..89ebe09827 100644
--- a/test/612-jit-dex-cache/src-art/Main.java
+++ b/test/612-jit-dex-cache/src/Main.java
diff --git a/test/613-inlining-dex-cache/src-ex/B.java b/test/613-inlining-dex-cache/src-ex2/B.java
index 4da9a1da6b..4da9a1da6b 100644
--- a/test/613-inlining-dex-cache/src-ex/B.java
+++ b/test/613-inlining-dex-cache/src-ex2/B.java
diff --git a/test/613-inlining-dex-cache/src-art/B.java b/test/613-inlining-dex-cache/src/B.java
index 6e7e55d430..6e7e55d430 100644
--- a/test/613-inlining-dex-cache/src-art/B.java
+++ b/test/613-inlining-dex-cache/src/B.java
diff --git a/test/613-inlining-dex-cache/src-art/Main.java b/test/613-inlining-dex-cache/src/Main.java
index 31ab1d2bfa..31ab1d2bfa 100644
--- a/test/613-inlining-dex-cache/src-art/Main.java
+++ b/test/613-inlining-dex-cache/src/Main.java
diff --git a/test/676-resolve-field-type/src-art/Foo.java b/test/676-resolve-field-type/src/Foo.java
index 3df74d3bc1..3df74d3bc1 100644
--- a/test/676-resolve-field-type/src-art/Foo.java
+++ b/test/676-resolve-field-type/src/Foo.java
diff --git a/test/676-resolve-field-type/src-art/Main.java b/test/676-resolve-field-type/src/Main.java
index c915df876f..c915df876f 100644
--- a/test/676-resolve-field-type/src-art/Main.java
+++ b/test/676-resolve-field-type/src/Main.java
diff --git a/test/etc/default-build b/test/etc/default-build
index 070293057e..c2c0b6a606 100755
--- a/test/etc/default-build
+++ b/test/etc/default-build
@@ -252,20 +252,39 @@ def has_multidex():
return HAS_SRC_MULTIDEX or HAS_JASMIN_MULTIDEX or HAS_SMALI_MULTIDEX
+def add_to_cp_args(old_cp_args, path):
+ if len(old_cp_args) == 0:
+ return ["-cp", path]
+ else:
+ return ["-cp", old_cp_args[1] + ":" + path]
+
+
src_tmp_all = []
-if HAS_SRC and (HAS_SRC_MULTIDEX or HAS_SRC_AOTEX or HAS_SRC_BCPEX):
- # To allow circular references, compile src/, src-multidex/, src-aotex/ and
- # src-bcpex/ together and pass the output as class path argument.
- # Replacement sources in src-art/ and src2 can replace symbols used by the
- # other src-* sources we compile here but everything needed to compile the
- # other src-* sources should be present in src/.
+
+if HAS_JASMIN:
+ make_jasmin("jasmin_classes", find("jasmin", "*.j"))
+ src_tmp_all = add_to_cp_args(src_tmp_all, "jasmin_classes")
+
+if HAS_JASMIN_MULTIDEX:
+ make_jasmin("jasmin_classes2", find("jasmin-multidex", "*.j"))
+ src_tmp_all = add_to_cp_args(src_tmp_all, "jasmin_classes2")
+
+if HAS_SRC and (HAS_SRC_MULTIDEX or HAS_SRC_AOTEX or HAS_SRC_BCPEX or
+ HAS_SRC_EX or HAS_SRC_ART or HAS_SRC2 or HAS_SRC_EX2):
+ # To allow circular references, compile src/, src-multidex/, src-aotex/,
+ # src-bcpex/, src-ex/ together and pass the output as class path argument.
+ # Replacement sources in src-art/, src2/ and src-ex2/ can replace symbols
+ # used by the other src-* sources we compile here but everything needed to
+ # compile the other src-* sources should be present in src/ (and jasmin*/).
os.makedirs("classes-tmp-all")
- javac_with_bootclasspath(["-implicit:none", "-d", "classes-tmp-all"] +
+ javac_with_bootclasspath(["-implicit:none"] + src_tmp_all +
+ ["-d", "classes-tmp-all"] +
find("src", "*.java") +
find("src-multidex", "*.java") +
find("src-aotex", "*.java") +
- find("src-bcpex", "*.java"))
- src_tmp_all = ["-cp", "classes-tmp-all"]
+ find("src-bcpex", "*.java") +
+ find("src-ex", "*.java"))
+ src_tmp_all = add_to_cp_args(src_tmp_all, "classes-tmp-all")
if HAS_SRC_AOTEX:
os.makedirs("classes-aotex")
@@ -309,7 +328,8 @@ if HAS_SRC_MULTIDEX:
if HAS_SRC2:
os.makedirs("classes", exist_ok=True)
- javac_with_bootclasspath(["-classpath", "classes", "-d", "classes"] +
+ javac_with_bootclasspath(["-implicit:none"] + src_tmp_all +
+ ["-d", "classes"] +
find("src2", "*.java"))
# If the classes directory is not-empty, package classes in a DEX file.
@@ -320,7 +340,6 @@ if find("classes", "*"):
if HAS_JASMIN:
# Compile Jasmin classes as if they were part of the classes.dex file.
- make_jasmin("jasmin_classes", find("jasmin", "*.j"))
if NEED_DEX:
make_dex("jasmin_classes")
make_dexmerge("classes.dex", "jasmin_classes.dex")
@@ -342,8 +361,6 @@ if HAS_SMALI and NEED_DEX:
# Compile Jasmin classes in jasmin-multidex as if they were part of
# the classes2.jar
if HAS_JASMIN_MULTIDEX:
- make_jasmin("jasmin_classes2", find("jasmin-multidex", "*.j"))
-
if NEED_DEX:
make_dex("jasmin_classes2")
make_dexmerge("classes2.dex", "jasmin_classes2.dex")
@@ -362,40 +379,15 @@ if HAS_SMALI_MULTIDEX and NEED_DEX:
# Merge smali_classes2.dex into classes2.dex
make_dexmerge("classes2.dex", "smali_classes2.dex")
-if HAS_SRC_EX or HAS_SRC_EX2:
- # Build src-ex into classes-ex.
- # Includes 'src', 'src-art' and 'jasmin' source when compiling classes-ex,
- # but exclude their .class files.
- src_tmp_for_ex = []
- if HAS_SRC or HAS_SRC_ART or HAS_JASMIN:
- os.makedirs("classes-tmp-for-ex", exist_ok=True)
- src_tmp_for_ex = ["-cp", "classes-tmp-for-ex"]
- if HAS_SRC and HAS_SRC_MULTIDEX:
- javac_with_bootclasspath(["-d", "classes-tmp-for-ex"] +
- find("src", "*.java") +
- find("src-multidex", "*.java"))
- elif HAS_SRC:
- javac_with_bootclasspath(["-d", "classes-tmp-for-ex"] +
- find("src", "*.java"))
- elif HAS_SRC_MULTIDEX:
- javac_with_bootclasspath(["-d", "classes-tmp-for-ex"] +
- find("src-multidex", "*.java"))
- if HAS_SRC_ART:
- javac_with_bootclasspath(["-d", "classes-tmp-for-ex"] +
- find("src-art", "*.java"))
- if HAS_JASMIN:
- make_jasmin("classes-tmp-for-ex", find("jasmin", "*.j"))
+if HAS_SRC_EX:
os.makedirs("classes-ex", exist_ok=True)
- if HAS_SRC_EX:
- javac_with_bootclasspath(["-d", "classes-ex"] + src_tmp_for_ex +
- find("src-ex", "*.java"))
- if not src_tmp_for_ex:
- src_tmp_for_ex = ["-cp", "classes-ex"]
- else:
- src_tmp_for_ex[-1] += ":classes-ex"
- if HAS_SRC_EX2:
- javac_with_bootclasspath(["-d", "classes-ex"] + src_tmp_for_ex +
- find("src-ex2", "*.java"))
+ javac_with_bootclasspath(["-implicit:none"] + src_tmp_all +
+ ["-d", "classes-ex"] + find("src-ex", "*.java"))
+
+if HAS_SRC_EX2:
+ os.makedirs("classes-ex", exist_ok=True)
+ javac_with_bootclasspath(["-implicit:none"] + src_tmp_all +
+ ["-d", "classes-ex"] + find("src-ex2", "*.java"))
if path.exists("classes-ex") and NEED_DEX:
make_dex("classes-ex")