Fix missing test name after aosp/2372150

The test name defaulting to ctx.ModuleName() was
accidentally removed, readd it

Bug: 184895128
Fixes: 264423240
Fixes: 264433459
Test: Verified ninja files produced with this cl and aosp/2372150 are the same as with aosp/2372150 reverted
Change-Id: I23ab8ab39132b93719cc6f797d92b1cabce5eae9
This commit is contained in:
Cole Faust
2023-01-04 11:24:28 -08:00
parent 94682b23c4
commit 0cec5ea146

View File

@@ -155,19 +155,23 @@ func AutoGenTestConfig(ctx android.ModuleContext, options AutoGenTestConfigOptio
for _, c := range options.OptionsForAutogenerated { for _, c := range options.OptionsForAutogenerated {
configs = append(configs, c) configs = append(configs, c)
} }
name := options.Name
if name == "" {
name = ctx.ModuleName()
}
path, autogenPath := testConfigPath(ctx, options.TestConfigProp, options.TestSuites, options.AutoGenConfig, options.TestConfigTemplateProp) path, autogenPath := testConfigPath(ctx, options.TestConfigProp, options.TestSuites, options.AutoGenConfig, options.TestConfigTemplateProp)
if autogenPath != nil { if autogenPath != nil {
templatePath := getTestConfigTemplate(ctx, options.TestConfigTemplateProp) templatePath := getTestConfigTemplate(ctx, options.TestConfigTemplateProp)
if templatePath.Valid() { if templatePath.Valid() {
autogenTemplate(ctx, options.Name, autogenPath, templatePath.String(), configs, options.OutputFileName, options.TestInstallBase) autogenTemplate(ctx, name, autogenPath, templatePath.String(), configs, options.OutputFileName, options.TestInstallBase)
} else { } else {
if ctx.Device() { if ctx.Device() {
autogenTemplate(ctx, options.Name, autogenPath, options.DeviceTemplate, configs, options.OutputFileName, options.TestInstallBase) autogenTemplate(ctx, name, autogenPath, options.DeviceTemplate, configs, options.OutputFileName, options.TestInstallBase)
} else { } else {
if Bool(options.UnitTest) { if Bool(options.UnitTest) {
autogenTemplate(ctx, options.Name, autogenPath, options.HostUnitTestTemplate, configs, options.OutputFileName, options.TestInstallBase) autogenTemplate(ctx, name, autogenPath, options.HostUnitTestTemplate, configs, options.OutputFileName, options.TestInstallBase)
} else { } else {
autogenTemplate(ctx, options.Name, autogenPath, options.HostTemplate, configs, options.OutputFileName, options.TestInstallBase) autogenTemplate(ctx, name, autogenPath, options.HostTemplate, configs, options.OutputFileName, options.TestInstallBase)
} }
} }
} }