mirror of
https://github.com/dokku/dokku.git
synced 2025-12-29 00:25:08 +01:00
While I do not agree with _every_ style change, this will force Dokku to have consistent formatting across all shell scripts, which is arguably a Good Thing™. The command used to reprocess everything is: ```shell shfmt -l -bn -ci -i 2 -w . ```
40 lines
709 B
Bash
Executable File
40 lines
709 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
is_number() {
|
|
local NUMBER=$1
|
|
local NUM_RE='^[1-4]+$'
|
|
if [[ $NUMBER =~ $NUM_RE ]]; then
|
|
return 0
|
|
else
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
usage() {
|
|
echo "usage: $0 1|2|3|4"
|
|
exit 0
|
|
}
|
|
|
|
BATCH_NUM="$1"
|
|
is_number "$BATCH_NUM" || usage
|
|
|
|
TESTS=$(find "$(dirname "$0")/../unit" -maxdepth 1 -name "${BATCH_NUM}0*.bats" | sort -n | xargs)
|
|
echo "running the following tests $TESTS"
|
|
|
|
# shellcheck disable=SC2086
|
|
for test in $TESTS; do
|
|
echo $test
|
|
starttest=$(date +%s)
|
|
|
|
bats $test
|
|
RC=$?
|
|
if [[ $RC -ne 0 ]]; then
|
|
echo "exit status: $RC"
|
|
exit $RC
|
|
fi
|
|
|
|
endtest=$(date +%s)
|
|
testruntime=$((endtest - starttest))
|
|
echo "individual runtime: $(date -u -d @${testruntime} +"%T")"
|
|
done
|