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
This commit is contained in:
Paul Duffin 2021-03-17 23:01:06 +00:00
parent 45a4971808
commit c60dd805ad

View file

@ -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 {