Skip to content

Commit

Permalink
ci: run at least some tests on older Go/LLVM versions
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aykevl committed Oct 29, 2024
1 parent 0edeaf6 commit ab53b42
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ commands:
name: Check Go code formatting
command: make fmt-check lint
- run: make gen-device -j4
# TODO: change this to -skip='TestErrors|TestWasm' with Go 1.20
- run: go test -tags=llvm<<parameters.llvm>> -short -run='TestBuild|TestTest|TestGetList|TestTraceback'
- run: make smoketest XTENSA=0
- save_cache:
key: go-cache-v4-{{ checksum "go.mod" }}-{{ .Environment.CIRCLE_BUILD_NUM }}
Expand All @@ -106,6 +108,7 @@ jobs:
llvm: "15"
# "make lint" fails before go 1.21 because internal/tools/go.mod specifies packages that require go 1.21
fmt-check: false
skip-go-tests: true # Go 1.19 does not support -test.skip
resource_class: large
test-llvm18-go123:
docker:
Expand Down
17 changes: 15 additions & 2 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"reflect"
"regexp"
"runtime"
"slices"
"strings"
"sync"
"testing"
Expand Down Expand Up @@ -517,14 +516,28 @@ func TestWebAssembly(t *testing.T) {
}
}
}
if !slices.Equal(imports, tc.imports) {
if !stringSlicesEqual(imports, tc.imports) {
t.Errorf("import list not as expected!\nexpected: %v\nactual: %v", tc.imports, imports)
}
}
})
}
}

func stringSlicesEqual(s1, s2 []string) bool {
// We can use slices.Equal once we drop support for Go 1.20 (it was added in
// Go 1.21).
if len(s1) != len(s2) {
return false
}
for i, s := range s1 {
if s != s2[i] {
return false
}
}
return true
}

func TestWasmExport(t *testing.T) {
t.Parallel()

Expand Down

0 comments on commit ab53b42

Please sign in to comment.