mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-20 05:40:17 +08:00
* Make native installs portable and smaller - Support glibc 2.34 with portable compiler binaries and static LLVM helpers. - Bundle the host runtime and discover optional cross-target packs from project dependencies. - Add application build benchmarks covering latency, executable size, and memory. * Keep bootstrap tools available in Sandbox validation - Isolate Zig for native compiler bootstrap and glibc entropy contracts. - Preserve the existing toolchain scope for cache and corpus tests. * Fix portable compiler bootstrap linking - Keep native support objects compatible with the destination host linker. - Resolve installed targets using the host declared by the toolchain manifest.
20 lines
1.2 KiB
TypeScript
20 lines
1.2 KiB
TypeScript
import { execFileSync } from "node:child_process";
|
|
import { mkdtempSync, rmSync } from "node:fs";
|
|
import { join } from "node:path";
|
|
import { expect, test } from "vitest";
|
|
|
|
const report = process.platform === "linux" ? process.report.getReport() as { header: { glibcVersionRuntime?: string } } : undefined;
|
|
const version = report?.header.glibcVersionRuntime?.split(".").map(Number);
|
|
const supported = version !== undefined && (version[0]! > 2 || (version[0] === 2 && version[1]! >= 34)) &&
|
|
(process.arch === "x64" || process.arch === "arm64");
|
|
test.skipIf(!supported)("glibc 2.34 CSPRNG retries interruptions and partial reads and traps on entropy failure", () => {
|
|
const directory = mkdtempSync("/tmp/scriptc-glibc-random-");
|
|
const binary = join(directory, "random");
|
|
try {
|
|
execFileSync("zig", ["cc", "-target", `${process.arch === "x64" ? "x86_64" : "aarch64"}-linux-gnu.2.34`,
|
|
"-std=c11", "-O2", "-D_GNU_SOURCE", "-I", join(import.meta.dirname, "../src"),
|
|
join(import.meta.dirname, "test_glibc_random.c"), "-o", binary], { timeout: 120_000 });
|
|
expect(execFileSync(binary, [], { encoding: "utf8" })).toBe("entropy retries and failures verified\n");
|
|
} finally { rmSync(directory, { recursive: true, force: true }); }
|
|
}, 120_000);
|