ReviewOS

also looking at this

craft-native/craft

test(android): the ratchet, and the two seams JNI leaves unchecked

#142
Merged chris wants to merge test/android-conformance-ratchet into main
2 files +360 -0
packages/zig/build.zigmodified+27-0
Changes to packages/zig/build.zig
@@ -411,6 +411,31 @@ pub fn build(b: *std.Build) void {
411411 // pointers, so the tests build one out of Zig functions and run anywhere —
412412 // no JVM, no emulator, no NDK. That is the whole reason the layer is shaped
413413 // the way it is.
414 // The Android action ratchet, and the JNI binding contract. Separate from
415 // the iOS gate for the obvious reason and from the surface gate for a
416 // subtler one: this is about what Zig owes Kotlin, not about what either
417 // owes the page.
418 const android_conformance_tests = b.addTest(.{
419 .root_module = b.createModule(.{
420 .root_source_file = b.path("test/android_conformance_test.zig"),
421 .target = target,
422 .optimize = optimize,
423 }),
424 });
425 android_conformance_tests.root_module.addAnonymousImport("CraftBridge.kt", .{
426 .root_source_file = b.path("../android/templates/CraftBridge.kt.template"),
427 });
428 android_conformance_tests.root_module.addAnonymousImport("CraftNative.kt", .{
429 .root_source_file = b.path("../android/templates/CraftNative.kt.template"),
430 });
431 android_conformance_tests.root_module.addAnonymousImport("src/android_dispatch.zig", .{
432 .root_source_file = b.path("src/android_dispatch.zig"),
433 });
434 android_conformance_tests.root_module.addAnonymousImport("src/bridge_android_device.zig", .{
435 .root_source_file = b.path("src/bridge_android_device.zig"),
436 });
437 const run_android_conformance_tests = b.addRunArtifact(android_conformance_tests);
438
414439 // The page surface, across both bridges. Not folded into the iOS
415440 // conformance gate: it embeds three files and is about what `window.craft`
416441 // offers rather than about iOS, and the iOS gate is already the largest
@@ -1597,6 +1622,7 @@ pub fn build(b: *std.Build) void {
15971622 test_step.dependOn(&run_ios_conformance_tests.step);
15981623 test_step.dependOn(&run_jni_tests.step);
15991624 test_step.dependOn(&run_bridge_surface_tests.step);
1625 test_step.dependOn(&run_android_conformance_tests.step);
16001626 test_step.dependOn(&run_android_bridge_tests.step);
16011627 test_step.dependOn(&run_menubar_tests.step);
16021628 test_step.dependOn(&run_components_tests.step);
@@ -2325,6 +2351,7 @@ pub fn build(b: *std.Build) void {
23252351 // so a run that skipped it would not be an Android test run.
23262352 test_android_step.dependOn(&run_jni_tests.step);
23272353 test_android_step.dependOn(&run_bridge_surface_tests.step);
2354 test_android_step.dependOn(&run_android_conformance_tests.step);
23282355 test_android_step.dependOn(&run_android_bridge_tests.step);
23292356
23302357 // Add Android tests to the main test step