mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-02 07:43:42 +08:00
macOS binds libnode's own calls to v8::base::Stack inside libnode, so the bridge's definitions cannot give V8 Node's stack as they do on Linux; V8 took the main thread's stack start and its conservative scan faulted in the gap above Node's stack. While Node starts on its stack, the main thread's pthread record now names that stack, which V8 reads once and keeps. macOS's makecontext clears the whole stack it is given, so it gets only the top slice of Node's stack (no 64 MiB pass per context). CI: dev-pack.json pins mirrored darwin-arm64 and darwin-x64 libnode builds of the pinned Node 24.22.0 from the libnode-packs workflow, the dev-pack action serves either platform, and the macOS lanes provision it, so island tests fail rather than skip on macOS CI. The arm64 LLVM job runs the island harness; the Intel job runs it and the island corpus. bridge-smoke loads the .dylib bridge on macOS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
32 lines
1.3 KiB
TypeScript
32 lines
1.3 KiB
TypeScript
/* Node island tests need a libnode pack (SCRIPTC_LIBNODE). The Linux x64 and
|
|
* macOS CI test lanes provide one (.github/actions/libnode-dev-pack) and
|
|
* must run these tests, so there a missing pack is a failure, never a skip.
|
|
* Other platforms have no pack yet (NI-13), and a local run without a pack
|
|
* skips. */
|
|
import { readFileSync } from "node:fs";
|
|
|
|
/** `// @requires-libnode` in a corpus program's two-line directive head. */
|
|
export function requiresLibnode(file: string): boolean {
|
|
return readFileSync(file, "utf8")
|
|
.split("\n", 2)
|
|
.some((line) => /^\/\/ @requires-libnode\s*$/.test(line));
|
|
}
|
|
|
|
/** Whether CI must run the Node island tests on this machine. */
|
|
export const libnodeRequired =
|
|
process.env["CI"] !== undefined &&
|
|
process.env["CI"] !== "" &&
|
|
process.env["CI"] !== "false" &&
|
|
((process.platform === "linux" && process.arch === "x64") || process.platform === "darwin");
|
|
|
|
/** The configured pack, or null. Throws where CI requires one. */
|
|
export function libnodePack(): string | null {
|
|
const pack = process.env["SCRIPTC_LIBNODE"];
|
|
if (pack !== undefined && pack !== "") return pack;
|
|
if (libnodeRequired)
|
|
throw new Error(
|
|
"Node island tests need a libnode pack in this CI lane, and SCRIPTC_LIBNODE is not set (.github/actions/libnode-dev-pack provides it)",
|
|
);
|
|
return null;
|
|
}
|