mirror of
https://github.com/headroomlabs-ai/headroom.git
synced 2026-11-22 13:29:19 +08:00
fix(ci): preserve rustup installer dispatch basename
This commit is contained in:
@@ -42,8 +42,10 @@ case "$target" in
|
||||
s390x-unknown-linux-gnu) checksum=df1762614062280a326ac988019ed1f8ceebeafa5fac95164a7201ff10e31d4b ;;
|
||||
esac
|
||||
|
||||
installer=$(mktemp)
|
||||
trap 'rm -f -- "$installer"' EXIT
|
||||
temporary=$(mktemp -d)
|
||||
trap 'rm -rf -- "$temporary"' EXIT
|
||||
# rustup dispatches installer/proxy mode by argv[0], so retain this basename.
|
||||
installer="$temporary/rustup-init"
|
||||
curl --proto '=https' --proto-redir '=https' --tlsv1.2 -fsSL \
|
||||
"https://static.rust-lang.org/rustup/archive/$version/$target/rustup-init" \
|
||||
--output "$installer"
|
||||
|
||||
@@ -25,6 +25,7 @@ class RustupBootstrapTests(unittest.TestCase):
|
||||
PROBE_KERNEL="x86_64",
|
||||
PROBE_NEON="neon",
|
||||
PROBE_ARGS=str(self.root / "args"),
|
||||
PROBE_INSTALL_NAME=str(self.root / "installer-name"),
|
||||
)
|
||||
self.stub("dpkg", 'printf "%s\\n" "$PROBE_ARCH"\n[ -n "$PROBE_ARCH" ]')
|
||||
self.stub("uname", 'printf "%s\\n" "$PROBE_KERNEL"')
|
||||
@@ -46,6 +47,7 @@ while [ "$#" -gt 0 ]; do
|
||||
done
|
||||
cat > "$out" <<'INSTALLER'
|
||||
#!/bin/sh
|
||||
printf '%s' "${0##*/}" > "$PROBE_INSTALL_NAME"
|
||||
printf 'executed\\n' >> "$PROBE_TRACE"
|
||||
printf '%s\\n' "$@" > "$PROBE_ARGS"
|
||||
INSTALLER
|
||||
@@ -129,6 +131,13 @@ INSTALLER
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
self.assertEqual(Path(self.env["PROBE_ARGS"]).read_text().splitlines(), args)
|
||||
|
||||
def test_binary_keeps_rustup_init_dispatch_name(self):
|
||||
# rustup-init selects installer/proxy mode from argv[0], before options.
|
||||
self.allow_fixture_checksum()
|
||||
result = self.run_bootstrap("-y")
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
self.assertEqual(Path(self.env["PROBE_INSTALL_NAME"]).read_text(), "rustup-init")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user