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 --- python/python_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'python') diff --git a/python/python_test.go b/python/python_test.go index 0e97626d6..5f971cdd1 100644 --- a/python/python_test.go +++ b/python/python_test.go @@ -313,7 +313,7 @@ func TestInvalidTestOnlyTargets(t *testing.T) { } func expectModule(t *testing.T, ctx *android.TestContext, name, variant, expectedSrcsZip string, expectedPyRunfiles []string) { - module := ctx.ModuleForTests(name, variant) + module := ctx.ModuleForTests(t, name, variant) base, baseOk := module.Module().(*PythonLibraryModule) if !baseOk { -- cgit v1.2.3-59-g8ed1b