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).
41 lines
1.7 KiB
JavaScript
41 lines
1.7 KiB
JavaScript
// SPDX-FileCopyrightText: 2026 Scientific Computing Studio, LLC
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
// Every exercise file is checked here, so adding one is safe.
|
|
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { EXERCISES } from '../dist/exercises/index.js';
|
|
import template from '../dist/exercises/_template.js';
|
|
import { Workspace } from '../dist/common/workspace.js';
|
|
import { PROBLEMS, problemById, workForProblem } from '../dist/common/problems.js';
|
|
|
|
|
|
test('exercise ids are unique, URL-safe, and the template is not registered', () => {
|
|
const ids = EXERCISES.map((e) => e.id);
|
|
assert.equal(new Set(ids).size, ids.length);
|
|
for (const id of ids) assert.match(id, /^[a-z0-9]+(-[a-z0-9]+)*$/, id);
|
|
assert.ok(!ids.includes(template.id));
|
|
});
|
|
|
|
test('every exercise with an expected answer produces it', () => {
|
|
for (const p of PROBLEMS) {
|
|
if (!p.expect) continue;
|
|
const st = workForProblem(p);
|
|
if (st.sources.pseudo) st.lang = 'pseudo';
|
|
const s = new Workspace(st);
|
|
const tr = s.trace();
|
|
assert.ok(tr && !tr.error, `${p.id}: ${s.runError || tr?.error?.message}`);
|
|
const last = tr.output.at(-1);
|
|
assert.ok(last.endsWith(` returned ${p.expect}`), `${p.id}: expected …returned ${p.expect}, got ${last}`);
|
|
}
|
|
});
|
|
|
|
test('the template itself is a valid exercise', () => {
|
|
const s = new Workspace(workForProblem({ ...template, lang: 'pseudo' }));
|
|
const tr = s.trace();
|
|
assert.ok(tr && !tr.error, s.runError || tr?.error?.message);
|
|
assert.ok(tr.output.at(-1).endsWith(`returned ${template.expect}`));
|
|
s.proofBudgetMs = Infinity; // the counted budgets' answer, the same on every machine
|
|
assert.equal(s.proof().report.counts.open + s.proof().report.counts.broken, 0);
|
|
});
|
|
|