Add test infrastructure for running the arch mutator
Add TestArchConfig and NewTestArchContext to create a test context
that will run the arch mutator, which is necessary to test any code
that is inside a ctx.Device() block or similar.
Test: next patch
Change-Id: Ieb1a0326bc27fc18ba88b8d37655a7e0c6870d6c
diff --git a/android/config.go b/android/config.go
index 4f35114..f30a708 100644
--- a/android/config.go
+++ b/android/config.go
@@ -185,6 +185,25 @@
return Config{config}
}
+// TestConfig returns a Config object suitable for using for tests that need to run the arch mutator
+func TestArchConfig(buildDir string) Config {
+ testConfig := TestConfig(buildDir)
+ config := testConfig.config
+
+ config.Targets = map[OsClass][]Target{
+ Device: []Target{
+ {Android, Arch{ArchType: Arm64, Native: true}},
+ {Android, Arch{ArchType: Arm, Native: true}},
+ },
+ Host: []Target{
+ {BuildOs, Arch{ArchType: X86_64}},
+ {BuildOs, Arch{ArchType: X86}},
+ },
+ }
+
+ return testConfig
+}
+
// New creates a new Config object. The srcDir argument specifies the path to
// the root source directory. It also loads the config file, if found.
func NewConfig(srcDir, buildDir string) (Config, error) {