Skip to content
Myr

[actions] use `node/install` instead of `node/run`

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Jordan Harband · committed by Jordan Harband · parent 179d450 · Browse files · 2 files+32 added−23 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+32 added−23 removed

  • tests:+31 added−21 removed
  • other:+1 added−2 removed

2 files+32 added−23 removed

modified:.github/workflows/tests.yml+1 added-2 removed
modified:test/fast/Unit tests/nvm_get_arch+31 added-21 removed
1#!/bin/sh23# Save the PATH as it was when the test started to restore it when it4# finishes5ORIG_PATH=$PATH5ORIG_PATH="${PATH}"67cleanup() {8 # Restore the PATH as it was when the test started9 export PATH=ORIG_PATH9 export PATH="${ORIG_PATH}"10}1112die () { cleanup; echo "$@" ; exit 1; }1314\. ../../../nvm.sh1516# Directory where mocked binaries used by nvm_get_arch for each OS/arch are17# located18MOCKS_DIR=`pwd`/../../mocks18MOCKS_DIR="$(pwd)/../../mocks"19# Sets the PATH for these tests to include the symlinks to the mocked20# binaries21export PATH=.:${PATH}21export PATH=".:${PATH}"2223# Setups mock binaries for a given OS and arch that mimic24# the output of the real binaries used by nvm_get_arch to guess25# the architecture of a given system.26setup_mock_arch() {27 local OS=$128 local ARCH=$229 local OPT=$327 local OS28 OS=$129 local ARCH30 ARCH=$231 local OPT32 OPT=$33331 if [ "_$OS" = "_solaris" ] || [ "_$OS" = "_smartos" ]; then34 if [ "_${OS}" = '_solaris' ] || [ "_${OS}" = '_smartos' ]; then35 ln -sf "${MOCKS_DIR}/isainfo_${ARCH}" ./isainfo36 if [ "_$OPT" != "_no_pkg_info" ]; then37 ln -sf "${MOCKS_DIR}/pkg_info_${ARCH}" ./pkg_info38 else
5 unmodified lines
44}4546# Cleans up the setup done by setup_mock_arch.47cleanup_mock_arch() {45 local OS=$146 local ARCH=$248 local OS49 OS=$150 local ARCH51 ARCH=$25248 if [ "_$OS" = "_solaris" ] || [ "_$OS" = "_smartos" ]; then53 if [ "_${OS}" = '_solaris' ] || [ "_${OS}" = '_smartos' ]; then54 rm -f ./isainfo55 rm -f ./pkg_info56 fi57
3 unmodified lines
61# Runs nvm_get_arch for architecture $ARCH and OS $OS, and compares the62# expected output $EXPECTED_OUTPUT with the actual output. Does nothing63# and exits cleanly if they match, dies otherwise.64run_test() {60 local ARCH=$161 local OS=$262 local EXPECTED_OUTPUT=$363 local OPT=$465 local ARCH66 ARCH=$167 local OS68 OS=$269 local EXPECTED_OUTPUT70 EXPECTED_OUTPUT=$371 local OPT72 OPT=$47365 setup_mock_arch $OS $ARCH $OPT66 local OUTPUT="$(nvm_get_arch)"67 cleanup_mock_arch $OS $ARCH68 [ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] ||69 die "nvm_get_arch for OS \"$OS\" and arch \"$ARCH\" with OPT \"$OPT\" did70 not return \"$EXPECTED_OUTPUT\"; got \"$OUTPUT\""74 setup_mock_arch "${OS}" "${ARCH}" "${OPT}"75 local OUTPUT76 OUTPUT="$(nvm_get_arch)"77 cleanup_mock_arch "${OS}" "${ARCH}"78 [ "_${OUTPUT}" = "_${EXPECTED_OUTPUT}" ] ||79 die "nvm_get_arch for OS \"${OS}\" and arch \"${ARCH}\" with OPT \"${OPT}\" did80 not return \"${EXPECTED_OUTPUT}\"; got \"${OUTPUT}\""81}8283run_test x86 smartos x8684run_test x86 smartos x86 no_pkg_info
11 unmodified lines