Skip to content

test(iroh-dns): APK-based smoke test for the Android JNI path#4249

Draft
Frando wants to merge 1 commit into
mainfrom
Frando/android-apk-test
Draft

test(iroh-dns): APK-based smoke test for the Android JNI path#4249
Frando wants to merge 1 commit into
mainfrom
Frando/android-apk-test

Conversation

@Frando
Copy link
Copy Markdown
Member

@Frando Frando commented May 11, 2026

Description

This is a follow-up to #4183. That PR gets the iroh resolver working on Android once ndk_context is initialized, but the workspace unit tests can't actually exercise the JNI path: they run as plain ELFs pushed via adb shell, with no JVM in scope. On Android they either fall back to public DNS (debug builds) or would panic (release), but they never go through the real LinkProperties.getDnsServers() lookup. So the JNI code is, in practice, untested in CI.

This branch adds a tiny standalone APK that does. It lives at iroh-dns/tests/android_apk/ as its own [workspace] (so android-activity and friends do not pollute the main workspace), gets built and launched by cargo apk run from the existing x86_64 Android emulator CI job, and resolves dns.iroh.link through DnsResolver::new().

android-activity populates ndk_context for us before android_main runs, so the system DNS reader takes the JNI path. To prove that is what actually happened (rather than a silent fallback to public DNS) the smoke test installs an n0_tracing_test buffer subscriber and asserts that the read system DNS via Android JNI debug line was emitted. That is the only signal that distinguishes "JNI worked" from "JNI silently failed and we used Google".

cargo apk run does not propagate the in-app exit code, so the test prints RESULT=ok only on full success and the CI step polls logcat for that marker. Failed assertions panic, the process aborts, and the poll loop times out.

Breaking Changes

None.

Notes & open questions

Based on #4183, which adds the debug! line this test asserts on.

Change checklist

  • Self-review.
  • Tests if relevant.
  • All breaking changes documented.

@github-actions
Copy link
Copy Markdown

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/4249/docs/iroh/

Last updated: 2026-05-11T12:05:44Z

@github-actions
Copy link
Copy Markdown

Netsim report & logs for this PR have been generated and is available at: LOGS
This report will remain available for 3 days.

Last updated for commit: f8bd2ea

@n0bot n0bot Bot added this to iroh May 11, 2026
@github-project-automation github-project-automation Bot moved this to 🚑 Needs Triage in iroh May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🚑 Needs Triage

Development

Successfully merging this pull request may close these issues.

1 participant