Make rust_test file output more similar to cc_test.

This changes the way the output filename is calculated for rust_test
binaries to be more similar to cc_test.

This also removes the option to define multiple test binaries in a
single rust_test module via the TestPerSrc mutator. Now each rust_test
module corresponds to a single test binary.

Bug: 158500462
Test: m -j pin-utils_tests_pin_utils
Test: m -j unicode-xid_device_tests_unicode_xid
Change-Id: I6e0f79dcb4e49fa49d6ebb36abeef67a9eb180a0
This commit is contained in:
Ivan Lozano
2020-06-11 13:25:36 -04:00
parent 52481b445b
commit fc80fe7f2f
6 changed files with 27 additions and 131 deletions

View File

@@ -220,19 +220,20 @@ func AutoGenPythonBinaryHostTestConfig(ctx android.ModuleContext, testConfigProp
return path
}
func AutoGenRustTestConfig(ctx android.ModuleContext, name string, testConfigProp *string,
testConfigTemplateProp *string, testSuites []string, autoGenConfig *bool) android.Path {
func AutoGenRustTestConfig(ctx android.ModuleContext, testConfigProp *string,
testConfigTemplateProp *string, testSuites []string, config []Config, autoGenConfig *bool) android.Path {
path, autogenPath := testConfigPath(ctx, testConfigProp, testSuites, autoGenConfig, testConfigTemplateProp)
if autogenPath != nil {
templatePathString := "${RustHostTestConfigTemplate}"
if ctx.Device() {
templatePathString = "${RustDeviceTestConfigTemplate}"
}
templatePath := getTestConfigTemplate(ctx, testConfigTemplateProp)
if templatePath.Valid() {
templatePathString = templatePath.String()
autogenTemplate(ctx, autogenPath, templatePath.String(), config)
} else {
if ctx.Device() {
autogenTemplate(ctx, autogenPath, "${RustDeviceTestConfigTemplate}", config)
} else {
autogenTemplate(ctx, autogenPath, "${RustHostTestConfigTemplate}", config)
}
}
autogenTemplateWithName(ctx, name, autogenPath, templatePathString, nil)
return autogenPath
}
return path