test: make find-suites.sh smarter
This commit is contained in:
parent
62d7fdccf9
commit
f3c79738d4
|
@ -12,15 +12,46 @@ set -euo pipefail
|
||||||
# ensure dir
|
# ensure dir
|
||||||
cd -P -- "$(dirname -- "$0")/.."
|
cd -P -- "$(dirname -- "$0")/.."
|
||||||
|
|
||||||
|
DIR="$1"
|
||||||
|
|
||||||
|
complete_path() {
|
||||||
|
local filename="$1"
|
||||||
|
# Check if path prefix is present
|
||||||
|
if [[ "$filename" != */* ]]; then
|
||||||
|
filename="$DIR/test/$filename"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if suffix is present
|
||||||
|
if [[ "$filename" != *.erl ]]; then
|
||||||
|
filename="$filename.erl"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$filename"
|
||||||
|
}
|
||||||
## EMQX_CT_SUITES or SUITES is useful in ad-hoc runs
|
## EMQX_CT_SUITES or SUITES is useful in ad-hoc runs
|
||||||
EMQX_CT_SUITES="${EMQX_CT_SUITES:-${SUITES:-}}"
|
EMQX_CT_SUITES="${EMQX_CT_SUITES:-${SUITES:-}}"
|
||||||
if [ -n "${EMQX_CT_SUITES:-}" ]; then
|
if [ -n "${EMQX_CT_SUITES:-}" ]; then
|
||||||
echo "${EMQX_CT_SUITES}"
|
OUTPUT=""
|
||||||
|
IFS=',' read -ra FILE_ARRAY <<< "$EMQX_CT_SUITES"
|
||||||
|
for file in "${FILE_ARRAY[@]}"; do
|
||||||
|
path=$(complete_path "$file")
|
||||||
|
if [ ! -f "$path" ]; then
|
||||||
|
echo ''
|
||||||
|
echo "ERROR: '$path' is not a file. Ignored!" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -z "$OUTPUT" ]; then
|
||||||
|
OUTPUT="$path"
|
||||||
|
else
|
||||||
|
OUTPUT="$OUTPUT,$path"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "${OUTPUT}"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TESTDIR="$1/test"
|
TESTDIR="$DIR/test"
|
||||||
INTEGRATION_TESTDIR="$1/integration_test"
|
INTEGRATION_TESTDIR="$DIR/integration_test"
|
||||||
# Get the output of the find command
|
# Get the output of the find command
|
||||||
IFS=$'\n' read -r -d '' -a FILES < <(find "${TESTDIR}" -name "*_SUITE.erl" 2>/dev/null | sort && printf '\0')
|
IFS=$'\n' read -r -d '' -a FILES < <(find "${TESTDIR}" -name "*_SUITE.erl" 2>/dev/null | sort && printf '\0')
|
||||||
if [[ -d "${INTEGRATION_TESTDIR}" ]]; then
|
if [[ -d "${INTEGRATION_TESTDIR}" ]]; then
|
||||||
|
|
Loading…
Reference in New Issue