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>
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
import { describe, expect, test } from "vitest";
|
|
import { planSelection } from "./selection.ts";
|
|
|
|
const scenarios = [
|
|
{ id: "java.a.one", title: "One", conditions: ["warm", "cold"] as const },
|
|
{ id: "java.b.two", title: "Two", conditions: ["warm"] as const },
|
|
];
|
|
|
|
describe("eval workload planning", () => {
|
|
test("full and deduplicated subset plans are independent of collected outcomes", () => {
|
|
expect(planSelection(scenarios, {}).expected).toHaveLength(3);
|
|
const plan = planSelection(scenarios, { only: " java.a, java.a.one ", condition: "cold" });
|
|
expect(plan.selected).toEqual([scenarios[0]]);
|
|
expect(plan.expected).toEqual([{ scenario: "java.a.one", title: "One", condition: "cold" }]);
|
|
});
|
|
test.each([
|
|
{ condition: "hot" },
|
|
{ only: "java.a,unknown" },
|
|
{ only: "" },
|
|
{ only: "java.a," },
|
|
{ only: "java.b", condition: "cold" },
|
|
{ only: "java.a,java.b", condition: "cold" },
|
|
{ runs: "0" },
|
|
{ runs: "NaN" },
|
|
{ runs: "Infinity" },
|
|
{ runs: "1.5" },
|
|
{ runs: "9007199254740992" },
|
|
{ warmup: "-1" },
|
|
{ warmup: "Infinity" },
|
|
{ warmup: "0.5" },
|
|
])("rejects invalid selection/counts %j", (args) => {
|
|
expect(() => planSelection(scenarios, args)).toThrow();
|
|
});
|
|
test("rejects zero work", () => {
|
|
expect(() => planSelection([], {})).toThrow(/no compatible/);
|
|
});
|
|
});
|