#!/usr/bin/make -f

%:
	dh $@ --builddirectory=debian/_build --buildsystem=golang

override_dh_auto_install:
	dh_auto_install -- --no-binaries

execute_after_dh_auto_build:
	rm -fv $(CURDIR)/debian/_build/src/github.com/go-rod/rod/browser_test.go
	rm -fv $(CURDIR)/debian/_build/src/github.com/go-rod/rod/dev_helpers_test.go
	rm -fv $(CURDIR)/debian/_build/src/github.com/go-rod/rod/element_test.go
	rm -fv $(CURDIR)/debian/_build/src/github.com/go-rod/rod/examples_test.go
	rm -fv $(CURDIR)/debian/_build/src/github.com/go-rod/rod/hijack_test.go
	rm -fv $(CURDIR)/debian/_build/src/github.com/go-rod/rod/input_test.go
	rm -fv $(CURDIR)/debian/_build/src/github.com/go-rod/rod/lib/examples/e2e-testing/calculator_test.go
	rm -fv $(CURDIR)/debian/_build/src/github.com/go-rod/rod/lib/examples/e2e-testing/setup_test.go
	rm -fv $(CURDIR)/debian/_build/src/github.com/go-rod/rod/must_test.go
	rm -fv $(CURDIR)/debian/_build/src/github.com/go-rod/rod/page_eval_test.go
	rm -fv $(CURDIR)/debian/_build/src/github.com/go-rod/rod/page_test.go
	rm -fv $(CURDIR)/debian/_build/src/github.com/go-rod/rod/query_test.go
	rm -fv $(CURDIR)/debian/_build/src/github.com/go-rod/rod/rod_test.go
	rm -fv $(CURDIR)/debian/_build/src/github.com/go-rod/rod/setup_test.go

# panic: can't find a browser binary for your OS, the doc might help
# --- FAIL: TestSlowSend (0.00s)
# panic: You must set GODEBUG="tracebackancestors=N", N should be a big enough integer, such as 1000 [recovered, repanicked]
SKIP="TestBasic|TestManaged|TestUseNode|TestLaunchClient|TestLaunch|TestCrash|TestWebSocketLargePayload|TestDuplicatedConnectErr|ExampleClient"
override_dh_auto_test:
	-dh_auto_test $(DH_BUILD_OPTS) -- -run $(SKIP)
	GODEBUG="tracebackancestors=1000" \
	dh_auto_test $(DH_BUILD_OPTS) -- -skip $(SKIP)
	rm -rfv $(CURDIR)/debian/_build/src/github.com/go-rod/rod/lib/utils/tmp
