From 5d7c3f754b6497c190bb8446970102048c4604c0 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Fri, 2 Aug 2024 15:27:53 +0900 Subject: [PATCH] .github/workflows: update wasmbrowsertest to fix timeout issue Updates #1313 --- .github/workflows/test.yml | 2 +- audio/audio_test.go | 9 --------- audio/internal/convert/float32_test.go | 10 ---------- internal/shader/shader_test.go | 8 -------- 4 files changed, 1 insertion(+), 28 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 81ee0f219..2627fbf3c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -44,7 +44,7 @@ jobs: - name: Install wasmbrowsertest run: | - wasmbrowsertest_version=6e494bb3a5ddfe6cccb449250dbdcaa5777b593d + wasmbrowsertest_version=2c08e5b313d11223b7d68e14ec280b00e7341ac3 go install github.com/agnivade/wasmbrowsertest@${wasmbrowsertest_version} mv $(go env GOPATH)/bin/wasmbrowsertest${{ runner.os == 'Windows' && '.exe' || '' }} $(go env GOPATH)/bin/go_js_wasm_exec${{ runner.os == 'Windows' && '.exe' || '' }} go install github.com/agnivade/wasmbrowsertest/cmd/cleanenv@${wasmbrowsertest_version} diff --git a/audio/audio_test.go b/audio/audio_test.go index 7ce175fb9..a238feadc 100644 --- a/audio/audio_test.go +++ b/audio/audio_test.go @@ -17,7 +17,6 @@ package audio_test import ( "bytes" "io" - "os" "runtime" "testing" "time" @@ -36,14 +35,6 @@ func teardown() { context = nil } -func TestMain(m *testing.M) { - code := m.Run() - // 200[ms] should be enough all the players are consumed. - // TODO: This is a dirty hack. Would it be possible to use virtual time? - time.Sleep(200 * time.Millisecond) - os.Exit(code) -} - // Issue #746 func TestGC(t *testing.T) { setup() diff --git a/audio/internal/convert/float32_test.go b/audio/internal/convert/float32_test.go index c2240c922..268459e19 100644 --- a/audio/internal/convert/float32_test.go +++ b/audio/internal/convert/float32_test.go @@ -18,22 +18,12 @@ import ( "bytes" "io" "math/rand" // TODO: Use math/rand/v2 when the minimum supported version becomes Go 1.22. - "os" "testing" - "time" "unsafe" "github.com/hajimehoshi/ebiten/v2/audio/internal/convert" ) -func TestMain(m *testing.M) { - code := m.Run() - // Tests in this package often fails on GitHub Actions due to unfinished goroutines. - // That's mysterious, but to avoid this, sleep for a while before exiting. - time.Sleep(200 * time.Millisecond) - os.Exit(code) -} - func randInt16s(n int) []int16 { r := make([]int16, n) for i := range r { diff --git a/internal/shader/shader_test.go b/internal/shader/shader_test.go index fd182b0a1..954ba099d 100644 --- a/internal/shader/shader_test.go +++ b/internal/shader/shader_test.go @@ -21,7 +21,6 @@ import ( "runtime" "strings" "testing" - "time" "github.com/hajimehoshi/ebiten/v2/internal/shader" "github.com/hajimehoshi/ebiten/v2/internal/shaderir" @@ -30,13 +29,6 @@ import ( "github.com/hajimehoshi/ebiten/v2/internal/shaderir/msl" ) -func TestMain(m *testing.M) { - code := m.Run() - // The Wasm tests on GitHub CI often fail due to some remaining functions. Wait for a while to finish them. - time.Sleep(100 * time.Millisecond) - os.Exit(code) -} - func glslVertexNormalize(str string) string { p := glsl.VertexPrelude(glsl.GLSLVersionDefault) if strings.HasPrefix(str, p) {