Set hermes_build_mode constraint when building tester with coverage#56541
Closed
rubennorte wants to merge 1 commit into
Closed
Set hermes_build_mode constraint when building tester with coverage#56541rubennorte wants to merge 1 commit into
rubennorte wants to merge 1 commit into
Conversation
Summary: The Fantom test runner spawns native `fantom-tester` binaries built in either dev or opt mode based on each test's `fantom_mode` pragma. When collecting C++ code coverage of the tester binary, however, the build may switch to a coverage-instrumented build configuration that does not define `REACT_NATIVE_DEBUG`. That breaks dev-mode tests that rely on debug-only native APIs. For example, `installHighResTimeStampMock` in `private/react-native-fantom/tester/src/NativeFantom.cpp` is gated on `#ifdef REACT_NATIVE_DEBUG` and throws "Mocking timers is not supported in optimized builds" otherwise. Tests like `LongTasksAPI-itest.js` (no `fantom_mode` pragma → defaults to dev) fail in CI coverage runs with that error. When invoking buck with coverage enabled, layer the `hermes_build_mode` constraint on top of the build platform so `rn_build_mode()` (in `tools/build_defs/oss/rn_defs.bzl`) picks up the right value and adds `-DREACT_NATIVE_DEBUG` for dev tests. Differential Revision: D101832028
|
@rubennorte has exported this pull request. If you are a Meta employee, you can view the originating Diff in D101832028. |
|
This pull request has been merged in 5c55a61. |
Collaborator
|
This pull request was successfully merged by @rubennorte in 5c55a61 When will my fix make it into a release? | How to file a pick request? |
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:
The Fantom test runner spawns native
fantom-testerbinaries built ineither dev or opt mode based on each test's
fantom_modepragma. Whencollecting C++ code coverage of the tester binary, however, the build
may switch to a coverage-instrumented build configuration that does not
define
REACT_NATIVE_DEBUG.That breaks dev-mode tests that rely on debug-only native APIs. For
example,
installHighResTimeStampMockinprivate/react-native-fantom/tester/src/NativeFantom.cppis gated on#ifdef REACT_NATIVE_DEBUGand throws "Mocking timers is not supportedin optimized builds" otherwise. Tests like
LongTasksAPI-itest.js(nofantom_modepragma → defaults to dev) fail in CI coverage runs withthat error.
When invoking buck with coverage enabled, layer the
hermes_build_modeconstraint on top of the build platform so
rn_build_mode()(intools/build_defs/oss/rn_defs.bzl) picks up the right value and adds-DREACT_NATIVE_DEBUGfor dev tests.Differential Revision: D101832028