From 8a2b5e3251e1733e1aded99f00df17ed5a94cf61 Mon Sep 17 00:00:00 2001 From: "Deavon M. McCaffery" Date: Tue, 14 Jan 2020 03:23:33 +0000 Subject: [PATCH] fix(sh): use correct args for dotnet-install (#46) * resolve an issue with the `--channel` argument in `dotnet-install` * resolve an issue with the `--version` argument in `dotnet-install` * add tests for `dotnet-install` and apply to macos build in circle-ci Closes: #45 --- .circleci/config.yml | 3 +++ src/sh/scripts/dotnet-install | 4 ++-- test.sh | 6 ++++++ test/sh/scripts/dotnet-install.test.sh | 13 +++++++++++++ 4 files changed, 24 insertions(+), 2 deletions(-) create mode 100755 test.sh create mode 100755 test/sh/scripts/dotnet-install.test.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 01ac32b..56b1fd2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,6 +6,9 @@ jobs: xcode: "11.2.1" steps: - checkout + - run: + name: test + command: ./test.sh - run: name: install-bash command: ./install.sh bash | tee log.txt && bash -lc "git sha" diff --git a/src/sh/scripts/dotnet-install b/src/sh/scripts/dotnet-install index 85b8fa2..ce1d791 100755 --- a/src/sh/scripts/dotnet-install +++ b/src/sh/scripts/dotnet-install @@ -72,11 +72,11 @@ __am_prompt_dotnet_install() { __am_prompt_safe_exec chmod +x "$DOTNET_INSTALL_SH" for DOTNET_VERSION in $DOTNET_VERSIONS; do - __am_prompt_safe_exec "$DOTNET_INSTALL_SH" __version $DOTNET_VERSION + __am_prompt_safe_exec "$DOTNET_INSTALL_SH" --version $DOTNET_VERSION done for DOTNET_CHANNEL in $DOTNET_CHANNELS; do - __am_prompt_safe_exec "$DOTNET_INSTALL_SH" __channel $DOTNET_CHANNEL + __am_prompt_safe_exec "$DOTNET_INSTALL_SH" --channel $DOTNET_CHANNEL done mkdir -p /usr/local/share 1>/dev/null 2>&1 diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..acfdedf --- /dev/null +++ b/test.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env sh + +set -eu + +# run the tests with a dummy terminal +TERM=dumb find ./test/sh/scripts -name '*.test.sh' -exec {} \; diff --git a/test/sh/scripts/dotnet-install.test.sh b/test/sh/scripts/dotnet-install.test.sh new file mode 100755 index 0000000..726fe6a --- /dev/null +++ b/test/sh/scripts/dotnet-install.test.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env sh + +set -eu + +echo 'test default install' +./src/sh/scripts/dotnet-install + +echo 'test channel install' +./src/sh/scripts/dotnet-install --channel lts + +echo 'test version install' +./src/sh/scripts/dotnet-install --version latest +