summaryrefslogtreecommitdiff
path: root/runtime/jni/java_vm_ext.cc
diff options
context:
space:
mode:
author Roland Levillain <rpl@google.com> 2021-10-01 19:25:44 +0100
committer Roland Levillain <rpl@google.com> 2021-11-23 09:23:59 +0000
commit0a74d278eb84dae4935b24d72669341542272d2b (patch)
treeb834369813f0ec89d7626808941b949268141a20 /runtime/jni/java_vm_ext.cc
parent4b8ea5dc732ab16eb0d8c878aa284f4d74c74a03 (diff)
Add a "broken test ART APEX" Soong module.
Introduce test APEX module `test_broken_com.android.art`, to be used in a test exercising ART Mainline Module rollbacks. Instead of the regular `libart` module, this test APEX includes a `libart-broken` module, a "broken" version of `libart` which delibaretely crashes during the creation of a new VM (in `JNI_CreateJavaVM`), thus trigerring a rollback of this test APEX. Test: m test_broken_com.android.art Bug: 204887479 Change-Id: I5ab50dffcf517e05c7008a881cde89c6ae0a12ca
Diffstat (limited to 'runtime/jni/java_vm_ext.cc')
-rw-r--r--runtime/jni/java_vm_ext.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/runtime/jni/java_vm_ext.cc b/runtime/jni/java_vm_ext.cc
index e6e341a4e1..053afc96e3 100644
--- a/runtime/jni/java_vm_ext.cc
+++ b/runtime/jni/java_vm_ext.cc
@@ -1229,6 +1229,13 @@ extern "C" jint JNI_CreateJavaVM(JavaVM** p_vm, JNIEnv** p_env, void* vm_args) {
return JNI_ERR;
}
+ // When `ART_CRASH_RUNTIME_DELIBERATELY` is defined (which happens only in the
+ // case of a test APEX), we crash the runtime here on purpose, to test the
+ // behavior of rollbacks following a failed ART Mainline Module update.
+#ifdef ART_CRASH_RUNTIME_DELIBERATELY
+ LOG(FATAL) << "Runtime crashing deliberately for testing purposes.";
+#endif
+
// Initialize native loader. This step makes sure we have
// everything set up before we start using JNI.
android::InitializeNativeLoader();