summaryrefslogtreecommitdiff
path: root/rust/test.go
diff options
context:
space:
mode:
author Chih-Hung Hsieh <chh@google.com> 2019-12-12 19:36:05 -0800
committer Chih-Hung Hsieh <chh@google.com> 2019-12-13 14:51:32 -0800
commit9a4a7bab411cb6aaf01e5236eac6328e7d8f8f2e (patch)
tree144fe7c00b7d6b34ef3af3099bb950ff754a395b /rust/test.go
parentedb4e21de5619651be2ca83d4db90817f8515bfb (diff)
Install rust tests under nativetest(64)
* Now the installation directories match those for C/C++ tests: * The relative_install_path refers to path under nativetest(64). * Device test files are installed in data/nativetest(64). * Automatically generated configuration files and copied test binaries are still in the "testcases" directory. * Change host test configuration to run test binary files in testcases/<mutated_module_name>/<arch_type>/<stem_name> Bug: 140938178 Test: atest --include-subdirs under external/rust/crates Change-Id: I4b29afb897f4ba8749e87f79857c5b1a959bb2b0
Diffstat (limited to 'rust/test.go')
-rw-r--r--rust/test.go25
1 files changed, 14 insertions, 11 deletions
diff --git a/rust/test.go b/rust/test.go
index b3911036a..04f844cbc 100644
--- a/rust/test.go
+++ b/rust/test.go
@@ -55,8 +55,7 @@ func NewRustTest(hod android.HostOrDeviceSupported) (*Module, *testDecorator) {
test := &testDecorator{
binaryDecorator: &binaryDecorator{
- // TODO(chh): set up dir64?
- baseCompiler: NewBaseCompiler("testcases", ""),
+ baseCompiler: NewBaseCompiler("nativetest", "nativetest64", InstallInData),
},
}
@@ -79,22 +78,26 @@ func (test *testDecorator) getMutatedModuleSubName(moduleName string) string {
}
func (test *testDecorator) install(ctx ModuleContext, file android.Path) {
- name := ctx.ModuleName() // default executable 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
+ name := ctx.ModuleName()
+ path := test.baseCompiler.relativeInstallPath()
+ // on device, use mutated module name
+ name = name + test.getMutatedModuleSubName(name)
+ if !ctx.Device() { // on host, use mutated module name + arch type + stem name
+ stem := String(test.baseCompiler.Properties.Stem)
+ if stem == "" {
+ stem = name
}
+ name = filepath.Join(name, ctx.Arch().ArchType.String(), stem)
}
test.testConfig = tradefed.AutoGenRustTestConfig(ctx, name,
test.Properties.Test_config,
test.Properties.Test_config_template,
test.Properties.Test_suites,
test.Properties.Auto_gen_config)
+ // default relative install path is module name
+ if path == "" {
+ test.baseCompiler.relative = ctx.ModuleName()
+ }
test.binaryDecorator.install(ctx, file)
}