From 79bc9b90dd891d28c4aed8ed4fd03a9f150a96e9 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Wed, 30 Sep 2026 16:09:09 +0900 Subject: [PATCH] [Tests] make the fast suite pass on macOS - `nvm_get_arch`: the unmocked smartos cases fall through to the host, so only run them on x86_64 - `nvm_get_arch_unofficial`: the chroot checks need x86_64 glibc Linux - `nvm_install_no_progress_bar`: derive the tarball slug and checksum tool instead of assuming linux-x64 and `sha256sum` --- test/fast/Unit tests/nvm_get_arch | 8 ++++---- test/fast/Unit tests/nvm_get_arch_unofficial | 2 ++ test/fast/Unit tests/nvm_install_no_progress_bar | 11 +++++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/test/fast/Unit tests/nvm_get_arch b/test/fast/Unit tests/nvm_get_arch index 42c78ca3..6a862c1f 100755 --- a/test/fast/Unit tests/nvm_get_arch +++ b/test/fast/Unit tests/nvm_get_arch @@ -90,10 +90,10 @@ run_test amd64 smartos x64 no_pkg_info run_test x86 osx x86 run_test amd64 osx x64 -# These smartos cases have no arch-specific uname mock, so nvm_get_os falls -# through to the real host; on Alpine that host is linux and picks up the musl -# suffix, which these non-musl assertions do not expect. Skip them there. -if [ ! -f "/etc/alpine-release" ]; then +# These smartos cases have no arch-specific uname mock, so they fall through to +# the real host: they only hold on an x86_64 host, and not on Alpine, where the +# host picks up the musl suffix these non-musl assertions do not expect. +if [ ! -f "/etc/alpine-release" ] && [ "$(command uname -m)" = 'x86_64' ]; then run_test arm64 smartos x64 run_test armv8l smartos x64 fi diff --git a/test/fast/Unit tests/nvm_get_arch_unofficial b/test/fast/Unit tests/nvm_get_arch_unofficial index 5c7a20e4..cc10bf3c 100755 --- a/test/fast/Unit tests/nvm_get_arch_unofficial +++ b/test/fast/Unit tests/nvm_get_arch_unofficial @@ -63,6 +63,8 @@ setup_chroot() { # test, so skip the chroot checks there and still run the ls-remote checks. if [ -f "/etc/alpine-release" ]; then echo "on Alpine; skipping chroot arch checks (covered by 'nvm_get_arch alpine')" +elif [ "$(command uname -s)" != 'Linux' ] || [ "$(command uname -m)" != 'x86_64' ] || [ ! -e /lib64/ld-linux-x86-64.so.2 ]; then + echo "not on x86_64 glibc Linux; skipping chroot arch checks" else setup_chroot "${CHROOT_WITH_ALPINE}" setup_chroot "${CHROOT_WITHOUT_ALPINE}" diff --git a/test/fast/Unit tests/nvm_install_no_progress_bar b/test/fast/Unit tests/nvm_install_no_progress_bar index ca6501f2..6012960a 100755 --- a/test/fast/Unit tests/nvm_install_no_progress_bar +++ b/test/fast/Unit tests/nvm_install_no_progress_bar @@ -24,10 +24,13 @@ fi cleanup +SLUG="$(nvm_get_download_slug node binary v0.12.18)" +CHECKSUM_LINE="$(nvm_compute_checksum ../../../nvm.sh 2>&1 >/dev/null)" + OUTPUT="$(TERM=dumb 2>&1 nvm install --no-progress v0.12.18)" EXPECTED_OUTPUT="Downloading and installing node v0.12.18... -Downloading https://nodejs.org/dist/v0.12.18/node-v0.12.18-linux-x64.tar.xz... -Computing checksum with sha256sum +Downloading https://nodejs.org/dist/v0.12.18/${SLUG}.tar.xz... +${CHECKSUM_LINE} Checksums matched! Now using node v0.12.18 (npm v2.15.11) Creating default alias: default -> v0.12.18 *" @@ -40,9 +43,9 @@ cleanup OUTPUT="$(TERM=dumb 2>&1 nvm install v0.12.18)" EXPECTED_OUTPUT="Downloading and installing node v0.12.18... -Downloading https://nodejs.org/dist/v0.12.18/node-v0.12.18-linux-x64.tar.xz... +Downloading https://nodejs.org/dist/v0.12.18/${SLUG}.tar.xz... ######################################################################### 100.0% -Computing checksum with sha256sum +${CHECKSUM_LINE} Checksums matched! Now using node v0.12.18 (npm v2.15.11) Creating default alias: default -> v0.12.18 *"