Skip to content

Skip Performance timeOrigin test on macOS hosts (#56991)#56991

Closed
rubennorte wants to merge 2 commits into
facebook:mainfrom
rubennorte:export-D106669674
Closed

Skip Performance timeOrigin test on macOS hosts (#56991)#56991
rubennorte wants to merge 2 commits into
facebook:mainfrom
rubennorte:export-D106669674

Conversation

@rubennorte
Copy link
Copy Markdown
Contributor

@rubennorte rubennorte commented May 28, 2026

Summary:

The timeOrigin test in Performance-itest compares
performance.now() + performance.timeOrigin against Date.now(). On
macOS this comparison is unreliable because performance.now() is
backed by a monotonic clock that does NOT advance while the system is
asleep, so the monotonic time drifts relative to wall time the longer
the machine has been running.

Use the new Fantom.getHostPlatform() to skip just this test on macOS
hosts while keeping it active on other platforms. A comment explains
why the test cannot be run there.

Also adds a small test verifying that performance.timeOrigin is a
positive number and is stable across calls.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D106669674

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 28, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented May 28, 2026

@rubennorte has exported this pull request. If you are a Meta employee, you can view the originating Diff in D106669674.

@rubennorte rubennorte force-pushed the export-D106669674 branch from 22e8b77 to a8a5c5e Compare May 29, 2026 11:49
@meta-codesync meta-codesync Bot changed the title Skip Performance timeOrigin test on macOS hosts Skip Performance timeOrigin test on macOS hosts (#56991) May 29, 2026
rubennorte added a commit to rubennorte/react-native that referenced this pull request May 29, 2026
Summary:

The `timeOrigin` test in `Performance-itest` compares
`performance.now() + performance.timeOrigin` against `Date.now()`. On
macOS this comparison is unreliable because `performance.now()` is
backed by a monotonic clock that does NOT advance while the system is
asleep, so the monotonic time drifts relative to wall time the longer
the machine has been running.

Use the new `Fantom.getHostPlatform()` to skip just this test on macOS
hosts while keeping it active on other platforms. A comment explains
why the test cannot be run there.

Also adds a small test verifying that `performance.timeOrigin` is a
positive number and is stable across calls.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D106669674
@rubennorte rubennorte force-pushed the export-D106669674 branch from a8a5c5e to a8b9f7f Compare May 29, 2026 14:09
…56990)

Summary:

Adds a new `Fantom.getHostPlatform()` API that returns the host
operating system where the Fantom test runner is running (e.g. 'linux',
'macos', 'windows', 'android'). This is different from React Native's
`Platform.OS`, which always reflects the React Native target platform
being tested.

The value is determined by the Node.js Jest runner (via
`process.platform`) and baked into the JS bundle through the existing
`setConstants(...)` pipeline, so no native changes are needed.

- Add `HostPlatform` type and `hostPlatform` field to
  `FantomRuntimeConstants`.
- Populate `hostPlatform` from the host platform in the entrypoint
  template (maps darwin -> macos, win32 -> windows, etc.).
- Expose `getHostPlatform()` from the public Fantom API.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D106669673
Summary:

The `timeOrigin` test in `Performance-itest` compares
`performance.now() + performance.timeOrigin` against `Date.now()`. On
macOS this comparison is unreliable because `performance.now()` is
backed by a monotonic clock that does NOT advance while the system is
asleep, so the monotonic time drifts relative to wall time the longer
the machine has been running.

Use the new `Fantom.getHostPlatform()` to skip just this test on macOS
hosts while keeping it active on other platforms. A comment explains
why the test cannot be run there.

Also adds a small test verifying that `performance.timeOrigin` is a
positive number and is stable across calls.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D106669674
@rubennorte rubennorte force-pushed the export-D106669674 branch from a8b9f7f to e990856 Compare May 29, 2026 14:10
@meta-codesync meta-codesync Bot closed this in 540c741 May 29, 2026
@facebook-github-tools facebook-github-tools Bot added the Merged This PR has been merged. label May 29, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented May 29, 2026

This pull request has been merged in 540c741.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant