Files
bun.sh/test/napi/node-napi-tests/harness.ts
Dylan Conway 41de7a3bfb [publish images] Upgrade LLVM toolchain from 19.1.7 to 21.1.8 (#26667)
## Summary
- Update LLVM version references across build scripts, Dockerfiles, CI,
Nix configs, and documentation
- Fix LLVM 21 `-Wcharacter-conversion` errors in WebKit bindings:
- `EncodingTables.h`: pragma for intentional char32_t/char16_t
comparisons
- `TextCodecCJK.cpp`: widen `gb18030AsymmetricEncode` param to char32_t
- `URLPatternParser`: widen `isValidNameCodepoint` param to char32_t,
cast for `startsWith`
- Fix `__libcpp_verbose_abort` noexcept mismatch (LLVM 21 uses
`_NOEXCEPT`)
- Fix dangling pointer in `BunJSCModule.h` (`toCString` temporary
lifetime)
- Remove `useMathSumPreciseMethod` (removed upstream in JSC)

**Before merging:** Merge https://github.com/oven-sh/WebKit/pull/153
first, then update `WEBKIT_VERSION` in `cmake/tools/SetupWebKit.cmake`
to point to the merged commit.

## Test plan
- [ ] Build bun debug on macOS with LLVM 21
- [ ] Build bun on Linux (glibc)
- [ ] Build bun on Linux (musl)
- [ ] Build bun on Windows
- [ ] Run test suite

Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-02-02 23:12:21 -08:00

53 lines
1.7 KiB
TypeScript

import { spawn, spawnSync } from "bun";
import { bunExe, bunEnv, isCI, isMusl } from "../../harness";
// Tests that intentionally abort and should not generate core dumps when they abort
// due to a Node-API error
const abortingJsNativeApiTests = ["test_finalizer/test_fatal_finalize.js"];
export async function build(dir: string) {
const child = spawn({
cmd: [bunExe(), "x", "node-gyp@11", "rebuild", "--debug", "-j", "max", "--verbose"],
cwd: dir,
stderr: "pipe",
stdout: "ignore",
stdin: "inherit",
env: {
...bunEnv,
npm_config_target: "v24.3.0",
CXXFLAGS: (bunEnv.CXXFLAGS ?? "") + (process.platform == "win32" ? " -std=c++20" : " -std=gnu++20"),
// on linux CI, node-gyp will default to g++ and the version installed there is very old,
// so we make it use clang instead
...(process.platform == "linux" && isCI
? {
CC: !isMusl ? "/usr/lib/llvm-21/bin/clang" : "/usr/lib/llvm21/bin/clang",
CXX: !isMusl ? "/usr/lib/llvm-21/bin/clang++" : "/usr/lib/llvm21/bin/clang++",
}
: {}),
},
});
await child.exited;
if (child.exitCode !== 0) {
const stderr = await new Response(child.stderr).text();
console.error(`node-gyp rebuild in ${dir} failed:\n${stderr}`);
console.error("bailing out!");
process.exit(1);
}
}
export function run(dir: string, test: string) {
const env = abortingJsNativeApiTests.includes(test)
? { ...bunEnv, BUN_INTERNAL_SUPPRESS_CRASH_ON_NAPI_ABORT: "1" }
: bunEnv;
const result = spawnSync({
cmd: [bunExe(), "run", test],
cwd: dir,
stderr: "inherit",
stdout: "ignore",
stdin: "inherit",
env,
});
expect(result.success).toBeTrue();
expect(result.exitCode).toBe(0);
}