From a32b4b6ac54a02a8fe9a7cb62861e54473ba5eb0 Mon Sep 17 00:00:00 2001 From: Ysopwnable <161784452+N0zoM1z0@users.noreply.github.com> Date: Wed, 14 Oct 2026 18:42:33 +0800 Subject: [PATCH] test(ci): correct Rizin readiness and Hopper launcher fixtures (#3299) Correct two independently reproduced CI fixture preconditions: close the real Rizin child's stdin before its readiness frame, and provide scoped Linux loader evidence for the Hopper doctor shell fixture. Preserve original timeouts, rejection checks, path spelling, launch prevention and cleanup. Current-head CI passed, including both complete reverse-tools mutation passes and 1,273 unique portable test files (14,521 passed, 126 skipped, zero failures). Each issue retains its own branch/commit; the validated integration tree includes the Hopper fix from #3410. That duplicate PR can close after the same code is verified on main. Fixes #3295 Fixes #3406 Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com> --- .../cli/doctorHopperDiscovery.test.ts | 30 +++++++++++++++++-- .../RizinDebugSessionCoverage.part2.test.ts | 3 +- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/tests/boundary/cli/doctorHopperDiscovery.test.ts b/tests/boundary/cli/doctorHopperDiscovery.test.ts index a637f73914..0e7fdeacb9 100644 --- a/tests/boundary/cli/doctorHopperDiscovery.test.ts +++ b/tests/boundary/cli/doctorHopperDiscovery.test.ts @@ -1,5 +1,5 @@ -import { access, chmod, mkdir, writeFile } from "node:fs/promises"; -import { join } from "node:path"; +import { access, chmod, mkdir, readFile, writeFile } from "node:fs/promises"; +import { delimiter, join } from "node:path"; import { expect } from "vitest"; @@ -18,11 +18,35 @@ cliTest.skipIf(!["darwin", "linux"].includes(process.platform))( '#!/bin/sh\nprintf launched > "$REA_HOPPER_TEST_MARKER"\nexit 99\n', ); await chmod(launcher, 0o700); + const loaderMarker = join(home, "loader-checked-launcher"); + if (process.platform === "linux") { + // A shell fixture needs controlled loader diagnostics on Linux. This + // checks discovery and path preservation, not actual Hopper compatibility. + const loader = join(home, "bin", "ldd"); + await writeFile( + loader, + [ + "#!/bin/sh", + 'test "$#" -eq 1 || exit 87', + 'test "$1" = "$HOPPER_LAUNCHER_PATH" || exit 88', + 'printf "%s" "$1" > "$REA_HOPPER_LDD_TEST_MARKER"', + 'printf "%s\\n" "libc.so.6 => /fixture/libc.so.6 (0x1)"', + "", + ].join("\n"), + ); + await chmod(loader, 0o700); + } const result = await cli.run({ arguments: ["doctor", "--provider", "hopper", "--json"], cwd: home, environment: { + ...(process.platform === "linux" + ? { + PATH: [join(home, "bin"), process.env.PATH ?? ""].join(delimiter), + REA_HOPPER_LDD_TEST_MARKER: loaderMarker, + } + : {}), HOME: home, USERPROFILE: home, HOPPER_LAUNCHER_PATH: launcher, @@ -55,5 +79,7 @@ cliTest.skipIf(!["darwin", "linux"].includes(process.platform))( await expect(access(launchMarker)).rejects.toMatchObject({ code: "ENOENT", }); + if (process.platform === "linux") + expect(await readFile(loaderMarker, "utf8")).toBe(launcher); }, ); diff --git a/tests/boundary/providers/RizinDebugSessionCoverage.part2.test.ts b/tests/boundary/providers/RizinDebugSessionCoverage.part2.test.ts index 13b6c6dcf1..ba63901845 100644 --- a/tests/boundary/providers/RizinDebugSessionCoverage.part2.test.ts +++ b/tests/boundary/providers/RizinDebugSessionCoverage.part2.test.ts @@ -19,7 +19,8 @@ it.skipIf(process.platform === "win32")( "stops the session when the provider closes its stdin pipe", async () => { const provider = await makeProvider( - 'printf "\\000"; exec 0<&-; while :; do :; done', + // Readiness must guarantee that the child's stdin is already closed. + 'exec 0<&-; printf "\\000"; while :; do :; done', "#!/bin/sh", ); const { manager, sessionId } = await start(provider, {