summaryrefslogtreecommitdiff
path: root/golang
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2025-02-11 14:58:07 -0800
committer Colin Cross <ccross@android.com> 2025-02-12 10:36:48 -0800
commit90607e9056f6ff4cec2447fdd7a8b252d67ffde7 (patch)
treed4e244bc76e8e13a8438bcd921fd9003bce46730 /golang
parentd8db8faba62a3cb77f75294e96deda9e53c15786 (diff)
Don't panic in ModuleForTests and friends
Panicking in ModuleForTests and similar test helper functions was a mistake. Go's test runner stops running tests as soon as any test panics, which means debugging multiple tests panicking requires rerunning all the tests after fixing each panic to find the next one. Pass the *testing.T into ModuleForTests and friends so that it can call t.Fatalf instead. Test: all soong tests pass Change-Id: I5d0f2424eaf04fb795079e6d1e4b9469d8c7033c
Diffstat (limited to 'golang')
-rw-r--r--golang/golang_test.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/golang/golang_test.go b/golang/golang_test.go
index d555d144c..89a8761a5 100644
--- a/golang/golang_test.go
+++ b/golang/golang_test.go
@@ -45,7 +45,7 @@ func TestGolang(t *testing.T) {
}),
).RunTestWithBp(t, bp)
- bin := result.ModuleForTests("gobin", result.Config.BuildOSTarget.String())
+ bin := result.ModuleForTests(t, "gobin", result.Config.BuildOSTarget.String())
expected := "^out/host/" + result.Config.PrebuiltOS() + "/bin/go/gobin/?[^/]*/obj/gobin$"
actual := android.PathsRelativeToTop(bin.OutputFiles(result.TestContext, t, ""))