summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Martin Stjernholm <mast@google.com> 2025-01-20 22:37:37 +0000
committer Martin Stjernholm <mast@google.com> 2025-01-28 00:46:55 -0800
commitdaacc31423f8bcece99953d23661f0bffc91011f (patch)
treeff9ec0200ebdb0b06e5864d65822654eb7a455fe
parent920c10a2a8d69bedbc044bcbe2b69970479e3f18 (diff)
Use libarttest(d)_external to fix 656-annotation-lookup-generic-jni,
and enable it on target again. Test: art/test/testrunner/testrunner.py --target --64 656 in armv8 target chroot Test: art/test/testrunner/testrunner.py --host 656 Bug: 186654484 Change-Id: I4cd3dde548aa30afe46c249bc79e36aa952a4aae
-rw-r--r--test/656-annotation-lookup-generic-jni/expected-stdout.txt2
-rw-r--r--test/656-annotation-lookup-generic-jni/run.py1
-rw-r--r--test/656-annotation-lookup-generic-jni/src-art/Main.java2
-rw-r--r--test/656-annotation-lookup-generic-jni/test.cc5
-rw-r--r--test/knownfailures.json3
5 files changed, 9 insertions, 4 deletions
diff --git a/test/656-annotation-lookup-generic-jni/expected-stdout.txt b/test/656-annotation-lookup-generic-jni/expected-stdout.txt
index 4519c7e442..1ba8aa29bc 100644
--- a/test/656-annotation-lookup-generic-jni/expected-stdout.txt
+++ b/test/656-annotation-lookup-generic-jni/expected-stdout.txt
@@ -1,3 +1,3 @@
-JNI_OnLoad called
+JNI_OnLoad in libarttest_external.cc called
Java_Test_nativeMethodWithAnnotation
passed
diff --git a/test/656-annotation-lookup-generic-jni/run.py b/test/656-annotation-lookup-generic-jni/run.py
index 0ebb768cc9..d555938083 100644
--- a/test/656-annotation-lookup-generic-jni/run.py
+++ b/test/656-annotation-lookup-generic-jni/run.py
@@ -16,6 +16,7 @@
def run(ctx, args):
+ args.testlib += [args.testlib[0] + "_external"]
ctx.default_run(args)
# On gcstress configurations, an extra "JNI_OnUnload called" line may
diff --git a/test/656-annotation-lookup-generic-jni/src-art/Main.java b/test/656-annotation-lookup-generic-jni/src-art/Main.java
index ed375064f1..ed1aab97e1 100644
--- a/test/656-annotation-lookup-generic-jni/src-art/Main.java
+++ b/test/656-annotation-lookup-generic-jni/src-art/Main.java
@@ -42,7 +42,7 @@ public class Main {
// Load and initialize the Test class.
Class<?> testClass = classLoader.loadClass("Test");
Method initialize = testClass.getMethod("initialize", String.class);
- initialize.invoke(null, args[0]);
+ initialize.invoke(null, args[1]);
// Invoke Test.nativeMethodWithAnnotation().
Method nativeMethodWithAnnotation = testClass.getMethod("nativeMethodWithAnnotation");
diff --git a/test/656-annotation-lookup-generic-jni/test.cc b/test/656-annotation-lookup-generic-jni/test.cc
index 172e04669f..26d9f9678e 100644
--- a/test/656-annotation-lookup-generic-jni/test.cc
+++ b/test/656-annotation-lookup-generic-jni/test.cc
@@ -20,6 +20,11 @@
namespace art {
+// The JNI entrypoint below ends up in libarttest(d).so, while the test loads
+// libarttest(d)_external.so instead. That lib depends on libarttest(d).so, so
+// its exported symbols become visible directly in it. Hence we don't need to
+// create a wrapper for the JNI method in libarttest(d)_external.so.
+
// Native method annotated with `SampleAnnotation` in Java source.
extern "C" JNIEXPORT void JNICALL Java_Test_nativeMethodWithAnnotation(JNIEnv*, jclass) {
std::cout << "Java_Test_nativeMethodWithAnnotation" << std::endl;
diff --git a/test/knownfailures.json b/test/knownfailures.json
index ccf62a0775..33a4548d7a 100644
--- a/test/knownfailures.json
+++ b/test/knownfailures.json
@@ -1441,8 +1441,7 @@
"description": ["Uses the low-ram flag which does not work with CMS"]
},
{
- "tests": ["656-annotation-lookup-generic-jni",
- "900-hello-plugin"],
+ "tests": ["900-hello-plugin"],
"variant": "target",
"bug": "b/186654484",
"description": ["Disabled after the switch to avoid allow_all_shared_libs from the ART namespace to system."]