diff options
author | 2024-10-09 20:57:00 +0000 | |
---|---|---|
committer | 2024-10-09 20:57:00 +0000 | |
commit | 8b8b83e42f3fd3886a4bfc91c22a7030a82bc03f (patch) | |
tree | a6c102fa67ff8a19e3de877dc33c0609f593d327 | |
parent | 0cba926538b481dc31975dddc9448d0e4d619747 (diff) | |
parent | d1d08abbf9a656e083ce4cb7e93e538e90951019 (diff) |
Merge "Update test for go modules with mutliple variants" into main
-rw-r--r-- | golang/golang_test.go | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/golang/golang_test.go b/golang/golang_test.go index b909f5948..0a4baedb4 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]) + } } |