Support dynamic config file for cc_test.
Bug: 280028705 Test: local build Change-Id: Ife445f6a7642bf08651ed7a9501a60950f05f9c4
This commit is contained in:
@@ -238,7 +238,8 @@ func TestCcTest_TestConfigAndroidTestXML(t *testing.T) {
|
|||||||
runCcTestTestCase(t, ccTestBp2buildTestCase{
|
runCcTestTestCase(t, ccTestBp2buildTestCase{
|
||||||
description: "cc test that defaults to test config AndroidTest.xml",
|
description: "cc test that defaults to test config AndroidTest.xml",
|
||||||
filesystem: map[string]string{
|
filesystem: map[string]string{
|
||||||
"AndroidTest.xml": "",
|
"AndroidTest.xml": "",
|
||||||
|
"DynamicConfig.xml": "",
|
||||||
},
|
},
|
||||||
blueprint: `
|
blueprint: `
|
||||||
cc_test {
|
cc_test {
|
||||||
@@ -253,6 +254,7 @@ cc_test {
|
|||||||
"srcs": `["test.cpp"]`,
|
"srcs": `["test.cpp"]`,
|
||||||
"target_compatible_with": `["//build/bazel/platforms/os:android"]`,
|
"target_compatible_with": `["//build/bazel/platforms/os:android"]`,
|
||||||
"test_config": `"AndroidTest.xml"`,
|
"test_config": `"AndroidTest.xml"`,
|
||||||
|
"dynamic_config": `"DynamicConfig.xml"`,
|
||||||
"deps": `[
|
"deps": `[
|
||||||
":libgtest_main",
|
":libgtest_main",
|
||||||
":libgtest",
|
":libgtest",
|
||||||
|
@@ -39,7 +39,8 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type TestConfigAttributes struct {
|
type TestConfigAttributes struct {
|
||||||
Test_config *bazel.Label
|
Test_config *bazel.Label
|
||||||
|
Dynamic_config *bazel.Label
|
||||||
|
|
||||||
Auto_generate_test_config *bool
|
Auto_generate_test_config *bool
|
||||||
Template_test_config *bazel.Label
|
Template_test_config *bazel.Label
|
||||||
@@ -58,6 +59,11 @@ func GetTestConfigAttributes(
|
|||||||
templateInstallBase *string) TestConfigAttributes {
|
templateInstallBase *string) TestConfigAttributes {
|
||||||
|
|
||||||
attrs := TestConfigAttributes{}
|
attrs := TestConfigAttributes{}
|
||||||
|
|
||||||
|
dynamicConfig := "DynamicConfig.xml"
|
||||||
|
c, _ := android.BazelStringOrLabelFromProp(ctx, &dynamicConfig)
|
||||||
|
attrs.Dynamic_config = c.Value
|
||||||
|
|
||||||
attrs.Test_config = GetTestConfig(ctx, testConfig)
|
attrs.Test_config = GetTestConfig(ctx, testConfig)
|
||||||
// do not generate a test config if
|
// do not generate a test config if
|
||||||
// 1) test config already found
|
// 1) test config already found
|
||||||
|
Reference in New Issue
Block a user