Skip to content

Commit 9b3eb3f

Browse files
aykevldeadprogram
authored andcommitted
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 1dcccf8 commit 9b3eb3f

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

.circleci/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ commands:
9090
name: Check Go code formatting
9191
command: make fmt-check lint
9292
- run: make gen-device -j4
93+
# TODO: change this to -skip='TestErrors|TestWasm' with Go 1.20
94+
- run: go test -tags=llvm<<parameters.llvm>> -short -run='TestBuild|TestTest|TestGetList|TestTraceback'
9395
- run: make smoketest XTENSA=0
9496
- save_cache:
9597
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"
@@ -521,14 +520,28 @@ func TestWebAssembly(t *testing.T) {
521520
}
522521
}
523522
}
524-
if !slices.Equal(imports, tc.imports) {
523+
if !stringSlicesEqual(imports, tc.imports) {
525524
t.Errorf("import list not as expected!\nexpected: %v\nactual: %v", tc.imports, imports)
526525
}
527526
}
528527
})
529528
}
530529
}
531530

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

0 commit comments

Comments
 (0)