





















@@ -565,8 +565,8 @@ class MacosSmoke {
565565await this.phases.phase(name, timeoutSeconds, fn);
566566}
567567568-private remainingPhaseTimeoutMs(): number | undefined {
569-return this.phases.remainingTimeoutMs();
568+private remainingPhaseTimeoutMs(fallbackMs?: number): number | undefined {
569+return this.phases.remainingTimeoutMs(fallbackMs);
570570}
571571572572private async phaseReturns(
@@ -653,6 +653,7 @@ exec node "$entry" ${argv}`,
653653run("prlctl", ["exec", this.options.vmName, "/usr/bin/stat", "-f", "%Su", "/dev/console"], {
654654check: false,
655655quiet: true,
656+timeoutMs: this.remainingPhaseTimeoutMs(30_000),
656657})
657658.stdout.trim()
658659.replaceAll("\r", "")
@@ -671,6 +672,7 @@ exec node "$entry" ${argv}`,
671672{
672673check: false,
673674quiet: true,
675+timeoutMs: this.remainingPhaseTimeoutMs(30_000),
674676},
675677).stdout.replaceAll("\r", "");
676678for (const line of users.split("\n")) {
@@ -700,7 +702,7 @@ exec node "$entry" ${argv}`,
700702`/Users/${user}`,
701703"NFSHomeDirectory",
702704],
703-{ check: false, quiet: true },
705+{ check: false, quiet: true, timeoutMs: this.remainingPhaseTimeoutMs(30_000) },
704706).stdout.replaceAll("\r", "");
705707const match = /^NFSHomeDirectory:\s+(.+)$/m.exec(output);
706708return match?.[1]?.trim() || `/Users/${user}`;
@@ -713,7 +715,7 @@ exec node "$entry" ${argv}`,
713715const result = run(
714716"prlctl",
715717["snapshot-switch", this.options.vmName, "--id", this.snapshot.id, "--skip-resume"],
716-{ check: false, quiet: true, timeoutMs: 360_000 },
718+{ check: false, quiet: true, timeoutMs: this.remainingPhaseTimeoutMs(360_000) },
717719);
718720this.log(result.stdout);
719721this.log(result.stderr);
@@ -725,10 +727,17 @@ exec node "$entry" ${argv}`,
725727const status = run("prlctl", ["status", this.options.vmName], {
726728check: false,
727729quiet: true,
730+timeoutMs: this.remainingPhaseTimeoutMs(60_000),
728731}).stdout;
729732if (status.includes(" running") || status.includes(" suspended")) {
730-run("prlctl", ["stop", this.options.vmName, "--kill"], { check: false, quiet: true });
731-waitForVmStatus(this.options.vmName, "stopped", 360);
733+run("prlctl", ["stop", this.options.vmName, "--kill"], {
734+check: false,
735+quiet: true,
736+timeoutMs: this.remainingPhaseTimeoutMs(120_000),
737+});
738+waitForVmStatus(this.options.vmName, "stopped", 360, {
739+probeTimeoutMs: () => this.remainingPhaseTimeoutMs(30_000),
740+});
732741}
733742run("sleep", ["3"], { quiet: true });
734743}
@@ -738,15 +747,23 @@ exec node "$entry" ${argv}`,
738747const status = run("prlctl", ["status", this.options.vmName], {
739748check: false,
740749quiet: true,
741-timeoutMs: 60_000,
750+timeoutMs: this.remainingPhaseTimeoutMs(60_000),
742751}).stdout;
743752if (this.snapshot.state === "poweroff" || status.includes(" stopped")) {
744-waitForVmStatus(this.options.vmName, "stopped", 360);
753+waitForVmStatus(this.options.vmName, "stopped", 360, {
754+probeTimeoutMs: () => this.remainingPhaseTimeoutMs(30_000),
755+});
745756say(`Start restored poweroff snapshot ${this.snapshot.name}`);
746-run("prlctl", ["start", this.options.vmName], { quiet: true });
757+run("prlctl", ["start", this.options.vmName], {
758+quiet: true,
759+timeoutMs: this.remainingPhaseTimeoutMs(120_000),
760+});
747761} else if (status.includes(" suspended")) {
748762say(`Resume restored snapshot ${this.snapshot.name}`);
749-run("prlctl", ["start", this.options.vmName], { quiet: true });
763+run("prlctl", ["start", this.options.vmName], {
764+quiet: true,
765+timeoutMs: this.remainingPhaseTimeoutMs(120_000),
766+});
750767}
751768this.waitForCurrentUser();
752769}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。