summaryrefslogtreecommitdiff
path: root/rust/test.go
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2019-12-03 21:19:12 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2019-12-03 21:19:12 +0000
commitdc9369ef7fc9c971a59d6586adf02a69e7dfdec7 (patch)
tree62b338a4a063f4194ed0201f0acbfbbef6f187d9 /rust/test.go
parent4d2eeed0dad64b14c9fd8641ff304ac40cd17fe6 (diff)
parentede57ae8122992e788be7977803926e76e35b466 (diff)
Merge "Generate tradefed config for rust device tests."
Diffstat (limited to 'rust/test.go')
-rw-r--r--rust/test.go25
1 files changed, 19 insertions, 6 deletions
diff --git a/rust/test.go b/rust/test.go
index cb64e8f83..b3911036a 100644
--- a/rust/test.go
+++ b/rust/test.go
@@ -69,15 +69,28 @@ func (test *testDecorator) compilerProps() []interface{} {
return append(test.binaryDecorator.compilerProps(), &test.Properties)
}
+func (test *testDecorator) getMutatedModuleSubName(moduleName string) string {
+ stem := String(test.baseCompiler.Properties.Stem)
+ if stem != "" && !strings.HasSuffix(moduleName, "_"+stem) {
+ // Avoid repeated suffix in the module name.
+ return "_" + stem
+ }
+ return ""
+}
+
func (test *testDecorator) install(ctx ModuleContext, file android.Path) {
name := ctx.ModuleName() // default executable name
- if stem := String(test.baseCompiler.Properties.Stem); stem != "" {
- name = stem
- }
- if path := test.baseCompiler.relativeInstallPath(); path != "" {
- name = path + "/" + name
+ if ctx.Device() { // on device, use mutated module name
+ name = name + test.getMutatedModuleSubName(name)
+ } else { // on host, use stem name in relative_install_path
+ if stem := String(test.baseCompiler.Properties.Stem); stem != "" {
+ name = stem
+ }
+ if path := test.baseCompiler.relativeInstallPath(); path != "" {
+ name = path + "/" + name
+ }
}
- test.testConfig = tradefed.AutoGenRustHostTestConfig(ctx, name,
+ test.testConfig = tradefed.AutoGenRustTestConfig(ctx, name,
test.Properties.Test_config,
test.Properties.Test_config_template,
test.Properties.Test_suites,