From d93257b50fae81272cbd2da28ba24d03647c2c99 Mon Sep 17 00:00:00 2001 From: N0zoM1z0 <1705004398@qq.com> Date: Tue, 14 Jul 2026 21:23:46 +0000 Subject: [PATCH] test(hopper): verify alternate Linux launcher path --- .github/workflows/real-hopper-linux.yml | 2 +- scripts/verify-real-hopper-linux.mjs | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/real-hopper-linux.yml b/.github/workflows/real-hopper-linux.yml index 32f4ad9d9..286677e04 100644 --- a/.github/workflows/real-hopper-linux.yml +++ b/.github/workflows/real-hopper-linux.yml @@ -57,7 +57,7 @@ jobs: npm install --global --prefix "${prefix}" "./${tarball}" echo "REA_VERIFY_SERVER_COMMAND=${prefix}/bin/rea" >> "${GITHUB_ENV}" echo 'REA_VERIFY_SERVER_ARGS_JSON=["mcp"]' >> "${GITHUB_ENV}" - - name: Verify two binaries through the in-process bridge + - name: Verify two binaries through an alternate launcher symlink env: HOPPER_TARGET_PATH: ${{ inputs.first_target }} HOPPER_SECOND_TARGET_PATH: ${{ inputs.second_target }} diff --git a/scripts/verify-real-hopper-linux.mjs b/scripts/verify-real-hopper-linux.mjs index 5dd5c7451..76cc02643 100644 --- a/scripts/verify-real-hopper-linux.mjs +++ b/scripts/verify-real-hopper-linux.mjs @@ -1,5 +1,7 @@ -import { access } from "node:fs/promises"; +import { access, mkdtemp, rm, symlink } from "node:fs/promises"; import { execFile } from "node:child_process"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; import { promisify } from "node:util"; const execFileAsync = promisify(execFile); @@ -14,5 +16,14 @@ await access("/usr/bin/python3"); const linked = await execFileAsync("ldd", [launcher]); if (`${linked.stdout}\n${linked.stderr}`.includes("not found")) throw new Error("Hopper has unresolved shared-library dependencies"); -process.env.HOPPER_LAUNCHER_PATH = launcher; -await import("./verify-real-hopper.mjs"); +const alternateDirectory = await mkdtemp( + join(tmpdir(), "rea-real-hopper-launcher-"), +); +const alternateLauncher = join(alternateDirectory, "Hopper-alternate"); +try { + await symlink(launcher, alternateLauncher); + process.env.HOPPER_LAUNCHER_PATH = alternateLauncher; + await import("./verify-real-hopper.mjs"); +} finally { + await rm(alternateDirectory, { recursive: true, force: true }); +}