Skip to content

[automated runtime tests][8/11] feat: CLI runner for runtime tests, one library at a time#9930

Open
tjzel wants to merge 10 commits into
mainfrom
@tjzel/runtime-tests-cli
Open

[automated runtime tests][8/11] feat: CLI runner for runtime tests, one library at a time#9930
tjzel wants to merge 10 commits into
mainfrom
@tjzel/runtime-tests-cli

Conversation

@tjzel

@tjzel tjzel commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Note

This PR description is AI-generated.

Summary

Since #9929 the runtime tests run one library per JS session, but starting them still takes a human tapping through the app, which rules out CI. I added a host-side CLI: yarn runtime-tests --library <reanimated|worklets|self-tests> [--platform <ios|android>] starts a WebSocket server (Metro port + 1), provisions the device — an iOS simulator built with the DebugRuntimeTests scheme, or an Android emulator built with assembleDebugRuntimeTests — and launches FabricExample with the library selection (RUNTIME_TESTS_LIBRARY env on iOS, an intent extra captured by MainActivity on Android) picking a per-library entry point; the app runs its suites headlessly and streams results back over the hello/start/log/done protocol, and the server exits 0/1. Worklets sessions additionally assert that Reanimated was never loaded, which #9936 made possible. I also added .github/workflows/runtime-tests-ios.yml — a reusable workflow with a pull_request trigger on the runtime-tests paths, running self-tests (shortest, builds the app), a step verifying that the intentional failures suite fails the runner, then Worklets and Reanimated, each with one retry; a matching runtime-tests-android.yml runs both libraries on ubuntu-latest with KVM and an API 34 emulator.

Test plan

All three libraries pass locally through the CLI in Bundle Mode and Legacy Mode on iOS, and Reanimated passes end-to-end on an Android emulator; the iOS workflow runs green on this PR.

