Files
vercel-labs--zerolang/scripts/canonical-text-smoke.mts
T
wehub-resource-sync e7738de6d2
CI / Deep Native Runtime Cases (1/6) (push) Has been skipped
CI / Native Preflight (push) Failing after 1s
CI / Native Runtime Cases (1/2) (push) Failing after 0s
CI / Native Runtime Cases (2/2) (push) Failing after 1s
CI / Native Metadata Reports (push) Failing after 0s
CI / Native Direct Backend Artifacts (push) Failing after 0s
CI / Native Sanitizer Smoke (push) Failing after 1s
CI / Command Contract Snapshots (push) Failing after 1s
CI / Deep Conformance Suite (push) Has been skipped
CI / Graph Build Perf (push) Failing after 1s
CI / Deep Native Preflight (push) Has been skipped
CI / Deep Native Runtime Cases (2/6) (push) Has been skipped
CI / Deep Native Runtime Cases (3/6) (push) Has been skipped
CI / Conformance Suite (push) Failing after 1s
CI / Workspace Checks (push) Failing after 0s
CI / Deep Native Runtime Cases (5/6) (push) Has been skipped
CI / Deep Native Runtime Cases (6/6) (push) Has been skipped
CI / Deep Native Runtime Cases (4/6) (push) Has been skipped
CI / Deep Graph Build Perf (push) Has been skipped
chore: import upstream snapshot with attribution
2026-07-13 12:29:30 +08:00

55 lines
1.8 KiB
TypeScript

import { existsSync } from "node:fs";
import { readdir, rm } from "node:fs/promises";
import { execFile } from "node:child_process";
import path from "node:path";
import { promisify } from "node:util";
const execFileAsync = promisify(execFile);
const cc = process.env.CC ?? "cc";
const out = `/tmp/zero-canonical-text-smoke-${process.pid}`;
async function fixtureArgs(root: string) {
const canonicalDir = path.join(root, "fixtures/canonical");
const rejectDir = path.join(root, "fixtures/reject");
const args: string[] = [];
if (existsSync(canonicalDir)) {
for (const name of (await readdir(canonicalDir)).filter((item) => item.endsWith(".canonical.0")).sort()) {
args.push("--accept", path.join(canonicalDir, name));
}
}
if (existsSync(rejectDir)) {
for (const name of (await readdir(rejectDir)).filter((item) => item.endsWith(".0")).sort()) {
args.push("--reject", path.join(rejectDir, name));
}
}
return args;
}
try {
const nativeSources = (await readdir("native/zero-c/src"))
.filter((name) => name.endsWith(".c") && name !== "main.c")
.sort()
.map((name) => path.join("native/zero-c/src", name));
await execFileAsync(cc, [
"-std=c11",
"-Wall",
"-Wextra",
"-Wpedantic",
"-I",
"native/zero-c/include",
"-I",
"native/zero-c/src",
...nativeSources,
"native/zero-c/tests/canonical_text_smoke.c",
"-o",
out,
]);
const args = process.env.ZERO_CANONICAL_TEXT_FIXTURES ? await fixtureArgs(process.env.ZERO_CANONICAL_TEXT_FIXTURES) : [];
const result = await execFileAsync(out, args, { maxBuffer: 1024 * 1024 * 8 });
if (!result.stdout.includes("canonical text smoke ok")) {
throw new Error(`unexpected canonical text smoke output: ${result.stdout}`);
}
} finally {
await rm(out, { force: true });
}