Repository navigation
tests: Modernize Android and HotSpot JVM test infrastructure - #423
Open
mnalmahmud wants to merge 6 commits into
Open
mnalmahmud wants to merge 6 commits into
mnalmahmud wants to merge 6 commits into
Conversation
Drop unused Method::jmethod_id symbol entries that are absent in Temurin JDK 8 builds. Check the optional UseCompiler flag before invoking code cache sweeps so reverting methods under -Xint does not hang waiting on a sweeper thread that HotSpot never starts. On JDK 8 (which lacks NMethodSweeper::force_sweep()), look up the optional NMethodSweeper::_sweep_started flag and claim it inside a safepoint instead of checking _should_sweep == 0. In OpenJDK 8, _should_sweep stays set to 1 while compiler threads are idle, so checking _should_sweep skipped sweep_code_cache() indefinitely. Also use Int64.add() and Int64.compare() when tracking traversal counts.
Parse Frida script JSON messages in runner.c using json-glib (already linked via libfrida-gumjs.a) instead of org.json in Script.java, and fail fast with an explicit IllegalStateException on script message timeout. This ensures uniform payload serialization across Android and HotSpot JVM (matching string, boolean, number, array, object, and null values) without depending on Android's built-in org.json implementation.
Bring the Android test runner, Makefiles, and GitHub Actions workflow up to date for modern Android API levels and improve reliability: - Clamp APP_PLATFORM in test/Application.mk to the NDK's maximum supported API level from meta/platforms.json and handle major.minor API levels across test/Application.mk and test/Makefile for platform paths, sysroot, and d8 --min-api. - Implement multi-handler sigchain support in test/runner.c so ART's implicit null-check and stack-overflow fault handlers are dispatched and chained properly to any previous signal handler. - Expand the CI matrix to API levels 26-36 with fail-fast disabled, auto-detect the latest installed build-tools directory, remove the stale x86 exclusion, and cache downloaded test dependencies. - Rebuild build/frida-java-bridge.js whenever bridge sources change, deploy once in `make check` using `adb push --sync` with an explicit libartpalette.so prerequisite, use atomic `curl -fsSL` downloads (with Maven Central for hamcrest-core), pass `-o` to `unzip`, fix watch quoting and LD_PRELOAD, dump scoped crash/warning logcat since the test start timestamp on failure, and allow filtering test classes via TestRunner args.
Install a 64-bit Linux GumMemoryHooks allocator in test/runner.c that probes a 64 MiB window before mapping Stalker slabs, working around gum_data_slab_new() NULL dereferences on Android API 35-36 (frida/frida-gum#793). Also call Stalker.unfollow() before send() in MethodTest.callCanBeTraced() so teardown is not traced into extra slabs.
Run the test suite on HotSpot JVM in addition to Android ART across supported LTS releases (JDK 8, 11, and 17): - Extend test/runner.c to launch HotSpot via JNI_CreateJavaVM on non-Android platforms, guarding Android-only sigchain and AttachCurrentThread differences with #ifdef __ANDROID__, fixing destroy_weak_ref's GDestroyNotify signature for OpenJDK jni.h, converting script sources via GetStringChars + g_utf16_to_utf8 (since HotSpot GetStringUTFChars emits Modified UTF-8 for surrogate pairs like the ESM package header), and deferring script-load completion to a G_PRIORITY_LOW idle callback so pending Script.nextTick() hook installations finish before new Script() returns. - Add TestRunner.isAndroid() and TestRunner.getAndroidApiLevel() so ClassRegistryTest and MethodTest compile and run on HotSpot without android.jar, selecting Android-only suites (ClassCreationTest and PerformTest) only on Android. - Rename Android Makefile/CI targets, variables, and build outputs symmetrically (build-android, deploy-android, run-android, watch-android, debug-android, check-android, check-android-gdb, develop-android, android, tests-android.dex) alongside HotSpot targets (build-jvm, run-jvm, watch-jvm, debug-jvm, check-jvm, check-jvm-gdb, develop-jvm, jvm) and update README.md accordingly. - Add a `jvm` matrix job on ubuntu-latest with Temurin JDK 8, 11, and 17 running `make check-jvm` (both interpreter and JIT modes).
Upgrade GitHub Actions to their Node 24 releases (actions/checkout@v7, actions/setup-node@v7, actions/setup-java@v6, and actions/cache@v6) across both workflows, and modernize the linting workflow to Node 22 with JavaScript syntax (`node --check`) and TypeScript declaration (`tsc --noEmit`) verification. Set explicit timeout-minutes on all CI jobs (30m for android, 15m for jvm, 10m for lint) so hung runs fail promptly instead of blocking for GitHub Actions' 6-hour default, and clean up orphaned emulator crashpad_handler processes on script exit so emulator termination does not hang after tests finish.
This was referenced Nov 20, 2026
mnalmahmud
force-pushed
the
improve-test-infra
branch
from
November 21, 2026 01:42
237c8ec to
09e271e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Modernizes the test runner, Makefiles, and GitHub Actions CI so the test suite runs cleanly and reliably across Android API 26–36 and HotSpot JVM (JDK 8, 11, and 17).
Related PRs (each independent on
main):improve-test-infra) — Test infrastructure & CI (this PR)clinit-hooking) — Class initializer ($clinit) hookingjvm-lts-21-25) — HotSpot LTS JDK 21 & 25 support viaVMStructsCommits
jvm: Fix JDK 8 lookup and code cache sweepMethod::jmethod_idsymbol entries absent in Temurin JDK 8 builds.UseCompilerandNMethodSweeper::_sweep_startedinforceSweep()so reverting methods on JDK 8 and under-Xintdoes not hang.tests: Parse script messages with json-glibScript.java(org.json, Android-only) intotest/runner.cusingjson-glib, and fail loudly ongetNextMessage()timeout instead of returningnull.tests: Support Android API levels up to 36APP_PLATFORMintest/Application.mkto the NDK's max supported API level and handle major.minor API versions intest/Makefile.test/runner.cso ART's implicit null-check and stack-overflow handlers chain properly.fail-fast: false, auto-detect the latestbuild-tools, cache downloaded dependencies, rebuildfrida-java-bridge.jswhen bridge sources change, useadb push --sync, dump scopedlogcaton failure, and support filtering test classes viaTestRunnerarguments.tests: Work around Stalker slab allocation failureGumMemoryHooksfallback intest/runner.cwhengum_memory_allocate_near()fails under Android 15+ /frida-gum17.x (frida/frida-gum#793), and callStalker.unfollow()beforesend()inMethodTest.tests: Add HotSpot JVM test runner and CItest/runner.cto launch HotSpot viaJNI_CreateJavaVMon non-Android Linux hosts, handle HotSpot's Modified UTF-8 viaGetStringChars+g_utf16_to_utf8, and defer script-load completion to aG_PRIORITY_LOWidle callback soScript.nextTick()hooks settle beforenew Script()returns.TestRunner.isAndroid()/TestRunner.getAndroidApiLevel().make check-android,make check-jvm,develop-*,check-*-gdb) and updateREADME.md.jvmCI matrix covering Temurin JDK 8, 11, and 17.ci: Modernize workflows and add job timeoutscheckout@v7,setup-node@v7,setup-java@v6,cache@v6), addnode --checkandtsc --noEmittolinting.yml, add explicit job timeouts, and terminate orphaned emulatorcrashpad_handlerprocesses on script exit (ReactiveCircus/android-emulator-runner#385).Verification
tests— 14/14 passed: Android API 26–36 + Temurin JDK 8, 11, 17): https://github.com/mnalmahmud/frida-java-bridge/actions/runs/44782095171linting— passed): https://github.com/mnalmahmud/frida-java-bridge/actions/runs/44782094904