Add unit_test test option in sh_test_host

This change allows sh_test_host to be included
in host-unit-tests suite when test option `unit_test` is set to true.

Bug: 183209767
Test: m host-unit-tests
Change-Id: I5b441d5f49468cb681eb414dade8a1309c6e810a
This commit is contained in:
Dan Shi
2021-05-24 12:04:54 -07:00
parent 18cf19745e
commit b40deac018
2 changed files with 19 additions and 0 deletions

View File

@@ -104,6 +104,12 @@ type shBinaryProperties struct {
Recovery_available *bool
}
// Test option struct.
type TestOptions struct {
// If the test is a hostside(no device required) unittest that shall be run during presubmit check.
Unit_test *bool
}
type TestProperties struct {
// list of compatibility suites (for example "cts", "vts") that the module should be
// installed into.
@@ -143,6 +149,9 @@ type TestProperties struct {
// list of device library modules that should be installed alongside the test.
// Only available for host sh_test modules.
Data_device_libs []string `android:"path,arch_variant"`
// Test options.
Test_options TestOptions
}
type ShBinary struct {
@@ -440,6 +449,9 @@ func (s *ShTest) AndroidMkEntries() []android.AndroidMkEntries {
dir := strings.TrimSuffix(s.dataModules[relPath].String(), relPath)
entries.AddStrings("LOCAL_TEST_DATA", dir+":"+relPath)
}
if Bool(s.testProperties.Test_options.Unit_test) {
entries.SetBool("LOCAL_IS_UNIT_TEST", true)
}
},
},
}}