Debian Codegraph @

ci/test.sh

raw
1 #!/bin/sh
2 set -eu
3 cd -- "$(dirname "$0")/.."
4
5 (
6 cd ./internal/examples
7 go test "$@" ./...
8 )
9 (
10 cd ./internal/thirdparty
11 go test "$@" ./...
12 )
13
14 (
15 GOARCH=arm64 go test -c -o ./ci/out/websocket-arm64.test "$@" .
16 if [ "$#" -eq 0 ]; then
17 if [ "${CI-}" ]; then
18 sudo apt-get update
19 sudo apt-get install -y qemu-user-static
20 ln -s /usr/bin/qemu-aarch64-static /usr/local/bin/qemu-aarch64
21 fi
22 qemu-aarch64 ./ci/out/websocket-arm64.test -test.run=TestMask
23 fi
24 )
25
26
27 go install github.com/agnivade/wasmbrowsertest@latest
28 go test --race --bench=. --timeout=1h --covermode=atomic --coverprofile=ci/out/coverage.prof --coverpkg=./... "$@" ./...
29 sed -i.bak '/stringer\.go/d' ci/out/coverage.prof
30 sed -i.bak '/nhooyr.io\/websocket\/internal\/test/d' ci/out/coverage.prof
31 sed -i.bak '/examples/d' ci/out/coverage.prof
32
33 # Last line is the total coverage.
34 go tool cover -func ci/out/coverage.prof | tail -n1
35
36 go tool cover -html=ci/out/coverage.prof -o=ci/out/coverage.html