diff options
| author | Sebastian Holmin <sebastian.holmin@mullvad.net> | 2024-01-25 11:44:41 +0100 |
|---|---|---|
| committer | Markus Pettersson <markus.pettersson@mullvad.net> | 2024-02-02 11:04:48 +0100 |
| commit | b6e0545e1b5ae2fbcb6655bd4d28739cf9f943d6 (patch) | |
| tree | 40644f1100793192c23fd7491978dc26ad1fef97 /test | |
| parent | 1438e369b10bbf50900d9e380329001513de2c1e (diff) | |
| download | mullvadvpn-b6e0545e1b5ae2fbcb6655bd4d28739cf9f943d6.tar.xz mullvadvpn-b6e0545e1b5ae2fbcb6655bd4d28739cf9f943d6.zip | |
Fix `shellcheck` lints of our various bash scripts
The following lints have been fixed:
SC2046,SC2086,SC2068,SC2148,SC2007,SC2004,SC2006,
SC2164,SC2145,SC1091,SC2034,SC2155.
Diffstat (limited to 'test')
| -rwxr-xr-x | test/ci-runtests.sh | 38 | ||||
| -rw-r--r-- | test/scripts/ssh-setup.sh | 6 |
2 files changed, 24 insertions, 20 deletions
diff --git a/test/ci-runtests.sh b/test/ci-runtests.sh index 7a19995b0c..80f70a9f09 100755 --- a/test/ci-runtests.sh +++ b/test/ci-runtests.sh @@ -59,13 +59,13 @@ echo "$NEW_APP_VERSION" > "$SCRIPT_DIR/.ci-logs/last-version.log" function nice_time { SECONDS=0 - if $@; then + if "$@"; then result=0 else result=$? fi s=$SECONDS - echo "\"$@\" completed in $(($s/60))m:$(($s%60))s" + echo "\"$*\" completed in $((s/60))m:$((s%60))s" return $result } @@ -82,7 +82,7 @@ function is_dev_version { function get_app_filename { local version=$1 local os=$2 - if is_dev_version $version; then + if is_dev_version "$version"; then # only save 6 chars of the hash local commit="${BASH_REMATCH[3]}" version="${BASH_REMATCH[1]}${commit}" @@ -116,19 +116,20 @@ function download_app_package { local os=$2 local package_repo="" - if is_dev_version $version; then + if is_dev_version "$version"; then package_repo="${BUILD_DEV_REPOSITORY}" else package_repo="${BUILD_RELEASE_REPOSITORY}" fi - local filename=$(get_app_filename $version $os) + local filename + filename=$(get_app_filename "$version" "$os") local url="${package_repo}/$version/$filename" mkdir -p "$PACKAGES_DIR" if [[ ! -f "$PACKAGES_DIR/$filename" ]]; then echo "Downloading build for $version ($os) from $url" - curl -sf -o "$PACKAGES_DIR/$filename" $url + curl -sf -o "$PACKAGES_DIR/$filename" "$url" else echo "Found build for $version ($os)" fi @@ -137,7 +138,7 @@ function download_app_package { function get_e2e_filename { local version=$1 local os=$2 - if is_dev_version $version; then + if is_dev_version "$version"; then # only save 6 chars of the hash local commit="${BASH_REMATCH[3]}" version="${BASH_REMATCH[1]}${commit}" @@ -164,19 +165,20 @@ function download_e2e_executable { local os=$2 local package_repo="" - if is_dev_version $version; then + if is_dev_version "$version"; then package_repo="${BUILD_DEV_REPOSITORY}" else package_repo="${BUILD_RELEASE_REPOSITORY}" fi - local filename=$(get_e2e_filename $version $os) + local filename + filename=$(get_e2e_filename "$version" "$os") local url="${package_repo}/$version/additional-files/$filename" - mkdir -p $PACKAGES_DIR + mkdir -p "$PACKAGES_DIR" if [[ ! -f "$PACKAGES_DIR/$filename" ]]; then echo "Downloading e2e executable for $version ($os) from $url" - curl -sf -o "$PACKAGES_DIR/$filename" $url + curl -sf -o "$PACKAGES_DIR/$filename" "$url" else echo "Found e2e executable for $version ($os)" fi @@ -185,8 +187,10 @@ function download_e2e_executable { function run_tests_for_os { local os=$1 - local prev_filename=$(get_app_filename $OLD_APP_VERSION $os) - local cur_filename=$(get_app_filename $NEW_APP_VERSION $os) + local prev_filename + prev_filename=$(get_app_filename "$OLD_APP_VERSION" "$os") + local cur_filename + cur_filename=$(get_app_filename "$NEW_APP_VERSION" "$os") rm -f "$SCRIPT_DIR/.ci-logs/${os}_report" @@ -203,10 +207,10 @@ echo "**********************************" echo "* Downloading app packages" echo "**********************************" -mkdir -p $PACKAGES_DIR -nice_time download_app_package $OLD_APP_VERSION $TEST_OS -nice_time download_app_package $NEW_APP_VERSION $TEST_OS -nice_time download_e2e_executable $NEW_APP_VERSION $TEST_OS +mkdir -p "$PACKAGES_DIR" +nice_time download_app_package "$OLD_APP_VERSION" "$TEST_OS" +nice_time download_app_package "$NEW_APP_VERSION" "$TEST_OS" +nice_time download_e2e_executable "$NEW_APP_VERSION" "$TEST_OS" echo "**********************************" echo "* Building test runner" diff --git a/test/scripts/ssh-setup.sh b/test/scripts/ssh-setup.sh index 9ab1d895f5..a3809e0230 100644 --- a/test/scripts/ssh-setup.sh +++ b/test/scripts/ssh-setup.sh @@ -3,7 +3,7 @@ set -eu SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -cd $SCRIPT_DIR +cd "$SCRIPT_DIR" RUNNER_DIR="$1" CURRENT_APP="$2" @@ -14,11 +14,11 @@ UI_RUNNER="$4" echo "Copying test-runner to $RUNNER_DIR" -mkdir -p $RUNNER_DIR +mkdir -p "$RUNNER_DIR" for file in test-runner $CURRENT_APP $PREVIOUS_APP $UI_RUNNER openvpn.ca.crt; do echo "Moving $file to $RUNNER_DIR" - cp -f "$SCRIPT_DIR/$file" $RUNNER_DIR + cp -f "$SCRIPT_DIR/$file" "$RUNNER_DIR" done chown -R root "$RUNNER_DIR/" |
