Browse Source

Merge "Fix missing test name after aosp/2372150"

Cole Faust 1 year ago
parent
commit
49dd3d583e
1 changed files with 8 additions and 4 deletions
  1. 8 4
      tradefed/autogen.go

+ 8 - 4
tradefed/autogen.go

@@ -155,19 +155,23 @@ func AutoGenTestConfig(ctx android.ModuleContext, options AutoGenTestConfigOptio
 	for _, c := range options.OptionsForAutogenerated {
 		configs = append(configs, c)
 	}
+	name := options.Name
+	if name == "" {
+		name = ctx.ModuleName()
+	}
 	path, autogenPath := testConfigPath(ctx, options.TestConfigProp, options.TestSuites, options.AutoGenConfig, options.TestConfigTemplateProp)
 	if autogenPath != nil {
 		templatePath := getTestConfigTemplate(ctx, options.TestConfigTemplateProp)
 		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 {
 			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 {
 				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 {
-					autogenTemplate(ctx, options.Name, autogenPath, options.HostTemplate, configs, options.OutputFileName, options.TestInstallBase)
+					autogenTemplate(ctx, name, autogenPath, options.HostTemplate, configs, options.OutputFileName, options.TestInstallBase)
 				}
 			}
 		}