Files
mgmt/test/test-bashfmt.sh
Johan Bloemberg b34b359860 test: Streamline test suite a little
This change aims to streamline the integrationtest suite and reduce friction when running (parts of) test suites.

Changes:
- add `test-testname` to makefile to easily run one suite
- made skipping tests first class citizen in test.sh (all available testsuites and the reasons they are skipped are now better exposed and discovered)
- suppress some output of gotest unless there is an error
- no longer build binary for examples and gotest suites
- removed .SILENT from makefile as it being applied to only some targets makes it feel weird (I just learned about this option btw, feel free to comment on this change)
- move individual tests out of `test.sh` and into `test-misc.sh`
- introduced the concept of testsuites to `test.sh`
2018-02-15 17:21:49 +01:00

32 lines
693 B
Bash
Executable File

#!/bin/bash
# check for any bash files that aren't properly formatted
# TODO: this is hardly exhaustive
echo running "$0"
set -o errexit
set -o nounset
set -o pipefail
#ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )" # dir!
ROOT=$(dirname "${BASH_SOURCE}")/..
cd "${ROOT}"
. test/util.sh
find_files() {
git ls-files | grep -e '\.sh$' -e '\.bash$' | grep -v 'misc/delta-cpu.sh'
}
bad_files=$(
for i in $(find_files); do
# search for more than one leading space, to ensure we use tabs
if grep -q '^ ' "$i"; then
echo "$i"
fi
done
)
if [[ -n "${bad_files}" ]]; then
fail_test "The following bash files are not properly formatted: ${bad_files}"
fi
echo 'PASS'