Skip to content

Run the API tests on the sandbox - #59238

Closed
lavenzg wants to merge 1 commit into
react:mainfrom
lavenzg:export-D125561036
Closed

lavenzg wants to merge 1 commit into
react:mainfrom
lavenzg:export-D125561036

Conversation

@lavenzg

@lavenzg lavenzg commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Summary:
Add HermesSandboxRuntime to runtimeGenerators() in APITestFactory.cpp,
so HermesUnitTests runs the parameterized HermesRuntimeTest cases on
the sandbox as well, like the legacy Hermes API tests do. Until now no
static_h test ran the sandbox.

The sandbox does not support everything HermesRuntime does, so the
tests skip what it lacks, with the same
dynamic_cast<HermesSandboxRuntime *> checks the file already uses:

  • instrumentation(): GetHeapInfo and ExternalMemoryNoOpTest.
  • ArrayBuffers created from a MutableBuffer: the rest of
    TryGetMutableBuffer after its first check, and
    TryGetMutableBufferAfterHiddenClassTransition.
  • createValueFromJsonUtf8 is the default implementation, which calls
    the global JSON.parse: CreateValueFromJsonUtf8IgnoresGlobalJSON.
  • utf16() converts through UTF-8, which turns lone surrogates into
    U+FFFD: the lone surrogate checks at the end of UTF16ConversionTest
    and CreateFromUtf16Test.

The sandbox implements neither ISerialization nor Worker, so
HermesSerializationTest and HermesWorkerTest run on the new
hermesRuntimeGenerators(), which returns just the two HermesRuntime
factories.

The same factory backs JSITests-SHTrunk, JSITestsUnstable-SHTrunk and
JSIDynamicTests-SHTrunk in xplat/jsi, FBJSValueTests-SHTrunk on Apple,
and the CMake APITests, so those now run on the sandbox too. In
testlib, ArrayBufferDetachedTest assumed that a runtime with
ArrayBuffer.prototype.detached can also detach a buffer from JS. The
sandbox has neither transfer() nor HermesInternal.detachArrayBuffer,
so the test now stops after its first check in that case.

The CMake sanitizer jobs build with Clang's UBSan, whose function
type check aborts on the generated code's indirect calls: they pass
the instance as void * to functions defined with a typed instance
pointer. Nothing ran the sandbox before, so this never fired. Build
the generated C with -fno-sanitize=function under Clang.

Changelog: [Internal]

Differential Revision: D125561036

Summary:
Add HermesSandboxRuntime to runtimeGenerators() in APITestFactory.cpp,
so HermesUnitTests runs the parameterized HermesRuntimeTest cases on
the sandbox as well, like the legacy Hermes API tests do. Until now no
static_h test ran the sandbox.

The sandbox does not support everything HermesRuntime does, so the
tests skip what it lacks, with the same
dynamic_cast<HermesSandboxRuntime *> checks the file already uses:
- instrumentation(): GetHeapInfo and ExternalMemoryNoOpTest.
- ArrayBuffers created from a MutableBuffer: the rest of
  TryGetMutableBuffer after its first check, and
  TryGetMutableBufferAfterHiddenClassTransition.
- createValueFromJsonUtf8 is the default implementation, which calls
  the global JSON.parse: CreateValueFromJsonUtf8IgnoresGlobalJSON.
- utf16() converts through UTF-8, which turns lone surrogates into
  U+FFFD: the lone surrogate checks at the end of UTF16ConversionTest
  and CreateFromUtf16Test.

The sandbox implements neither ISerialization nor Worker, so
HermesSerializationTest and HermesWorkerTest run on the new
hermesRuntimeGenerators(), which returns just the two HermesRuntime
factories.

The same factory backs JSITests-SHTrunk, JSITestsUnstable-SHTrunk and
JSIDynamicTests-SHTrunk in xplat/jsi, FBJSValueTests-SHTrunk on Apple,
and the CMake APITests, so those now run on the sandbox too. In
testlib, ArrayBufferDetachedTest assumed that a runtime with
ArrayBuffer.prototype.detached can also detach a buffer from JS. The
sandbox has neither transfer() nor HermesInternal.detachArrayBuffer,
so the test now stops after its first check in that case.

