add test targets to Makefile

This commit is contained in:
Tomas Kral 2016-08-09 13:48:30 +02:00
parent 3dd7689364
commit 6099428364
3 changed files with 34 additions and 0 deletions

View File

@ -22,3 +22,9 @@ binary-cross:
clean:
./script/make.sh clean
test-unit:
./script/make.sh test-unit
test-cmd:
./script/make.sh test-cmd

3
script/test-cmd Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
./script/test/cmd/tests.sh

25
script/test-unit Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
set -e
find_dirs() {
(
find . -not \( \
\( \
-path './vendor/*' \
\) -prune \
\) -name '*_test.go' -print0 | xargs -0n1 dirname | sed 's|^\./||' | sort -u
)
}
TEST_FLAGS="-tags experimental -cover -coverprofile=cover.out"
if [ -z "$TEST_DIRS" ]; then
TEST_DIRS=$(find_dirs '*_test.go')
fi
TESTS_FAILED=()
set +e
for dir in $TEST_DIRS; do
go test ${TEST_FLAGS} "./${dir}"
done