2023-11-08 05:30:55 +00:00
|
|
|
# Remove overall test dir (at most one of the two should match) and
|
|
|
|
# remove file extension.
|
|
|
|
test_name=$(echo -n "$test" | sed \
|
2023-08-25 14:20:28 +00:00
|
|
|
-e "s|^tests/unit/[^/]*/data/||" \
|
2023-11-08 05:30:55 +00:00
|
|
|
-e "s|^tests/functional/||" \
|
|
|
|
-e "s|\.sh$||" \
|
|
|
|
)
|
2023-10-05 16:12:18 +00:00
|
|
|
|
2023-11-08 05:30:55 +00:00
|
|
|
TESTS_ENVIRONMENT=(
|
|
|
|
"TEST_NAME=$test_name"
|
|
|
|
'NIX_REMOTE='
|
|
|
|
'PS4=+(${BASH_SOURCE[0]-$0}:$LINENO) '
|
|
|
|
)
|
2022-12-16 01:17:08 +00:00
|
|
|
|
|
|
|
: ${BASH:=/usr/bin/env bash}
|
|
|
|
|
2023-11-08 05:30:55 +00:00
|
|
|
run () {
|
|
|
|
cd "$(dirname $1)" && env "${TESTS_ENVIRONMENT[@]}" $BASH -x -e -u -o pipefail $(basename $1)
|
|
|
|
}
|
|
|
|
|
2022-12-16 01:17:08 +00:00
|
|
|
init_test () {
|
2023-11-08 05:30:55 +00:00
|
|
|
run "$init" 2>/dev/null > /dev/null
|
2022-12-16 01:17:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
run_test_proper () {
|
2023-11-08 05:30:55 +00:00
|
|
|
run "$test"
|
2022-12-16 01:17:08 +00:00
|
|
|
}
|