The CMake sanitizer jobs build with Clang's UBSan, whose function
type check aborts on the generated code's indirect calls: they pass
the instance as void * to functions defined with a typed instance
pointer. Nothing ran the sandbox before, so this never fired. Build
the generated C with -fno-sanitize=function under Clang.

Changelog: [Internal]

Differential Revision: D125561036
@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 Oct 20, 2026
@meta-codesync

meta-codesync Bot commented Oct 20, 2026

Copy link
Copy Markdown

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

meta-codesync Bot pushed a commit to facebook/hermes that referenced this pull request Oct 22, 2026
Summary:
X-link: react/react-native#59238

Add HermesSandboxRuntime to runtimeGenerators() in APITestFactory.cpp,
so HermesUnitTests runs the parameterized HermesRuntimeTest cases on
the sandbox as well, like the legacy Hermes API tests do. Until now no
static_h test ran the sandbox.

The sandbox does not support everything HermesRuntime does, so the
tests skip what it lacks, with the same
dynamic_cast<HermesSandboxRuntime *> checks the file already uses:
- instrumentation(): GetHeapInfo and ExternalMemoryNoOpTest.
- ArrayBuffers created from a MutableBuffer: the rest of
  TryGetMutableBuffer after its first check, and
  TryGetMutableBufferAfterHiddenClassTransition.
- createValueFromJsonUtf8 is the default implementation, which calls
  the global JSON.parse: CreateValueFromJsonUtf8IgnoresGlobalJSON.
- utf16() converts through UTF-8, which turns lone surrogates into
  U+FFFD: the lone surrogate checks at the end of UTF16ConversionTest
  and CreateFromUtf16Test.

The sandbox implements neither ISerialization nor Worker, so
HermesSerializationTest and HermesWorkerTest run on the new
hermesRuntimeGenerators(), which returns just the two HermesRuntime
factories.

The same factory backs JSITests-SHTrunk, JSITestsUnstable-SHTrunk and
JSIDynamicTests-SHTrunk in xplat/jsi, FBJSValueTests-SHTrunk on Apple,
and the CMake APITests, so those now run on the sandbox too. In
testlib, ArrayBufferDetachedTest assumed that a runtime with
ArrayBuffer.prototype.detached can also detach a buffer from JS. The
sandbox has neither transfer() nor HermesInternal.detachArrayBuffer,
so the test now stops after its first check in that case.

The CMake sanitizer jobs build with Clang's UBSan, whose function
type check aborts on the generated code's indirect calls: they pass
the instance as void * to functions defined with a typed instance
pointer. Nothing ran the sandbox before, so this never fired. Build
the generated C with -fno-sanitize=function under Clang.

Changelog: [Internal]

Reviewed By: avp

Differential Revision: D125561036

fbshipit-source-id: 65d82faf50745489321a04a3b12162d3f4983be4
meta-codesync Bot pushed a commit to facebook/hermes that referenced this pull request Oct 22, 2026
Summary:
X-link: react/react-native#59238

Add HermesSandboxRuntime to runtimeGenerators() in APITestFactory.cpp,
so HermesUnitTests runs the parameterized HermesRuntimeTest cases on
the sandbox as well, like the legacy Hermes API tests do. Until now no
static_h test ran the sandbox.

The sandbox does not support everything HermesRuntime does, so the
tests skip what it lacks, with the same
dynamic_cast<HermesSandboxRuntime *> checks the file already uses:
- instrumentation(): GetHeapInfo and ExternalMemoryNoOpTest.
- ArrayBuffers created from a MutableBuffer: the rest of
  TryGetMutableBuffer after its first check, and
  TryGetMutableBufferAfterHiddenClassTransition.
- createValueFromJsonUtf8 is the default implementation, which calls
  the global JSON.parse: CreateValueFromJsonUtf8IgnoresGlobalJSON.
