mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-17 02:53:51 +08:00
Writing a shell script correctly can be hard even for a skilled programmer. shellcheck is a static analysis tool that helps catch common errors in shell scripts. We now have 36 executable scripts in our repository, for which shellcheck reports 126 errors (calculated like find . -type f -executable -exec bash -c '[ "$(file --brief --mime-type "$1")" == "text/x-shellscript" ]' sh {} \; -exec shellcheck -f gcc --exclude=SC2086 {} \; | cut -d: -f1 | sort | uniq | wc -l). This commit fixes these warnings and adds a GitHub actions workflow that runs shellcheck on all the executable shell scripts in the repository. The warning SC2086: Double quote to prevent globbing and word splitting is disabled globally, because it has little practical consequences, sometimes leads to false positives, and is general is too widespread because people forget to quote.
39 lines
941 B
Bash
Executable File
39 lines
941 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Wrapper around perl prove utility to control running of TAP tests
|
|
#
|
|
# The following control variable is supported:
|
|
#
|
|
# PROVE_TESTS only run TAP tests from this list
|
|
# e.g make provecheck PROVE_TESTS="t/foo.pl t/bar.pl"
|
|
#
|
|
# Note that you can also use regular expressions to run multiple
|
|
# taps tests matching the pattern:
|
|
#
|
|
# e.g make provecheck PROVE_TESTS="t/*chunk*"
|
|
#
|
|
|
|
PROVE_TESTS=${PROVE_TESTS:-}
|
|
PROVE=${PROVE:-prove}
|
|
|
|
# If PROVE_TESTS is specified then run those subset of TAP tests even if
|
|
# TESTS is also specified
|
|
if [ -z "$PROVE_TESTS" ]
|
|
then
|
|
# Exit early if we are running with TESTS=expr
|
|
if [ -n "$TESTS" ]
|
|
then
|
|
exit 0
|
|
fi
|
|
FINAL_TESTS="t/*.pl"
|
|
else
|
|
FINAL_TESTS=$PROVE_TESTS
|
|
fi
|
|
|
|
${PROVE} \
|
|
-I "${SRC_DIR}/src/test/perl" \
|
|
-I "${CM_SRC_DIR}/test/perl" \
|
|
-I "${PG_LIBDIR}/pgxs/src/test/perl" \
|
|
-I "${PG_LIBDIR}/postgresql/pgxs/src/test/perl" \
|
|
$FINAL_TESTS
|