summaryrefslogtreecommitdiff
path: root/android/test_config.go
diff options
context:
space:
mode:
author Justin Yun <justinyun@google.com> 2024-12-17 21:15:59 +0900
committer Justin Yun <justinyun@google.com> 2025-03-18 16:11:05 +0900
commitbe6f81d61e25753eeecdb65bdf7dd2bb6d4c1a5c (patch)
tree8e289a62ad2dab9cbaec0aab99bdc3143b0ff47e /android/test_config.go
parent247c22ac8648faeb7129c6eb778eb51a06da5f10 (diff)
Generic configuration for generic system modules.
Config object includes a copy of itself for the generic configuration. The generic configuration replaces any product-specific configurations with the generic information. When a module context gets Config() object, it returns the generic configuration if the module sets use_generic_config to true. Otherwise, Config() returns the original config object as before. By adding `generic:"<value>"` annotation to the product variable, the variables will be initialized with the <value> for the generic configs. If the <value> is "unset", the variable will be unset. The generic modules can be included in the shared system image to be installed in multiple targets. Bug: 361816274 Test: m nothing --no-skip-soong-tests Change-Id: I15e4ade17ad1a8969f8e0e91d994b60545dc412f
Diffstat (limited to 'android/test_config.go')
-rw-r--r--android/test_config.go17
1 files changed, 14 insertions, 3 deletions
diff --git a/android/test_config.go b/android/test_config.go
index 3609e6b78..5d79df099 100644
--- a/android/test_config.go
+++ b/android/test_config.go
@@ -23,8 +23,7 @@ import (
"github.com/google/blueprint/proptools"
)
-// TestConfig returns a Config object for testing.
-func TestConfig(buildDir string, env map[string]string, bp string, fs map[string][]byte) Config {
+func initTestConfig(buildDir string, env map[string]string) *config {
envCopy := make(map[string]string)
for k, v := range env {
envCopy[k] = v
@@ -58,6 +57,7 @@ func TestConfig(buildDir string, env map[string]string, bp string, fs map[string
soongOutDir: filepath.Join(buildDir, "soong"),
captureBuild: true,
env: envCopy,
+ OncePer: &OncePer{},
// Set testAllowNonExistentPaths so that test contexts don't need to specify every path
// passed to PathForSource or PathForModuleSrc.
@@ -69,10 +69,21 @@ func TestConfig(buildDir string, env map[string]string, bp string, fs map[string
config: config,
}
config.TestProductVariables = &config.productVariables
+ config.deviceNameToInstall = config.TestProductVariables.DeviceName
+
+ determineBuildOS(config)
+
+ return config
+}
+
+// TestConfig returns a Config object for testing.
+func TestConfig(buildDir string, env map[string]string, bp string, fs map[string][]byte) Config {
+ config := initTestConfig(buildDir, env)
config.mockFileSystem(bp, fs)
- determineBuildOS(config)
+ config.genericConfig = initTestConfig(buildDir, env)
+ overrideGenericConfig(config)
return Config{config}
}