A gate that does not depend on its machine, on a runner of its own
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:
alexm committed 2026-11-13 06:13:28 -05:00
1 parent 401084bab3
commit b10a5c87a3
31 files changed
+427 -104

No files matched your search

+13 -14
View File
@@ -12,6 +12,7 @@ import { pseudoToMatho } from '../dist/sync/pseudo-to-matho.js';
import { SyncHub } from '../dist/sync/hub.js';
import { checkProperties } from '../dist/engines/pseudo/testing.js';
import { run as runProgram } from '../dist/engines/pseudo/interp.js';
import { within, NO_CLOCK } from './helpers/pace.mjs';
const errors = (src) => studyOf(src).diagnostics.filter((d) => d.severity === 'error').map((d) => d.id);
const run = (src, opts = {}) => {
@@ -130,9 +131,7 @@ test('the positions quantifiers visit are counted: one inside another cannot run
});
test('CHOOSE with a huge K ends at the first step that cannot fit', () => {
const t0 = performance.now();
assert.equal(run('OUTPUT CHOOSE(9007199254740991, 4503599627370495)').error?.kind, 'overflow');
assert.ok(performance.now() - t0 < 2000);
within(2000, 'CHOOSE with a huge K', () => assert.equal(run('OUTPUT CHOOSE(9007199254740991, 4503599627370495)').error?.kind, 'overflow'));
});
test('an error of the engine underneath is a stop of the run, never an exception from it', () => {
@@ -170,20 +169,20 @@ test('the inputs provePseudo tries on a slow routine are held to a time budget',
assert.equal(checkProperties(studyOf('FUNCTION G(N : INTEGER) RETURNS INTEGER\n RETURN N\nENDFUNCTION\n').program.program, 'G', { count: 20, budgetMs: 5000 }).cutShort, undefined);
});
/** Milliseconds `fn` takes. */
const timed = (fn) => { const t0 = performance.now(); fn(); return performance.now() - t0; };
// The limits below are processor time at this machine's pace (tests/helpers/pace.mjs): each was seconds or minutes
// before its fix, and is a small part of its limit after it, on any machine.
test('a long program is studied in time that grows with its length, not its square (B7)', () => {
// each case took seconds when the data flow was solved one statement per pass, over sets of every definition
const declares = Array.from({ length: 1000 }, (_, i) => `DECLARE V${i} : INTEGER <- ${i}\n`).join('');
assert.ok(timed(() => assert.ok(studyOf(declares).ok)) < 2000, '1000 declarations');
assert.ok(timed(() => new SyncHub({ pseudo: '' }).edit('pseudo', declares)) < 4000, 'an edit of 1000 declarations');
within(2000, '1000 declarations', () => assert.ok(studyOf(declares).ok));
within(4000, 'an edit of 1000 declarations', () => new SyncHub({ pseudo: '' }).edit('pseudo', declares));
const nested = `${Array.from({ length: 150 }, (_, i) => `FOR I${i} <- 0 TO 1\n`).join('')}OUTPUT 1\n${Array.from({ length: 150 }, (_, i) => `NEXT I${149 - i}\n`).join('')}`;
assert.ok(timed(() => assert.ok(studyOf(nested).ok)) < 2000, '150 nested FOR loops');
within(2000, '150 nested FOR loops', () => assert.ok(studyOf(nested).ok));
const arms = 2000;
const chain = `DECLARE X : INTEGER <- 1\nIF X == 0 THEN\n OUTPUT X\n${Array.from({ length: arms }, (_, i) => `ELSEIF X == ${i + 1} THEN\n OUTPUT X\n`).join('')}ENDIF\n`;
let st;
assert.ok(timed(() => { st = studyOf(chain); }) < 2000, `an ELSEIF chain of ${arms} arms`);
within(2000, `an ELSEIF chain of ${arms} arms`, () => { st = studyOf(chain); });
// and the answer is the whole one: X has its value in every arm, however far down the chain
assert.deepEqual(st.diagnostics.filter((d) => /unset/.test(d.id)).map((d) => d.line), []);
});
@@ -192,13 +191,13 @@ test('English for a text of many routines takes time that grows with their numbe
const funcs = (n) => Array.from({ length: n }, (_, i) => `FUNCTION F${i}(X : INTEGER) RETURNS INTEGER\n RETURN X + ${i}\nENDFUNCTION\n`).join('');
// the English reader takes 200 routines and phrases at most (docs/limits.md): up to there the text is said in full
let r;
assert.ok(timed(() => { r = pseudoToLingo(funcs(200)); }) < 1000, '200 functions');
within(1000, '200 functions', () => { r = pseudoToLingo(funcs(200)); });
assert.ok(!('unsupported' in r));
// past it the answer says why, and still comes at once: 2,000 functions took a minute when each was held against every other
assert.ok(timed(() => { r = pseudoToLingo(funcs(600)); }) < 3000, '600 functions');
within(3000, '600 functions', () => { r = pseudoToLingo(funcs(600)); });
assert.match(JSON.stringify(r.unsupported), /more than 200 routines and phrases/);
// 2,000 of them are 6,000 lines, past what a pseudocode text is read to (docs/limits.md), and say that instead
assert.ok(timed(() => { r = pseudoToLingo(funcs(2000)); }) < 3000, '2000 functions');
within(3000, '2000 functions', () => { r = pseudoToLingo(funcs(2000)); });
assert.match(JSON.stringify(r.unsupported), /more than 2,000 lines long/);
});
@@ -207,7 +206,7 @@ test('a step costs the same at any call depth: frames that did not change are no
// 390 calls deep, then a loop of 12,000 passes in the deepest call
const src = 'FUNCTION F(N : INTEGER, D : INTEGER) RETURNS INTEGER\n DECLARE T : INTEGER <- 0\n IF D < 390 THEN\n RETURN F(N, D + 1)\n ENDIF\n FOR I <- 0 TO 12000\n T <- T + 1\n NEXT I\n RETURN T\nENDFUNCTION\nOUTPUT F(1, 0)\n';
let tr;
assert.ok(timed(() => { tr = run(src); }) < 1500, '20,000 steps 391 frames deep');
within(1500, '20,000 steps 391 frames deep', () => { tr = run(src); });
assert.equal(tr.error?.kind, 'limit');
const [a, b] = [tr.states[tr.count - 2], tr.states[tr.count - 1]];
assert.equal(a.frames.length, 392);
@@ -269,7 +268,7 @@ test('an ARRAY parameter and an ARRAY RETURN keep their declared lengths, as a s
assert.deepEqual(run(`${first}OUTPUT FIRST([7, 8, 9])`).output, ['10']);
assert.deepEqual(run('FUNCTION MAKE(N : INTEGER) RETURNS ARRAY[3] OF INTEGER\n DECLARE B : ARRAY[N] OF INTEGER\n B[0] <- 1\n RETURN B\nENDFUNCTION\nOUTPUT LENGTH(MAKE(3))').output, ['3']);
// and the prover knows a parameter's lengths, and asks for them where the text does not show them
const pr = provePseudo(studyOf(`${first}DECLARE L : LIST OF INTEGER\nAPPEND(L, 7)\nOUTPUT FIRST(L)`));
const pr = provePseudo(studyOf(`${first}DECLARE L : LIST OF INTEGER\nAPPEND(L, 7)\nOUTPUT FIRST(L)`), NO_CLOCK);
const obs = pr.units.flatMap((u) => u.obligations);
assert.equal(obs.find((o) => o.kind === 'index' && o.line === 2)?.status, 'proved');
assert.notEqual(obs.find((o) => o.kind === 'argument' && o.line === 6)?.status, 'proved');