Debian Codegraph @

.github/scripts/bsd_tests.sh

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`. -e
2
3 # SPDX-License-Identifier: Apache-2.0
4 # SPDX-FileCopyrightText: 2025 The Ebitengine Authors
5
6 # BSD tests run within QEMU on Ubuntu.
7 # vmactions/*-vm only supports a single "step" where it
8 # brings down the VM at the end of the step, so all
9 # the commands to run need to be put into this single block.
10
11 echoscip-shell system . . echo. "Running tests on $(unamescip-shell system . . uname. -a) at $PWD"
12
13 PATH=$PATH:/usr/local/go/bin/
14
15 # verify Go is available
16 goscip-shell system . . go. version
17
18 echoscip-shell system . . echo. "=> go build"
19 goscip-shell system . . go. build -v ./...
20 # Compile without optimization to check potential stack overflow.
21 # The option '-gcflags=all=-N -l' is often used at Visual Studio Code.
22 # See also https://go.googlesource.com/vscode-go/+/HEAD/docs/debugging.md#launch and the issue hajimehoshi/ebiten#2120.
23 goscip-shell system . . go. build "-gcflags=all=-N -l" -v ./...
24
25 # Check cross-compiling Windows binaries.
26 envscip-shell system . . env. GOOS=windows GOARCH=386 go build -v ./...
27 envscip-shell system . . env. GOOS=windows GOARCH=amd64 go build -v ./...
28 envscip-shell system . . env. GOOS=windows GOARCH=arm64 go build -v ./...
29
30 # Check cross-compiling macOS binaries.
31 envscip-shell system . . env. GOOS=darwin GOARCH=amd64 go build -v ./...
32 envscip-shell system . . env. GOOS=darwin GOARCH=arm64 go build -v ./...
33
34 # Check cross-compiling Linux binaries.
35 envscip-shell system . . env. GOOS=linux GOARCH=amd64 go build -v ./...
36 envscip-shell system . . env. GOOS=linux GOARCH=arm64 go build -v ./...
37
38 # Check cross-compiling FreeBSD binaries.
39 envscip-shell system . . env. GOOS=freebsd GOARCH=amd64 go build -gcflags="github.com/ebitengine/purego/internal/fakecgo=-std" -v ./...
40 envscip-shell system . . env. GOOS=freebsd GOARCH=arm64 go build -gcflags="github.com/ebitengine/purego/internal/fakecgo=-std" -v ./...
41
42 # Check cross-compiling NetBSD binaries.
43 envscip-shell system . . env. GOOS=netbsd GOARCH=amd64 go build -v ./...
44 envscip-shell system . . env. GOOS=netbsd GOARCH=arm64 go build -v ./...
45
46 echoscip-shell system . . echo. "=> go build (plugin)"
47 # Make sure that plugin buildmode works since we save the R15 register (#254)
48 goscip-shell system . . go. build -buildmode=plugin ./examples/libc
49
50 echoscip-shell system . . echo. "=> go mod vendor"
51 mkdirscip-shell system . . mkdir. /tmp/vendoringscip-shell filesystem . . `/tmp/vendoring`.
52 cd /tmp/vendoringscip-shell filesystem . . `/tmp/vendoring`.
53 goscip-shell system . . go. mod init foo
54 echoscip-shell system . . echo. 'package main' > main.go
55 echoscip-shell system . . echo. 'import (' >> main.go
56 echoscip-shell system . . echo. ' _ "github.com/ebitengine/purego"' >> main.go
57 echoscip-shell system . . echo. ')' >> main.go
58 echoscip-shell system . . echo. 'func main() {}' >> main.go
59 goscip-shell system . . go. mod edit -replace github.com/ebitengine/purego=$GITHUB_WORKSPACE
60 goscip-shell system . . go. mod tidy
61 goscip-shell system . . go. mod vendor
62 goscip-shell system . . go. build -v .
63
64 cd $GITHUB_WORKSPACE
65 echoscip-shell system . . echo. "=> go test CGO_ENABLED=0"
66 envscip-shell system . . env. CGO_ENABLED=0 go test -gcflags="github.com/ebitengine/purego/internal/fakecgo=-std" -shuffle=on -v -count=10 ./...
67
68 echoscip-shell system . . echo. "=> go test CGO_ENABLED=1"
69 envscip-shell system . . env. CGO_ENABLED=1 go test -shuffle=on -v -count=10 ./...
70
71 echoscip-shell system . . echo. "=> go test CGO_ENABLED=0 w/o optimization"
72 envscip-shell system . . env. CGO_ENABLED=0 go test "-gcflags=all=-N -l -std" -v ./...
73
74 echoscip-shell system . . echo. "=> go test CGO_ENABLED=1 w/o optimization"
75 envscip-shell system . . env. CGO_ENABLED=1 go test "-gcflags=all=-N -l" -v ./...
76
77 if [scip-shell system . . `[`. -z "$(goscip-shell system . . go. version | grepscip-shell system . . grep. '^1.1')" ]; then
78 echoscip-shell system . . echo. "=> go test race"
79 goscip-shell system . . go. test -race -shuffle=on -v -count=10 ./...
80 fi