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`
42 lines
979 B
Bash
Executable File
42 lines
979 B
Bash
Executable File
#!/bin/bash
|
|
# check that our examples still build, even if we don't run them here
|
|
|
|
# shellcheck disable=SC1091
|
|
. test/util.sh
|
|
|
|
echo running "$0"
|
|
|
|
ROOT=$(dirname "${BASH_SOURCE}")/..
|
|
cd "${ROOT}"
|
|
|
|
failures=''
|
|
|
|
buildout='test-examples.out'
|
|
# make symlink to outside of package
|
|
linkto="`pwd`/examples/lib/"
|
|
tmpdir="`$mktemp --tmpdir -d tmp.XXX`" # get a dir outside of the main package
|
|
cd "$tmpdir"
|
|
ln -s "$linkto" # symlink outside of dir
|
|
cd `basename "$linkto"`
|
|
|
|
# loop through individual *.go files in working dir
|
|
for file in `find . -maxdepth 3 -type f -name '*.go'`; do
|
|
#echo "running test on: $file"
|
|
run-test go build -i -o "$buildout" "$file" || fail_test "could not build: $file"
|
|
done
|
|
rm "$buildout" || true # clean up build mess
|
|
|
|
cd - >/dev/null # back to tmp dir
|
|
rm `basename "$linkto"`
|
|
cd ..
|
|
rmdir "$tmpdir" # cleanup
|
|
|
|
if [[ -n "$failures" ]]; then
|
|
echo 'FAIL'
|
|
echo "The following tests (in: ${linkto}) have failed:"
|
|
echo -e "$failures"
|
|
echo
|
|
exit 1
|
|
fi
|
|
echo 'PASS'
|