Make isolated true by default for gtest
This change sets everything up to do this, but does not actually enable it. jdesprez will follow up by making a one line change that actually turns the default to true when he does test debugging/verification. Bug: 178498003 Test: build. Relying on @jdesprez for the rest of the verification Change-Id: I3b1b6b57279dd4f9f7fc559e2d3ad76911b045e8
This commit is contained in:
14
cc/test.go
14
cc/test.go
@@ -30,7 +30,8 @@ type TestLinkerProperties struct {
|
|||||||
// if set, build against the gtest library. Defaults to true.
|
// if set, build against the gtest library. Defaults to true.
|
||||||
Gtest *bool
|
Gtest *bool
|
||||||
|
|
||||||
// if set, use the isolated gtest runner. Defaults to false.
|
// if set, use the isolated gtest runner. Defaults to true if gtest is also true and the arch is Windows, false
|
||||||
|
// otherwise.
|
||||||
Isolated *bool
|
Isolated *bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,6 +257,13 @@ func (test *testDecorator) gtest() bool {
|
|||||||
return BoolDefault(test.LinkerProperties.Gtest, true)
|
return BoolDefault(test.LinkerProperties.Gtest, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (test *testDecorator) isolated(ctx BaseModuleContext) bool {
|
||||||
|
if !ctx.Windows() {
|
||||||
|
return BoolDefault(test.LinkerProperties.Isolated, false)
|
||||||
|
}
|
||||||
|
return BoolDefault(test.LinkerProperties.Isolated, false)
|
||||||
|
}
|
||||||
|
|
||||||
func (test *testDecorator) testBinary() bool {
|
func (test *testDecorator) testBinary() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -288,7 +296,7 @@ func (test *testDecorator) linkerDeps(ctx BaseModuleContext, deps Deps) Deps {
|
|||||||
if test.gtest() {
|
if test.gtest() {
|
||||||
if ctx.useSdk() && ctx.Device() {
|
if ctx.useSdk() && ctx.Device() {
|
||||||
deps.StaticLibs = append(deps.StaticLibs, "libgtest_main_ndk_c++", "libgtest_ndk_c++")
|
deps.StaticLibs = append(deps.StaticLibs, "libgtest_main_ndk_c++", "libgtest_ndk_c++")
|
||||||
} else if BoolDefault(test.LinkerProperties.Isolated, false) {
|
} else if test.isolated(ctx) {
|
||||||
deps.StaticLibs = append(deps.StaticLibs, "libgtest_isolated_main")
|
deps.StaticLibs = append(deps.StaticLibs, "libgtest_isolated_main")
|
||||||
// The isolated library requires liblog, but adding it
|
// The isolated library requires liblog, but adding it
|
||||||
// as a static library means unit tests cannot override
|
// as a static library means unit tests cannot override
|
||||||
@@ -424,7 +432,7 @@ func (test *testBinary) install(ctx ModuleContext, file android.Path) {
|
|||||||
var options []tradefed.Option
|
var options []tradefed.Option
|
||||||
configs = append(configs, tradefed.Object{"target_preparer", "com.android.tradefed.targetprep.StopServicesSetup", options})
|
configs = append(configs, tradefed.Object{"target_preparer", "com.android.tradefed.targetprep.StopServicesSetup", options})
|
||||||
}
|
}
|
||||||
if Bool(test.testDecorator.LinkerProperties.Isolated) {
|
if test.isolated(ctx) {
|
||||||
configs = append(configs, tradefed.Option{Name: "not-shardable", Value: "true"})
|
configs = append(configs, tradefed.Option{Name: "not-shardable", Value: "true"})
|
||||||
}
|
}
|
||||||
if test.Properties.Test_options.Run_test_as != nil {
|
if test.Properties.Test_options.Run_test_as != nil {
|
||||||
|
Reference in New Issue
Block a user