A gate that does not depend on its machine, on a runner of its own
Test / gate (push) Canceled after 0s
Test / gate (push) Canceled after 0s
The gate first ran on the server that deploys the site: a slow container with no C compiler and no ICU. Ten tests failed there on correct code, and no Mojo program could be built at all. - The workflows ask for a runner labeled heavy, not the deploy server: the gate builds and runs some 300 Mojo programs and fuzzes. docs/ci.md says how to register one. With none registered a run waits. - The pinned environment has a C compiler on Linux (gcc, with its C library pinned to glibc 2.34): mojo build links with the C compiler it finds, and conda-forge's default links against a C library too old for Mojo's runtime. mojo-local reports a program that could not be linked as that, and does not keep the answer. - The pinned Dafny runs without ICU, and dafny-fetch fails when the Dafny it fetched does not start. - A test's time limit is processor time at the machine's pace (tests/helpers/pace.mjs). - The prover's time on the clock is the caller's: provePseudo and Workspace.proofBudgetMs take it, the Prove tab's 3 seconds stay the default, and the command line, library-check and the tests use none, so their answers are the counted budgets' alone. - The library pointer moves to its workflow change (e5ae090).
This commit is contained in:
31 files changed
+427
-104
No files matched your search
+15
-4
@@ -176,6 +176,14 @@ const exec = (cmd, args, { cwd, input = '', timeout = 60000 } = {}) => new Promi
|
||||
const SIGNALS = os.constants.signals;
|
||||
const HAVE_PRLIMIT = spawnSync('prlimit', ['--version'], { encoding: 'utf8' }).status === 0;
|
||||
|
||||
/**
|
||||
* `mojo build` compiles a program and then has the C compiler it finds on the PATH link it. When that step fails (no
|
||||
* C compiler, or one that links against a C library older than Mojo's runtime needs) the compiler never said
|
||||
* anything about the program: the answer is the machine's, so it is not kept in the cache, not held against the
|
||||
* checker or godbolt, and reported as what it is.
|
||||
*/
|
||||
const NOT_LINKED = /unable to find suitable c compiler|failed to link executable/;
|
||||
|
||||
/** Build one program and run it: { compiled, buildStderr, executed, exitCode, stdout, stderr, timedOut }, in godbolt's shape. */
|
||||
async function buildAndRun(p, workdir) {
|
||||
const dir = fs.mkdtempSync(path.join(workdir, 'p-'));
|
||||
@@ -186,7 +194,8 @@ async function buildAndRun(p, workdir) {
|
||||
const extra = p.args.split(/\s+/).filter(Boolean);
|
||||
const b = await exec('mojo', ['build', ...extra, 'example.mojo', '-o', 'example'], { cwd: dir, timeout: 180000 });
|
||||
if (b.status !== 0 || !fs.existsSync(path.join(dir, 'example'))) {
|
||||
return { compiled: false, buildStderr: app(b.stderr || b.stdout), executed: false, exitCode: null, stdout: '', stderr: '', timedOut: b.timedOut };
|
||||
const buildStderr = app(b.stderr || b.stdout);
|
||||
return { compiled: false, buildStderr, executed: false, exitCode: null, stdout: '', stderr: '', timedOut: b.timedOut, ...(NOT_LINKED.test(buildStderr) ? { notLinked: true } : {}) };
|
||||
}
|
||||
// a trap must not become a core dump on someone's desktop: limit 1 tells the kernel not to pipe it
|
||||
const r = HAVE_PRLIMIT ? await exec('prlimit', ['--core=1:1', './example'], { cwd: dir, input: p.stdin, timeout: 30000 })
|
||||
@@ -300,7 +309,7 @@ const jobs = Math.max(1, Number(opt('jobs', '2')) || 2);
|
||||
const useCache = !flag('no-cache');
|
||||
|
||||
const findings = [];
|
||||
const counts = { programs: programs.length, compiled: 0, rejected: 0, cached: 0, interpreterRan: 0, interpreterDeclined: 0, godboltCompared: 0 };
|
||||
const counts = { programs: programs.length, compiled: 0, rejected: 0, notLinked: 0, cached: 0, interpreterRan: 0, interpreterDeclined: 0, godboltCompared: 0 };
|
||||
let next = 0;
|
||||
async function worker() {
|
||||
while (next < programs.length) {
|
||||
@@ -309,7 +318,8 @@ async function worker() {
|
||||
const file = path.join(cacheDir, `${key}.json`);
|
||||
let r = useCache && fs.existsSync(file) ? readJson(file) : null;
|
||||
if (r) { counts.cached++; for (const k of ['stdout', 'stderr', 'buildStderr']) r[k] = String(r[k] ?? '').replace(/(?:\/[^\s:"']+)?\/example\.mojo/g, '/app/example.mojo'); }
|
||||
else { r = await buildAndRun(p, workdir); if (useCache && !r.timedOut) fs.writeFileSync(file, `${JSON.stringify(r)}\n`); }
|
||||
else { r = await buildAndRun(p, workdir); if (useCache && !r.timedOut && !r.notLinked) fs.writeFileSync(file, `${JSON.stringify(r)}\n`); }
|
||||
if (r.notLinked) { counts.notLinked++; findings.push({ question: 'linker', id: p.id, detail: `not linked, so the compiler's answer is not known: ${firstError(r.buildStderr)}` }); continue; }
|
||||
if (r.compiled) counts.compiled++; else counts.rejected++;
|
||||
findings.push(...judge(p, r));
|
||||
if (p.interp === 'ran') counts.interpreterRan++;
|
||||
@@ -331,7 +341,8 @@ if (flag('json')) console.log(JSON.stringify({ compiler: `Mojo ${version}`, coun
|
||||
else {
|
||||
console.log(`Mojo ${version} on this machine: ${counts.programs} programs (${counts.compiled} compiled, ${counts.rejected} rejected, ${counts.cached} from the cache)`);
|
||||
console.log(`the interpreter ran ${counts.interpreterRan} of them and declined ${counts.interpreterDeclined}; ${counts.godboltCompared} compared with godbolt's stored answer`);
|
||||
for (const q of ['checker', 'interpreter', 'translator', 'godbolt']) {
|
||||
if (counts.notLinked) console.log(`\n${counts.notLinked} program(s) were compiled and could not be linked. That is this machine's C compiler, which mojo build calls to link, not Mojo's answer: under pixi it is the pinned gcc and C library (pixi.toml, docs/ci.md).`);
|
||||
for (const q of ['linker', 'checker', 'interpreter', 'translator', 'godbolt']) {
|
||||
const fs_ = unexpected.filter((f) => f.question === q);
|
||||
if (!fs_.length) continue;
|
||||
console.log(`\n${q}: ${fs_.length}`);
|
||||
|
||||
Reference in new issue
Block a user