summaryrefslogtreecommitdiff
path: root/rust/testing.go
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2021-03-11 11:48:35 +0000
committerPaul Duffin <paulduffin@google.com>2021-03-11 17:25:29 +0000
commitdb4888966aaa0f0be8b019b0a653175a9a1a00c3 (patch)
treebe25fb922b0a61780a616a70c96a3b3df1f9772c /rust/testing.go
parentd1fc19be3975915f14e2c9fc3ed4b728b4ca6bd1 (diff)
Add text fixture preparers for rust package
Needed to decouple the integration of test fixtures into apex from the support of test fixtures in rust tests. Bug: 181070625 Test: m nothing Change-Id: I26bdfde58dd75713ece89e631edabf041d40596a
Diffstat (limited to 'rust/testing.go')
-rw-r--r--rust/testing.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/rust/testing.go b/rust/testing.go
index 9534ab580..5be71c90e 100644
--- a/rust/testing.go
+++ b/rust/testing.go
@@ -20,6 +20,30 @@ import (
"android/soong/genrule"
)
+// Preparer that will define all cc module types and a limited set of mutators and singletons that
+// make those module types usable.
+var PrepareForTestWithRustBuildComponents = android.GroupFixturePreparers(
+ android.FixtureRegisterWithContext(RegisterRequiredBuildComponentsForTest),
+)
+
+// The directory in which rust test default modules will be defined.
+//
+// Placing them here ensures that their location does not conflict with default test modules
+// defined by other packages.
+const rustDefaultsDir = "defaults/rust/"
+
+// Preparer that will define default rust modules, e.g. standard prebuilt modules.
+var PrepareForTestWithRustDefaultModules = android.GroupFixturePreparers(
+ cc.PrepareForTestWithCcDefaultModules,
+ PrepareForTestWithRustBuildComponents,
+ android.FixtureAddTextFile(rustDefaultsDir+"Android.bp", GatherRequiredDepsForTest()),
+)
+
+// Preparer that will allow use of all rust modules fully.
+var PrepareForIntegrationTestWithRust = android.GroupFixturePreparers(
+ PrepareForTestWithRustDefaultModules,
+)
+
func GatherRequiredDepsForTest() string {
bp := `
rust_prebuilt_library {