Refactor bp2build tests for allowlist v2
Allowlist v2 will change bp2build by automatically disabling rdeps of unconvertible modules. Many bp2build tests create bp2build stub modules without an implementation, This CL changes setup of such tests to also contain a BUILD file with "stub implementations" of equivalent targets, to keep these test targets convertible. To verify this change in-place, this CL removes `bp2build_available: false` from these dependencies. This is a test-only change for bp2build tests. Bug: 285631638 Test: m bp2build Change-Id: I489480cbc4158a416b7abf57c35a6e2bc2ad6173
This commit is contained in:
@@ -13,12 +13,13 @@ import (
|
||||
type PythonLibBp2Build func(ctx android.TopDownMutatorContext)
|
||||
|
||||
type pythonLibBp2BuildTestCase struct {
|
||||
description string
|
||||
filesystem map[string]string
|
||||
blueprint string
|
||||
expectedBazelTargets []testBazelTarget
|
||||
dir string
|
||||
expectedError error
|
||||
description string
|
||||
filesystem map[string]string
|
||||
blueprint string
|
||||
expectedBazelTargets []testBazelTarget
|
||||
dir string
|
||||
expectedError error
|
||||
stubbedBuildDefinitions []string
|
||||
}
|
||||
|
||||
func convertPythonLibTestCaseToBp2build_Host(tc pythonLibBp2BuildTestCase) Bp2buildTestCase {
|
||||
@@ -44,12 +45,13 @@ func convertPythonLibTestCaseToBp2build(tc pythonLibBp2BuildTestCase) Bp2buildTe
|
||||
filesystemCopy[k] = v
|
||||
}
|
||||
return Bp2buildTestCase{
|
||||
Description: tc.description,
|
||||
Filesystem: filesystemCopy,
|
||||
Blueprint: tc.blueprint,
|
||||
ExpectedBazelTargets: bp2BuildTargets,
|
||||
Dir: tc.dir,
|
||||
ExpectedErr: tc.expectedError,
|
||||
Description: tc.description,
|
||||
Filesystem: filesystemCopy,
|
||||
Blueprint: tc.blueprint,
|
||||
ExpectedBazelTargets: bp2BuildTargets,
|
||||
Dir: tc.dir,
|
||||
ExpectedErr: tc.expectedError,
|
||||
StubbedBuildDefinitions: tc.stubbedBuildDefinitions,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,6 +106,7 @@ func TestSimplePythonLib(t *testing.T) {
|
||||
"b/e.py": "",
|
||||
"files/data.txt": "",
|
||||
},
|
||||
stubbedBuildDefinitions: []string{"bar"},
|
||||
blueprint: `%s {
|
||||
name: "foo",
|
||||
srcs: ["**/*.py"],
|
||||
@@ -115,7 +118,6 @@ func TestSimplePythonLib(t *testing.T) {
|
||||
python_library {
|
||||
name: "bar",
|
||||
srcs: ["b/e.py"],
|
||||
bazel_module: { bp2build_available: false },
|
||||
}`,
|
||||
expectedBazelTargets: []testBazelTarget{
|
||||
{
|
||||
|
Reference in New Issue
Block a user