Have python_*{,_host} handle arch-variants

Bug: 196081778
Test: TestPython*{,Host}ArchVariance
Test: go test
Test: mixed_{libc,droid}.sh
Change-Id: I89304e58f5bacd61534732bade4ad6bb5f2671c0
This commit is contained in:
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
2021-09-17 20:30:21 +00:00
parent 1b5262bd69
commit 19d399d4c5
5 changed files with 126 additions and 14 deletions

View File

@@ -116,3 +116,37 @@ func TestPythonBinaryHostPy3(t *testing.T) {
},
})
}
func TestPythonBinaryHostArchVariance(t *testing.T) {
runBp2BuildTestCaseSimple(t, bp2buildTestCase{
description: "test arch variants",
moduleTypeUnderTest: "python_binary_host",
moduleTypeUnderTestFactory: python.PythonBinaryHostFactory,
moduleTypeUnderTestBp2BuildMutator: python.PythonBinaryBp2Build,
filesystem: map[string]string{
"dir/arm.py": "",
"dir/x86.py": "",
},
blueprint: `python_binary_host {
name: "foo-arm",
arch: {
arm: {
srcs: ["arm.py"],
},
x86: {
srcs: ["x86.py"],
},
},
}`,
expectedBazelTargets: []string{
`py_binary(
name = "foo-arm",
srcs = select({
"//build/bazel/platforms/arch:arm": ["arm.py"],
"//build/bazel/platforms/arch:x86": ["x86.py"],
"//conditions:default": [],
}),
)`,
},
})
}