Test changing default of cc_test_host
Switching all cc_test_host to unit_tests: true by default.
Resolved all the failures (passing presubmit) to enable this.
Test: presubmit trigger
Bug: 177450457
Change-Id: I815e40786c0b62cf0aadd9b837d35c48332639da
diff --git a/cc/test.go b/cc/test.go
index f715a8d..17ac534 100644
--- a/cc/test.go
+++ b/cc/test.go
@@ -19,6 +19,8 @@
"strconv"
"strings"
+ "github.com/google/blueprint/proptools"
+
"android/soong/android"
"android/soong/tradefed"
)
@@ -230,6 +232,7 @@
type testDecorator struct {
Properties TestProperties
linker *baseLinker
+ hod android.HostOrDeviceSupported
}
func (test *testDecorator) gtest() bool {
@@ -429,6 +432,10 @@
ctx.PropertyErrorf("no_named_install_directory", "Module install directory may only be disabled if relative_install_path is set")
}
+ // TODO(179092189): Clean up to use Ctx.Host() when generalizing to cc_test
+ if test.testDecorator.hod == android.HostSupported && test.gtest() && test.Properties.Test_options.Unit_test == nil {
+ test.Properties.Test_options.Unit_test = proptools.BoolPtr(true)
+ }
test.binaryDecorator.baseInstaller.install(ctx, file)
}
@@ -440,6 +447,7 @@
test := &testBinary{
testDecorator: testDecorator{
linker: binary.baseLinker,
+ hod: hod,
},
binaryDecorator: binary,
baseCompiler: NewBaseCompiler(),