Files
openidea/evals/lib/cli.test.ts
T
Mr0Bread d080ca28f8 fix(bench): require selected workloads and finite metrics (#4488)
Benchmark verdicts could pass with selected workloads or required metrics missing, empty or non-finite, and pnpm perf:rust could accept stale or partial criterion results. Selections and counts are now validated before any work starts, every selected workload must report finite values for its required metrics, and Rust results are collected only for the selected packages from fresh, well-formed criterion artifacts, against a list of the benchmarks each package owns.

Co-authored-by: Mr0Bread <55754540+Mr0Bread@users.noreply.github.com>
2026-11-19 19:34:55 +08:00

30 lines
1.2 KiB
TypeScript

import { spawnSync } from "node:child_process";
import { resolve } from "node:path";
import { describe, expect, test } from "vitest";
const runner = resolve(import.meta.dirname, "../run.ts");
describe("eval CLI preflight (no app builds)", () => {
test.each([
[["--condition", "hot"], /--condition must be warm or cold/],
[["--only", "java.app,unknown"], /no scenario matches unknown/],
[["--only", "java.app,"], /empty selector/],
[["--only", "java.app.usages", "--condition", "cold"], /no compatible scenario/],
[["--runs", "0"], /--runs/],
[["--runs", "Infinity"], /--runs/],
[["--runs", "1.5"], /--runs/],
[["--warmup", "NaN"], /--warmup/],
[["--warmup=-1"], /--warmup/],
] as const)("rejects %j before build/start", (args, message) => {
const result = spawnSync(process.execPath, [runner, ...args], {
encoding: "utf8",
timeout: 15_000,
env: { ...process.env, PATH: "", OPENIDEA_SERVER: "/nonexistent/eval-preflight-server" },
});
expect(result.error).toBeUndefined();
expect(result.status).not.toBe(0);
expect(result.stderr).toMatch(message);
expect(result.stdout).not.toContain("Building openidea-server");
});
});