@tjzel
tjzel force-pushed the @tjzel/runtime-tests-cli branch 2 times, most recently from d9e850e to 579d7be Compare July 13, 2026 08:03
@tjzel
tjzel changed the base branch from @tjzel/manual-runtime-tests to @tjzel/rejest-reanimated-decoupling July 13, 2026 08:03
@tjzel
tjzel force-pushed the @tjzel/runtime-tests-cli branch from 6048ad5 to c869aae Compare July 13, 2026 11:05
@tjzel
tjzel force-pushed the @tjzel/rejest-reanimated-decoupling branch from cdc743f to 6e44caf Compare July 13, 2026 11:05
@tjzel
tjzel force-pushed the @tjzel/runtime-tests-cli branch from c869aae to f3d22a0 Compare July 13, 2026 13:18
@tjzel tjzel changed the title feat: CLI runner for runtime tests, one library at a time [automated runtime tests][5/9] feat: CLI runner for runtime tests, one library at a time Jul 14, 2026
@tjzel
tjzel force-pushed the @tjzel/rejest-reanimated-decoupling branch from 00a917a to feb0078 Compare July 14, 2026 08:29
@tjzel
tjzel force-pushed the @tjzel/runtime-tests-cli branch from f3d22a0 to f40970b Compare July 14, 2026 08:29
@tjzel
tjzel force-pushed the @tjzel/rejest-reanimated-decoupling branch from feb0078 to 6f039a1 Compare July 14, 2026 09:25
@tjzel
tjzel force-pushed the @tjzel/runtime-tests-cli branch 2 times, most recently from 5b7e135 to 38d1959 Compare July 14, 2026 10:26
@tjzel
tjzel force-pushed the @tjzel/rejest-reanimated-decoupling branch from 6f039a1 to 3482314 Compare July 14, 2026 10:26
@tjzel tjzel changed the title [automated runtime tests][5/9] feat: CLI runner for runtime tests, one library at a time [automated runtime tests][6/10] feat: CLI runner for runtime tests, one library at a time Jul 14, 2026
@tjzel
tjzel force-pushed the @tjzel/runtime-tests-cli branch from 38d1959 to 2cbd138 Compare July 14, 2026 12:04
@tjzel
tjzel force-pushed the @tjzel/rejest-reanimated-decoupling branch 2 times, most recently from 8466efe to 3820918 Compare July 14, 2026 12:29
@tjzel
tjzel force-pushed the @tjzel/runtime-tests-cli branch from 2cbd138 to 4901bbc Compare July 14, 2026 12:29
@tjzel
tjzel force-pushed the @tjzel/rejest-reanimated-decoupling branch from 3820918 to 43fa9bf Compare July 14, 2026 13:16
@tjzel
tjzel force-pushed the @tjzel/runtime-tests-cli branch from 4901bbc to 61a65ab Compare July 14, 2026 13:16
@tjzel
tjzel force-pushed the @tjzel/rejest-reanimated-decoupling branch from 43fa9bf to f9d0633 Compare July 14, 2026 14:03
@tjzel
tjzel force-pushed the @tjzel/runtime-tests-cli branch from 61a65ab to 53d3c71 Compare July 14, 2026 14:03
@tjzel
tjzel force-pushed the @tjzel/rejest-reanimated-decoupling branch from f9d0633 to 635e9d1 Compare July 14, 2026 14:14
@tjzel
tjzel force-pushed the @tjzel/runtime-tests-cli branch 2 times, most recently from 626d86e to df90778 Compare July 15, 2026 10:01
@tjzel
tjzel force-pushed the @tjzel/rejest-reanimated-decoupling branch from 635e9d1 to 0cf898f Compare July 15, 2026 10:01
@tjzel
tjzel changed the base branch from @tjzel/rejest-reanimated-decoupling to @tjzel/rejest-test-failing July 15, 2026 10:01
@tjzel tjzel changed the title [automated runtime tests][6/10] feat: CLI runner for runtime tests, one library at a time [automated runtime tests][7/11] feat: CLI runner for runtime tests, one library at a time Jul 15, 2026
@tjzel
tjzel changed the base branch from main to @tjzel/fix-runtime-tests July 16, 2026 15:15
@tjzel tjzel changed the title [automated runtime tests][7/10] feat: CLI runner for runtime tests, one library at a time [automated runtime tests][8/11] feat: CLI runner for runtime tests, one library at a time Jul 16, 2026
@tjzel
tjzel force-pushed the @tjzel/runtime-tests-cli branch from 2ca5bd4 to 8eb3b17 Compare July 16, 2026 15:28
@tjzel
tjzel force-pushed the @tjzel/fix-runtime-tests branch from 4d3a6fa to 434f5d1 Compare July 16, 2026 15:28
@tjzel
tjzel force-pushed the @tjzel/runtime-tests-cli branch from 8eb3b17 to d38c68f Compare July 16, 2026 15:54
@tjzel
tjzel force-pushed the @tjzel/fix-runtime-tests branch from 434f5d1 to dcb705b Compare July 16, 2026 15:54
@tjzel
tjzel force-pushed the @tjzel/runtime-tests-cli branch from d38c68f to 9a684ba Compare July 16, 2026 20:18
@tjzel
tjzel force-pushed the @tjzel/fix-runtime-tests branch from dcb705b to fe70df9 Compare July 17, 2026 07:55
@tjzel
tjzel force-pushed the @tjzel/runtime-tests-cli branch 2 times, most recently from 17efd27 to 0e8cd1d Compare July 17, 2026 08:09
@tjzel
tjzel force-pushed the @tjzel/fix-runtime-tests branch 2 times, most recently from da2cd57 to 6024f18 Compare July 17, 2026 09:07
@tjzel
tjzel force-pushed the @tjzel/runtime-tests-cli branch from 0e8cd1d to 01bbed3 Compare July 17, 2026 09:07
@tjzel
tjzel force-pushed the @tjzel/fix-runtime-tests branch from 6024f18 to c74c493 Compare July 17, 2026 09:42
@tjzel
tjzel force-pushed the @tjzel/runtime-tests-cli branch from 01bbed3 to 0b12610 Compare July 17, 2026 09:42
tjzel added 10 commits July 17, 2026 12:02
On Android pixel snapping reports a 50dp offset as 49.999…, which
Math.floor turned into 49 and failed five of the nine cases on the
emulator. Rounding to the nearest integer keeps the assertion exact on
iOS and correct on Android.
The app-side selection mirrors the iOS RUNTIME_TESTS compile flag with a
dedicated debugRuntimeTests build type (initWith debug) that sets
BuildConfig.RUNTIME_TESTS. Under that flag MainActivity registers the
FabricExampleRuntimeTests component and the React host resolves
index.runtimeTests.<library> as its JS main module.

