summaryrefslogtreecommitdiff
path: root/rust/test.go
diff options
context:
space:
mode:
author Spandan Das <spandandas@google.com> 2025-01-29 20:57:02 +0000
committer Spandan Das <spandandas@google.com> 2025-01-29 20:57:02 +0000
commit3094ba0b7d50728f0930b67931e7c2474f202fd2 (patch)
tree4774d5a1ecc80dc5f64f09ff2bcabca3fa628d83 /rust/test.go
parentdc81dfea7aa01fb1995d4de70a67852db82f07ad (diff)
Install rust test and deps in testcases/ in soong-only
For use in atest Bug: 391924360 Test: Set PRODUCT_SOONG_ONLY Test: Copied mk build module-info.json to $PRODUCT_OUT/module-info.json Test: atest libmmd_unit_tests Change-Id: Iebf5dec44356152877f96da95914edd653f16967
Diffstat (limited to 'rust/test.go')
-rw-r--r--rust/test.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/rust/test.go b/rust/test.go
index 5e42c3f60..7c51f98be 100644
--- a/rust/test.go
+++ b/rust/test.go
@@ -195,6 +195,27 @@ func (test *testDecorator) install(ctx ModuleContext) {
if ctx.Host() && test.Properties.Test_options.Unit_test == nil {
test.Properties.Test_options.Unit_test = proptools.BoolPtr(true)
}
+
+ if !ctx.Config().KatiEnabled() { // TODO(spandandas): Remove the special case for kati
+ // Install the test config in testcases/ directory for atest.
+ r, ok := ctx.Module().(*Module)
+ if !ok {
+ ctx.ModuleErrorf("Not a rust test module")
+ }
+ // Install configs in the root of $PRODUCT_OUT/testcases/$module
+ testCases := android.PathForModuleInPartitionInstall(ctx, "testcases", ctx.ModuleName()+r.SubName())
+ if ctx.PrimaryArch() {
+ if test.testConfig != nil {
+ ctx.InstallFile(testCases, ctx.ModuleName()+".config", test.testConfig)
+ }
+ }
+ // Install tests and data in arch specific subdir $PRODUCT_OUT/testcases/$module/$arch
+ testCases = testCases.Join(ctx, ctx.Target().Arch.ArchType.String())
+ ctx.InstallTestData(testCases, test.data)
+ testPath := ctx.RustModule().OutputFile().Path()
+ ctx.InstallFile(testCases, testPath.Base(), testPath)
+ }
+
test.binaryDecorator.installTestData(ctx, test.data)
test.binaryDecorator.install(ctx)
}