Merge "ATest: GTest auto gen config support run_test_as in Android.bp ."
am: 789b84b12f
Change-Id: I87f3520d5bda43abde35246cd6a300f7292d7061
This commit is contained in:
14
cc/test.go
14
cc/test.go
@@ -30,6 +30,12 @@ type TestProperties struct {
|
|||||||
Isolated *bool
|
Isolated *bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test option struct.
|
||||||
|
type TestOptions struct {
|
||||||
|
// The UID that you want to run the test as on a device.
|
||||||
|
Run_test_as *string
|
||||||
|
}
|
||||||
|
|
||||||
type TestBinaryProperties struct {
|
type TestBinaryProperties struct {
|
||||||
// Create a separate binary for each source file. Useful when there is
|
// Create a separate binary for each source file. Useful when there is
|
||||||
// global state that can not be torn down and reset between each test suite.
|
// global state that can not be torn down and reset between each test suite.
|
||||||
@@ -55,6 +61,9 @@ type TestBinaryProperties struct {
|
|||||||
// the name of the test configuration template (for example "AndroidTestTemplate.xml") that
|
// the name of the test configuration template (for example "AndroidTestTemplate.xml") that
|
||||||
// should be installed with the module.
|
// should be installed with the module.
|
||||||
Test_config_template *string `android:"path,arch_variant"`
|
Test_config_template *string `android:"path,arch_variant"`
|
||||||
|
|
||||||
|
// Test options.
|
||||||
|
Test_options TestOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@@ -258,6 +267,11 @@ func (test *testBinary) install(ctx ModuleContext, file android.Path) {
|
|||||||
if Bool(test.testDecorator.Properties.Isolated) {
|
if Bool(test.testDecorator.Properties.Isolated) {
|
||||||
optionsMap["not-shardable"] = "true"
|
optionsMap["not-shardable"] = "true"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if test.Properties.Test_options.Run_test_as != nil {
|
||||||
|
optionsMap["run-test-as"] = String(test.Properties.Test_options.Run_test_as)
|
||||||
|
}
|
||||||
|
|
||||||
test.testConfig = tradefed.AutoGenNativeTestConfig(ctx, test.Properties.Test_config,
|
test.testConfig = tradefed.AutoGenNativeTestConfig(ctx, test.Properties.Test_config,
|
||||||
test.Properties.Test_config_template,
|
test.Properties.Test_config_template,
|
||||||
test.Properties.Test_suites, optionsMap)
|
test.Properties.Test_suites, optionsMap)
|
||||||
|
Reference in New Issue
Block a user