summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Cole Faust <colefaust@google.com> 2024-10-04 15:29:20 -0700
committer Cole Faust <colefaust@google.com> 2024-10-04 15:29:20 -0700
commitd1d08abbf9a656e083ce4cb7e93e538e90951019 (patch)
tree324214ba0163f1e9f5ad7b19fed870ed58fdff58
parent13e719c089d4e867f3d06d70f2ad93c283ce1081 (diff)
Update test for go modules with mutliple variants
Go modules now generate files into a variant-specific subfolder. Since that subfolder depends on the host os/arch, don't explicitly check its value, but instead allow anything there. Bug: 369916167 Test: m --no-skip-soong-tests Change-Id: I37e395c866d34f596f0936b720b89c8f9615dcf8
-rw-r--r--golang/golang_test.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/golang/golang_test.go b/golang/golang_test.go
index b51214402..9c5b809c1 100644
--- a/golang/golang_test.go
+++ b/golang/golang_test.go
@@ -16,9 +16,10 @@ package golang
import (
"android/soong/android"
- "github.com/google/blueprint/bootstrap"
- "path/filepath"
+ "regexp"
"testing"
+
+ "github.com/google/blueprint/bootstrap"
)
func TestGolang(t *testing.T) {
@@ -46,6 +47,12 @@ func TestGolang(t *testing.T) {
bin := result.ModuleForTests("gobin", result.Config.BuildOSTarget.String())
- expected := filepath.Join("out/soong/host", result.Config.PrebuiltOS(), "bin/go/gobin/obj/gobin")
- android.AssertPathsRelativeToTopEquals(t, "output files", []string{expected}, bin.OutputFiles(result.TestContext, t, ""))
+ expected := "^out/soong/host/" + result.Config.PrebuiltOS() + "/bin/go/gobin/?[^/]*/obj/gobin$"
+ actual := android.PathsRelativeToTop(bin.OutputFiles(result.TestContext, t, ""))
+ if len(actual) != 1 {
+ t.Fatalf("Expected 1 output file, got %v", actual)
+ }
+ if match, err := regexp.Match(expected, []byte(actual[0])); err != nil || !match {
+ t.Fatalf("Expected output file to match %q, but got %q", expected, actual[0])
+ }
}