all: fix tests for 32-bit architectures
Fix the tests to work on GOARCH=386.
Also add another test suite that tests on GOARCH=386.
Change-Id: I41290998053dc059347adb8af70012dc5cc31811
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/241537
Reviewed-by: Herbie Ong <herbie@google.com>
diff --git a/integration_test.go b/integration_test.go
index 54ad30f..d24d70f 100644
--- a/integration_test.go
+++ b/integration_test.go
@@ -101,7 +101,7 @@
for i := range golangVersions {
goVersion := golangVersions[i]
goLabel := "Go" + goVersion
- runGo := func(label, workDir string, args ...string) {
+ runGo := func(label string, cmd command, args ...string) {
wg.Add(1)
sema <- true
go func() {
@@ -109,19 +109,25 @@
defer func() { <-sema }()
t.Run(goLabel+"/"+label, func(t *testing.T) {
args[0] += goVersion
- command{Dir: workDir}.mustRun(t, args...)
+ cmd.mustRun(t, args...)
})
}()
}
workDir := filepath.Join(goPath, "src", modulePath)
- runGo("Normal", workDir, "go", "test", "-race", "./...")
- runGo("PureGo", workDir, "go", "test", "-race", "-tags", "purego", "./...")
- runGo("Reflect", workDir, "go", "test", "-race", "-tags", "protoreflect", "./...")
+ runGo("Normal", command{Dir: workDir}, "go", "test", "-race", "./...")
+ runGo("PureGo", command{Dir: workDir}, "go", "test", "-race", "-tags", "purego", "./...")
+ runGo("Reflect", command{Dir: workDir}, "go", "test", "-race", "-tags", "protoreflect", "./...")
if goVersion == golangLatest {
- runGo("ProtoLegacy", workDir, "go", "test", "-race", "-tags", "protolegacy", "./...")
- runGo("ProtocGenGo", "cmd/protoc-gen-go/testdata", "go", "test")
- runGo("Conformance", "internal/conformance", "go", "test", "-execute")
+ runGo("ProtoLegacy", command{Dir: workDir}, "go", "test", "-race", "-tags", "protolegacy", "./...")
+ runGo("ProtocGenGo", command{Dir: "cmd/protoc-gen-go/testdata"}, "go", "test")
+ runGo("Conformance", command{Dir: "internal/conformance"}, "go", "test", "-execute")
+
+ // Only run the 32-bit compatability tests for Linux;
+ // avoid Darwin since 10.15 dropped support i386 code execution.
+ if runtime.GOOS == "linux" {
+ runGo("Arch32Bit", command{Dir: workDir, Env: append(os.Environ(), "GOARCH=386")}, "go", "test", "./...")
+ }
}
}
wg.Wait()