From c60dd805ad3a0091cf869d2afcdc468c773df4c3 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Wed, 17 Mar 2021 23:01:06 +0000 Subject: [PATCH] Fix hole in python testing code that ignored a broken test The test running code would only check errors if there were any reported. That ignored the "module with duplicate runfile path" test which was not reporting the expected error. This change corrects that mistake, and then fixes the test which had started to fail. It is possible that the failing test highlights a bug in the python code but if so that will need to be fixed in a follow up bug. Bug: 183046274 Test: m nothing Change-Id: I961b15a452725e7b15ba9d21b4a4a672ba3d004a --- python/python_test.go | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/python/python_test.go b/python/python_test.go index 5c4efa763..14d78b2b6 100644 --- a/python/python_test.go +++ b/python/python_test.go @@ -207,14 +207,26 @@ var ( "lib1", ], } + + python_binary_host { + name: "bin", + pkg_path: "e/", + srcs: [ + "bin.py", + ], + libs: [ + "lib2", + ], + } `, ), "dir/c/file1.py": nil, "dir/file1.py": nil, + "dir/bin.py": nil, }, errors: []string{ - fmt.Sprintf(dupRunfileErrTemplate, "dir/Android.bp:9:6", - "lib2", "PY3", "a/b/c/file1.py", "lib2", "dir/file1.py", + fmt.Sprintf(dupRunfileErrTemplate, "dir/Android.bp:20:6", + "bin", "PY3", "a/b/c/file1.py", "bin", "dir/file1.py", "lib1", "dir/c/file1.py"), }, }, @@ -339,7 +351,7 @@ func TestPythonModule(t *testing.T) { _, testErrs := ctx.ParseBlueprintsFiles(bpFile) android.FailIfErrored(t, testErrs) _, actErrs := ctx.PrepareBuildActions(config) - if len(actErrs) > 0 { + if len(actErrs) > 0 || len(d.errors) > 0 { testErrs = append(testErrs, expectErrors(t, actErrs, d.errors)...) } else { for _, e := range d.expectedBinaries {