From acfe91ec3e33b65b4e6d8d266b66161596ac757d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=AD?= Date: Sat, 7 Mar 2020 20:50:59 +0000 Subject: [PATCH] CI: add wine on Linux for the Windows e2e test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Installing it on Debian was enough, with the only wrinkle that propagating -race won't work when we're cross-compiling, since cross-compilation disables CGo by default. For now, just skip the test in that edge case. If we want to use the race detector on Windows in the future, we need to get a Windows CI builder somehow. Tested on my fork; see https://builds.sr.ht/~mvdan/job/164899. Signed-off-by: Daniel Martí --- .builds/linux.yml | 1 + cmd/gogio/windows_test.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/.builds/linux.yml b/.builds/linux.yml index c4999802..abb69483 100644 --- a/.builds/linux.yml +++ b/.builds/linux.yml @@ -20,6 +20,7 @@ packages: - scrot - sway - grim + - wine sources: - https://git.sr.ht/~eliasnaur/gio environment: diff --git a/cmd/gogio/windows_test.go b/cmd/gogio/windows_test.go index b659765e..e4bd81ab 100644 --- a/cmd/gogio/windows_test.go +++ b/cmd/gogio/windows_test.go @@ -11,6 +11,7 @@ import ( "os" "os/exec" "path/filepath" + "runtime" "sync" "time" @@ -39,6 +40,10 @@ func (d *WineTestDriver) Start(path string) { bin := filepath.Join(d.tempDir("gio-endtoend-windows"), "red.exe") flags := []string{"build", "-o=" + bin} if raceEnabled { + if runtime.GOOS != "windows" { + // cross-compilation disables CGo, which breaks -race. + d.Skipf("can't cross-compile -race for Windows; skipping") + } flags = append(flags, "-race") } flags = append(flags, path)