| 1 |
#!/usr/bin/make -f |
| 2 |
|
| 3 |
%: |
| 4 |
dh $@ --builddirectory=debian/.build/upstream --buildsystem=golang |
| 5 |
|
| 6 |
override_dh_auto_test: |
| 7 |
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) |
| 8 |
# The tests for the main `failpoint` package are fragile and fail in the |
| 9 |
# Debian build environment, so skip them and test the sub-packages instead. |
| 10 |
# |
| 11 |
# Environment variables for testing: |
| 12 |
# - GO111MODULE=off: Prevent Go from trying to download dependencies. |
| 13 |
# - GOPATH: Help Go find the existing package sources. |
| 14 |
# - GOCACHE: Set a writable build cache for restricted build environments. |
| 15 |
# - FAILPOINT_ENABLE=true: Required by toolexec to enable failpoint injection. |
| 16 |
set -e; \ |
| 17 |
export GOPATH=$(CURDIR)/debian/.build/upstream; \ |
| 18 |
export GOCACHE=$(CURDIR)/debian/.build/go-cache; \ |
| 19 |
export GO111MODULE=off; \ |
| 20 |
export FAILPOINT_ENABLE=true; \ |
| 21 |
\ |
| 22 |
echo "Cleaning failpoint-toolexec cache..."; \ |
| 23 |
rm -rf /tmp/failpoint-rewrite; \ |
| 24 |
\ |
| 25 |
cd debian/.build/upstream && \ |
| 26 |
for pkg in \ |
| 27 |
github.com/pingcap/failpoint/code \ |
| 28 |
github.com/pingcap/failpoint/examples/injectcall \ |
| 29 |
; do \ |
| 30 |
echo "Testing $$pkg..."; \ |
| 31 |
go test -vet=off -v -p 1 -toolexec=$(CURDIR)/debian/.build/upstream/bin/failpoint-toolexec $$pkg; \ |
| 32 |
done |
| 33 |
endif |