The library is passed per launch as an intent extra
(am start --es RUNTIME_TESTS_LIBRARY <library>) rather than a system
property: the extra is scoped to a single launch so a stale value can
never leak into later runs, it uses only public APIs (SystemProperties
requires reflection or a getprop exec), and it works identically on
physical devices. MainActivity captures the extra before super.onCreate
because ReactActivity's delegate creates the lazy React host inside it.

A non-default Metro port has to be baked into the APK at build time
through the react_native_dev_server_port resource, since Android
resolves the dev server host from resources rather than from a launch
environment like the iOS RCT_jsLocation default. The runtime-tests
server passes -PreactNativeDevServerPort when it builds and limits the
native build to the target device's ABI.

The server gains --platform android (iOS stays the default): it reuses
the Metro logic, picks a connected device from adb or boots the first
AVD, builds assembleDebugRuntimeTests, installs the APK, sets up adb
reverse for physical devices (emulators reach the host via 10.0.2.2)
and launches the activity with the library extra. The connect timer is
still armed only after launch. Release configurations are rejected on
Android for now because embedding both per-library bundles in assets
needs custom bundling tasks.
@tjzel
tjzel force-pushed the @tjzel/runtime-tests-cli branch from 0b12610 to 6f1d31a Compare July 17, 2026 10:03
@tjzel
tjzel force-pushed the @tjzel/fix-runtime-tests branch from c74c493 to fe3f1f3 Compare July 17, 2026 10:03
Base automatically changed from @tjzel/fix-runtime-tests to main July 17, 2026 16:24
pull Bot pushed a commit to esinanturan/react-native-reanimated that referenced this pull request Jul 17, 2026
…he Debug/Release × BundleMode/LegacyEval matrix (software-mansion#9974)

> [!NOTE]
> **This PR description is AI-generated.**

## Summary

Running the runtime tests across Debug/Release and Bundle Mode/Legacy
Eval Mode — locally and then on CI in software-mansion#9930 — surfaced bugs in the tests
themselves that only show under specific configurations or on
constrained runners. Assertions depended on mode-specific error
messages, exact timings and floored coordinates, `toThrow` missed errors
that Worklet Runtimes report asynchronously through `ErrorUtils`, and a
~100M-character string preset OOM-killed default-RAM CI emulators.

The COLOR comparator also rejected the `hwb()` colors used by the
animation tests: `@react-native/normalize-colors` dropped the legacy
comma `hwb()` syntax that Reanimated still parses, and the two parsers
round half-value channels to different integers. The comparator now
re-parses comma `hwb()` strings in space syntax and compares RGBA
channel-wise with a ±1 tolerance, keeping ReJest free of
`react-native-reanimated` imports.

I fixed the tests ahead of the CLI PR so the automated runs start green.
I also swapped the host-object specimens in the memory tests to a pooled
`WorkletRuntime`, since `__workletsModuleProxy` stopped being a real
`jsi::HostObject` after the `toOptimizedObject` refactor.

## Test plan

All three libraries pass across the full configuration matrix locally
and on CI in software-mansion#9930 and software-mansion#9932.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant