Repository navigation
Run ReactCommon C++ unit tests in GitHub CI - #59802
Conversation
4b836e7 to
1f264e7
Compare
| @@ -0,0 +1,45 @@ | |||
| name: Test ReactCommon C++ | |||
There was a problem hiding this comment.
can we have a reusable workflow rather than a reusable action? It's much easier to maintain. Also, if it is only used in test-all, can we just put the workflow there instead of splitting it in two places?
There was a problem hiding this comment.
Yeah it's semantically part of test-all, which is getting long at this point. For now I'll move this inline so we have less files to look at, at least (although I believe reusable actions are a fair pattern). The scope of this test suite is a single job in this workflow, IMO.
I'm certainly keen, after this, that we do another pass over all GHA files to simplify. But that goes beyond the initial scope here.
|
@cortinico has imported this pull request. If you are a Meta employee, you can view this in D129898681. |
|
@cipolleschi Can I get signal on what is failing internally here? |
|
Seems like an internal issue. We have a few issues going on now. I'll let you know in a moment. I'm rebasing the PR. EDIT: seems to be landing now. |
|
This pull request was successfully merged by @huntie in 6990b94 When will my fix make it into a release? | How to file a pick request? |
## Summary The C++ unit tests under `packages/react-native/ReactCommon/**/tests` run only inside Meta, under Buck. Public CI has no build for them, so a change that breaks one passes every GitHub check and fails only after import, as happened with react#59686. This adds a `test_react_common_cxx` job to `Test All` that builds and runs them on Linux, reusing the Fantom tester's CMake build, which already compiles every ReactCommon library with folly, Hermes and codegen. **Changes** - Add `private/react-native-fantom/tester/react-common-tests/`: one GoogleTest executable per `tests` directory (38 today), linked against the libraries `fantom_tester` links. Each test case is registered with CTest through `gtest_discover_tests`, so it runs in its own process. - Add `:private:react-native-fantom:testReactCommon`, which builds them and runs `ctest`. GoogleTest 1.18.0 is downloaded like the Fantom tester's other dependencies. - Add the `test_react_common_cxx` job to `test-all.yml`, mirroring `build_fantom_runner` on the same container and runner. It adds no ccache steps: in this container compiles do not go through ccache, and `build_fantom_runner` on `main` reports 0 hits and 0 misses. **Notes** - NOTE: Three Hermes debugger cases in `jsinspector-modern/tests` fail in OSS on macOS and Linux alike, and are excluded by name in the CMake file (see Test Plan). - The job installs clang 18 from apt.llvm.org, since the tests use C++20 features the image's clang 14 lacks: `std::source_location` and parenthesised aggregate initialisation. - Each case runs in its own process because some suites leave global state behind. In `jsinspector-modern/tests`, `TracingTest` fails when run after the other suites in one process, and passes on its own. - The tests compile with `-Wno-error`, since the header-only ReactCommon libraries export `-Werror -Wpedantic` and a few tests call deprecated APIs. - `benchmarks/` directories are left out, as they need Google Benchmark. Changelog: [Internal] ## Test Plan On macOS (Apple clang 21, CMake 3.30.5 from the Android SDK, JDK 17): ``` yarn install ./gradlew :private:react-native-fantom:testReactCommon ``` All 38 test executables build, and 1522 test cases pass, one of which skips itself (`ReactInstanceTest.testRegistersRuntimeSchedulerAsEventLoopControl`: this Hermes build has no `ISetEventLoopControl`). Before the exclusions, 1525 cases ran and these 3 failed, with the same result on macOS and in this job on Linux: - `JsiIntegrationHermesTest.ResolveColumnlessBreakpointAfterEval`: `Debugger.setBreakpointByUrl` returns no `locations`. - `JsiIntegrationHermesTest.ResolveColumnlessBreakpointAfterReload`: the same. - `JsiIntegrationHermesTest.TwoConnectionsDebuggerLifecycle`: the second session gets no `Debugger.scriptParsed` after the first disables `Debugger`. `test_react_common_cxx` on this PR: [passed](https://github.com/react/react-native/actions/runs/41937402196/job/126950417455) in 14m15s, with all 1522 tests passing. Running them takes 30 seconds of that; the rest is the build. <img width="400" alt="image" src="https://github.com/user-attachments/assets/1db09ec6-0d7f-45a4-b2a4-e87128bd3f5e" /> <img width="400" alt="file-bccb81bc0762aa22ac5f3c2165826db4" src="https://github.com/user-attachments/assets/50acc10a-6551-4bde-90f6-7466c72083c2" /> <img width="400" alt="file-49c0f65500ec760461f11925dfbc4059" src="https://github.com/user-attachments/assets/6aeb7b06-b282-4316-a905-365bcc2c9bf5" /> Differential Revision: D129898681 Pull Request resolved: react#59802
Summary
The C++ unit tests under
packages/react-native/ReactCommon/**/testsrun only inside Meta, under Buck. Public CI has no build for them, so a change that breaks one passes every GitHub check and fails only after import, as happened with #59686.This adds a
test_react_common_cxxjob toTest Allthat builds and runs them on Linux, reusing the Fantom tester's CMake build, which already compiles every ReactCommon library with folly, Hermes and codegen.Changes
private/react-native-fantom/tester/react-common-tests/: one GoogleTest executable pertestsdirectory (38 today), linked against the librariesfantom_testerlinks. Each test case is registered with CTest throughgtest_discover_tests, so it runs in its own process.:private:react-native-fantom:testReactCommon, which builds them and runsctest. GoogleTest 1.18.0 is downloaded like the Fantom tester's other dependencies.test_react_common_cxxjob totest-all.yml, mirroringbuild_fantom_runneron the same container and runner. It adds no ccache steps: in this container compiles do not go through ccache, andbuild_fantom_runneronmainreports 0 hits and 0 misses.Notes
jsinspector-modern/testsfail in OSS on macOS and Linux alike, and are excluded by name in the CMake file (see Test Plan).std::source_locationand parenthesised aggregate initialisation.jsinspector-modern/tests,TracingTestfails when run after the other suites in one process, and passes on its own.-Wno-error, since the header-only ReactCommon libraries export-Werror -Wpedanticand a few tests call deprecated APIs.benchmarks/directories are left out, as they need Google Benchmark.Changelog: [Internal]
Test Plan
On macOS (Apple clang 21, CMake 3.30.5 from the Android SDK, JDK 17):
All 38 test executables build, and 1522 test cases pass, one of which skips itself (
ReactInstanceTest.testRegistersRuntimeSchedulerAsEventLoopControl: this Hermes build has noISetEventLoopControl).Before the exclusions, 1525 cases ran and these 3 failed, with the same result on macOS and in this job on Linux:
JsiIntegrationHermesTest.ResolveColumnlessBreakpointAfterEval:Debugger.setBreakpointByUrlreturns nolocations.JsiIntegrationHermesTest.ResolveColumnlessBreakpointAfterReload: the same.JsiIntegrationHermesTest.TwoConnectionsDebuggerLifecycle: the second session gets noDebugger.scriptParsedafter the first disablesDebugger.test_react_common_cxxon this PR: passed in 14m15s, with all 1522 tests passing. Running them takes 30 seconds of that; the rest is the build.