- utf16() converts through UTF-8, which turns lone surrogates into
  U+FFFD: the lone surrogate checks at the end of UTF16ConversionTest
  and CreateFromUtf16Test.

The sandbox implements neither ISerialization nor Worker, so
HermesSerializationTest and HermesWorkerTest run on the new
hermesRuntimeGenerators(), which returns just the two HermesRuntime
factories.

The same factory backs JSITests-SHTrunk, JSITestsUnstable-SHTrunk and
JSIDynamicTests-SHTrunk in xplat/jsi, FBJSValueTests-SHTrunk on Apple,
and the CMake APITests, so those now run on the sandbox too. In
testlib, ArrayBufferDetachedTest assumed that a runtime with
ArrayBuffer.prototype.detached can also detach a buffer from JS. The
sandbox has neither transfer() nor HermesInternal.detachArrayBuffer,
so the test now stops after its first check in that case.

The CMake sanitizer jobs build with Clang's UBSan, whose function
type check aborts on the generated code's indirect calls: they pass
the instance as void * to functions defined with a typed instance
pointer. Nothing ran the sandbox before, so this never fired. Build
the generated C with -fno-sanitize=function under Clang.

Changelog: [Internal]

Reviewed By: avp

Differential Revision: D125561036

fbshipit-source-id: 65d82faf50745489321a04a3b12162d3f4983be4
meta-codesync Bot pushed a commit to facebook/hermes that referenced this pull request Oct 22, 2026
Summary:
X-link: react/react-native#59238

Add HermesSandboxRuntime to runtimeGenerators() in APITestFactory.cpp,
so HermesUnitTests runs the parameterized HermesRuntimeTest cases on
the sandbox as well, like the legacy Hermes API tests do. Until now no
static_h test ran the sandbox.

The sandbox does not support everything HermesRuntime does, so the
tests skip what it lacks, with the same
dynamic_cast<HermesSandboxRuntime *> checks the file already uses:
- instrumentation(): GetHeapInfo and ExternalMemoryNoOpTest.
- ArrayBuffers created from a MutableBuffer: the rest of
  TryGetMutableBuffer after its first check, and
  TryGetMutableBufferAfterHiddenClassTransition.
- createValueFromJsonUtf8 is the default implementation, which calls
  the global JSON.parse: CreateValueFromJsonUtf8IgnoresGlobalJSON.
- utf16() converts through UTF-8, which turns lone surrogates into
  U+FFFD: the lone surrogate checks at the end of UTF16ConversionTest
  and CreateFromUtf16Test.

The sandbox implements neither ISerialization nor Worker, so
HermesSerializationTest and HermesWorkerTest run on the new
hermesRuntimeGenerators(), which returns just the two HermesRuntime
factories.

The same factory backs JSITests-SHTrunk, JSITestsUnstable-SHTrunk and
JSIDynamicTests-SHTrunk in xplat/jsi, FBJSValueTests-SHTrunk on Apple,
and the CMake APITests, so those now run on the sandbox too. In
testlib, ArrayBufferDetachedTest assumed that a runtime with
ArrayBuffer.prototype.detached can also detach a buffer from JS. The
sandbox has neither transfer() nor HermesInternal.detachArrayBuffer,
so the test now stops after its first check in that case.

The CMake sanitizer jobs build with Clang's UBSan, whose function
type check aborts on the generated code's indirect calls: they pass
the instance as void * to functions defined with a typed instance
pointer. Nothing ran the sandbox before, so this never fired. Build
the generated C with -fno-sanitize=function under Clang.

Changelog: [Internal]

Reviewed By: avp

Differential Revision: D125561036

fbshipit-source-id: 65d82faf50745489321a04a3b12162d3f4983be4
@meta-codesync meta-codesync Bot closed this in 05a2e4c Oct 22, 2026
@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @lavenzg in 05a2e4c

When will my fix make it into a release? | How to file a pick request?

@react-native-bot react-native-bot added the Merged This PR has been merged. label Oct 22, 2026
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. 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.

2 participants