Skip to content

Commit c50f068

Browse files
committed
fix(test-suite): make pause profiles self-contained
Pause test profiles (paused-host-contracts, paused-gateway-contracts) now handle their own pause/unpause wrapping inside runProfile instead of relying on runStandardSuite to set up contract state. This makes standalone `fhevm-cli test paused-gateway-contracts` work correctly instead of silently running against an unpaused stack.
1 parent 4ca8e55 commit c50f068

File tree

1 file changed

+38
-35
lines changed
  • test-suite/fhevm/src/commands

1 file changed

+38
-35
lines changed

test-suite/fhevm/src/commands/test.ts

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ const timedLabel = (label: string, started: number) =>
4343

4444
const TEST_PROFILE_NAMES = [...Object.keys(TEST_GREP), "ciphertext-drift", "coprocessor-db-state-revert", "heavy", "light", "standard"].sort();
4545
const ZERO_TESTS_RE = /\b0 passing\b/;
46-
const STANDARD_PAUSE_PROFILES = ["paused-host-contracts", "paused-gateway-contracts"] as const;
47-
const STANDARD_PAUSE_PROFILE_SET = new Set<string>(STANDARD_PAUSE_PROFILES);
46+
const PAUSE_PROFILE_SCOPE: Record<string, string> = {
47+
"paused-host-contracts": "host",
48+
"paused-gateway-contracts": "gateway",
49+
};
4850
const TEST_PROFILE_DESCRIPTIONS: Partial<Record<(typeof TEST_PROFILE_NAMES)[number], string>> = {
4951
light: "Run the lightweight smoke suite.",
5052
standard: "Run the default CI suite for the active topology.",
@@ -563,24 +565,39 @@ export const test = async (testName: string | undefined, options: TestOptions) =
563565
if (!filter) {
564566
throw new PreflightError(`Unknown test profile ${name}. Valid: ${TEST_PROFILE_NAMES.join(", ")}`);
565567
}
566-
const shouldParallel = options.parallel ?? TEST_PARALLEL[name];
567-
console.log(`[test] ${name} (${options.network})`);
568-
const started = Date.now();
569-
const command = [
570-
"./run-tests.sh",
571-
options.verbose ? "-v" : "",
572-
shouldParallel ? "--parallel" : "",
573-
"-n",
574-
shellEscape(options.network),
575-
"-g",
576-
shellEscape(filter),
577-
]
578-
.filter(Boolean)
579-
.join(" ");
580-
return runLogged(name, started, async () => {
581-
const result = await runWithHeartbeat(buildTestContainerArgs(["sh", "-lc", command]), `test ${name}`);
582-
assertMatchedTests(result.stdout + result.stderr, `test ${name}`);
583-
});
568+
569+
const runGrep = async () => {
570+
const shouldParallel = options.parallel ?? TEST_PARALLEL[name];
571+
console.log(`[test] ${name} (${options.network})`);
572+
const started = Date.now();
573+
const command = [
574+
"./run-tests.sh",
575+
options.verbose ? "-v" : "",
576+
shouldParallel ? "--parallel" : "",
577+
"-n",
578+
shellEscape(options.network),
579+
"-g",
580+
shellEscape(filter),
581+
]
582+
.filter(Boolean)
583+
.join(" ");
584+
return runLogged(name, started, async () => {
585+
const result = await runWithHeartbeat(buildTestContainerArgs(["sh", "-lc", command]), `test ${name}`);
586+
assertMatchedTests(result.stdout + result.stderr, `test ${name}`);
587+
});
588+
};
589+
590+
const pauseScope = PAUSE_PROFILE_SCOPE[name];
591+
if (pauseScope) {
592+
await pause(pauseScope);
593+
try {
594+
return await runGrep();
595+
} finally {
596+
await unpause(pauseScope).catch(() => undefined);
597+
}
598+
}
599+
600+
return runGrep();
584601
};
585602

586603
const runStandardSuite = async () => {
@@ -593,21 +610,7 @@ export const test = async (testName: string | undefined, options: TestOptions) =
593610
console.log(`[test] standard (${options.network})`);
594611
const started = Date.now();
595612
await runLogged("standard", started, async () => {
596-
await pause("host");
597-
try {
598-
await runProfile("paused-host-contracts");
599-
} finally {
600-
await unpause("host").catch(() => undefined);
601-
}
602-
603-
await pause("gateway");
604-
try {
605-
await runProfile("paused-gateway-contracts");
606-
} finally {
607-
await unpause("gateway").catch(() => undefined);
608-
}
609-
610-
for (const profile of STANDARD_TEST_PROFILES.filter((item) => !STANDARD_PAUSE_PROFILE_SET.has(item))) {
613+
for (const profile of STANDARD_TEST_PROFILES) {
611614
if (profile === "ciphertext-drift" && state.scenario.topology.count < 2) {
612615
continue;
613616
}

0 commit comments

Comments
 (0)