From 90607e9056f6ff4cec2447fdd7a8b252d67ffde7 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Tue, 11 Feb 2025 14:58:07 -0800 Subject: 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 --- sdk/sdk_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sdk/sdk_test.go') diff --git a/sdk/sdk_test.go b/sdk/sdk_test.go index b525eb8a3..985641e95 100644 --- a/sdk/sdk_test.go +++ b/sdk/sdk_test.go @@ -350,7 +350,7 @@ func TestSnapshot_EnvConfiguration(t *testing.T) { ) checkZipFile := func(t *testing.T, result *android.TestResult, expected string) { - zipRule := result.ModuleForTests("mysdk", "common_os").Rule("SnapshotZipFiles") + zipRule := result.ModuleForTests(t, "mysdk", "common_os").Rule("SnapshotZipFiles") android.AssertStringEquals(t, "snapshot zip file", expected, zipRule.Output.String()) } -- cgit v1.2.3-59-g8ed1b