mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 08:03:19 +00:00
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>
30 lines
1.2 KiB
TypeScript
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");
|
|
});
|
|
});
|