Give cc_test rule information to determine the test types

There are three types of tests, deviceless tests, device-driven tests
and host-driven device tests. But currently we don't have information
to get the type of a test and can't generate test targets on desired
types.

Test: b test //platform_testing/tests/example/native:hello_world_test
Test: b test //packages/modules/adb:adbd_test
Bug: 296312548
Change-Id: I3f022ef769636d508e055477623a4d1a6a1d9044
This commit is contained in:
yike
2023-08-17 01:03:37 +00:00
parent b0e1035417
commit fdca7fe03b
3 changed files with 47 additions and 0 deletions

View File

@@ -135,6 +135,10 @@ cc_test_library {
"//build/bazel/platforms/os:linux_musl": ["linux.cpp"],
"//conditions:default": [],
})`,
"runs_on": `[
"host_without_device",
"device",
]`,
},
},
},
@@ -158,6 +162,10 @@ cc_test {
"gtest": "False",
"local_includes": `["."]`,
"srcs": `["test.cpp"]`,
"runs_on": `[
"host_without_device",
"device",
]`,
},
},
},
@@ -184,6 +192,10 @@ cc_test {
"deps": `[
":libgtest_main",
":libgtest",
]`,
"runs_on": `[
"host_without_device",
"device",
]`,
},
},
@@ -215,6 +227,7 @@ cc_test {
":libgtest_main",
":libgtest",
]`,
"runs_on": `["device"]`,
},
},
},
@@ -244,6 +257,7 @@ cc_test {
":libgtest_main",
":libgtest",
]`,
"runs_on": `["device"]`,
},
},
},
@@ -280,6 +294,7 @@ cc_test {
"template_test_config": `"test_config_template.xml"`,
"deps": `[":libgtest_isolated_main"]`,
"dynamic_deps": `[":liblog"]`,
"runs_on": `["device"]`,
},
},
},
@@ -306,6 +321,7 @@ cc_test {
":libgtest",
":libgtest_main",
]`,
"runs_on": `["device"]`,
},
},
},
@@ -331,6 +347,7 @@ cc_test {
"target_compatible_with": `["//build/bazel/platforms/os:android"]`,
"deps": `[":libgtest_isolated_main"]`,
"dynamic_deps": `[":liblog"]`,
"runs_on": `["device"]`,
},
},
},
@@ -361,12 +378,14 @@ cc_test {
]`,
"gtest": "True",
"target_compatible_with": `["//build/bazel/platforms/os:android"]`,
"runs_on": `["device"]`,
},
},
{"cc_test", "mytest_with_no_gtest", AttrNameToString{
"local_includes": `["."]`,
"gtest": "False",
"target_compatible_with": `["//build/bazel/platforms/os:android"]`,
"runs_on": `["device"]`,
},
},
},