mirror of
https://github.com/NixOS/nix
synced 2025-06-25 06:31:14 +02:00
Start getting all shell scripts passing shellcheck
Like with the formatter, we are blacklisting most files by default. Do a few files to get us started, and get a sense of what this looks like.
This commit is contained in:
parent
1d5d748fe4
commit
567265ae67
6 changed files with 274 additions and 26 deletions
|
@ -1,19 +1,24 @@
|
|||
# shellcheck shell=bash
|
||||
|
||||
# Remove overall test dir (at most one of the two should match) and
|
||||
# remove file extension.
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
test_name=$(echo -n "$test" | sed \
|
||||
-e "s|^tests/unit/[^/]*/data/||" \
|
||||
-e "s|^tests/functional/||" \
|
||||
-e "s|\.sh$||" \
|
||||
)
|
||||
|
||||
# shellcheck disable=SC2016
|
||||
TESTS_ENVIRONMENT=(
|
||||
"TEST_NAME=$test_name"
|
||||
'NIX_REMOTE='
|
||||
'PS4=+(${BASH_SOURCE[0]-$0}:$LINENO) '
|
||||
)
|
||||
|
||||
: ${BASH:=/usr/bin/env bash}
|
||||
read -r -a bash <<< "${BASH:-/usr/bin/env bash}"
|
||||
|
||||
run () {
|
||||
cd "$(dirname $1)" && env "${TESTS_ENVIRONMENT[@]}" $BASH -x -e -u -o pipefail $(basename $1)
|
||||
cd "$(dirname "$1")" && env "${TESTS_ENVIRONMENT[@]}" "${bash[@]}" -x -e -u -o pipefail "$(basename "$1")"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue