Skip to content

Commit bf7f843

Browse files
committed
ci: run at least some tests on older Go/LLVM versions
These should make sure basic functionality is still working. Using the `-short` flag to avoid taking too long to run all tests (and to install all the necessary emulators), and because some targets might not work in older Go/LLVM versions (such as WASI). This does _not_ run tests and checks against expected IR, because LLVM IR changes a lot across versions.
1 parent 0edeaf6 commit bf7f843

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

.circleci/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ commands:
9090
name: Check Go code formatting
9191
command: make fmt-check lint
9292
- run: make gen-device -j4
93+
# Run all normal tests except for:
94+
# - TestErrors which depends on a specific Go version.
95+
# - TestWasmExport, TestWasmExportJS, and TestWasmFuncOf which need
96+
# Node.js to be installed.
97+
- run: go test -tags=llvm<<parameters.llvm>> -short -skip='TestErrors|TestWasm'
9398
- run: make smoketest XTENSA=0
9499
- save_cache:
95100
key: go-cache-v4-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_BUILD_NUM }}

main_test.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import (
1515
"reflect"
1616
"regexp"
1717
"runtime"
18-
"slices"
1918
"strings"
2019
"sync"
2120
"testing"
@@ -517,14 +516,28 @@ func TestWebAssembly(t *testing.T) {
517516
}
518517
}
519518
}
520-
if !slices.Equal(imports, tc.imports) {
519+
if !stringSlicesEqual(imports, tc.imports) {
521520
t.Errorf("import list not as expected!\nexpected: %v\nactual: %v", tc.imports, imports)
522521
}
523522
}
524523
})
525524
}
526525
}
527526

527+
func stringSlicesEqual(s1, s2 []string) bool {
528+
// We can use slices.Equal once we drop support for Go 1.20 (it was added in
529+
// Go 1.21).
530+
if len(s1) != len(s2) {
531+
return false
532+
}
533+
for i, s := range s1 {
534+
if s != s2[i] {
535+
return false
536+
}
537+
}
538+
return true
539+
}
540+
528541
func TestWasmExport(t *testing.T) {
529542
t.Parallel()
530543

0 commit comments

Comments
 (0)