diff options
author | 2021-06-03 19:36:41 +0000 | |
---|---|---|
committer | 2021-06-08 17:53:31 +0000 | |
commit | 5d1b929f216513fa2c6b96d7d157289019018086 (patch) | |
tree | 4111b6f029013e2ce28b98815d65410b0576af52 /java/rro_test.go | |
parent | ad66593085509b7e1b1f3e9a61b7c7b05d832788 (diff) |
Port module_partition logic for RRO from Make to Soong
The default partition for RRO is "product/" in Make, but it was
"system/" in Soong. This CL ports the logic from Make to Soong
To implement this, a new function PathForModuleInPartitionInstall is
created that enables callers to provide the relevant partition
Bug: 158407753
Test: from build/soong, ran go test ./java
Change-Id: I05b02eae7fe57189aaad5109c26cccc5823518ef
Diffstat (limited to 'java/rro_test.go')
-rw-r--r-- | java/rro_test.go | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/java/rro_test.go b/java/rro_test.go index bad60bc16..27abbe4f3 100644 --- a/java/rro_test.go +++ b/java/rro_test.go @@ -177,7 +177,7 @@ func TestRuntimeResourceOverlay_JavaDefaults(t *testing.T) { // Check device location. path = android.AndroidMkEntriesForTest(t, ctx, m.Module())[0].EntryMap["LOCAL_MODULE_PATH"] - expectedPath = []string{shared.JoinPath("out/target/product/test_device/system/overlay")} + expectedPath = []string{shared.JoinPath("out/target/product/test_device/product/overlay")} android.AssertStringPathsRelativeToTopEquals(t, "LOCAL_MODULE_PATH", config, expectedPath, path) } @@ -343,3 +343,57 @@ func TestEnforceRRO_propagatesToDependencies(t *testing.T) { }) } } + +func TestRuntimeResourceOverlayPartition(t *testing.T) { + bp := ` + runtime_resource_overlay { + name: "device_specific", + device_specific: true, + } + runtime_resource_overlay { + name: "soc_specific", + soc_specific: true, + } + runtime_resource_overlay { + name: "system_ext_specific", + system_ext_specific: true, + } + runtime_resource_overlay { + name: "product_specific", + product_specific: true, + } + runtime_resource_overlay { + name: "default" + } + ` + testCases := []struct { + name string + expectedPath string + }{ + { + name: "device_specific", + expectedPath: "out/soong/target/product/test_device/odm/overlay", + }, + { + name: "soc_specific", + expectedPath: "out/soong/target/product/test_device/vendor/overlay", + }, + { + name: "system_ext_specific", + expectedPath: "out/soong/target/product/test_device/system_ext/overlay", + }, + { + name: "product_specific", + expectedPath: "out/soong/target/product/test_device/product/overlay", + }, + { + name: "default", + expectedPath: "out/soong/target/product/test_device/product/overlay", + }, + } + for _, testCase := range testCases { + ctx, _ := testJava(t, bp) + mod := ctx.ModuleForTests(testCase.name, "android_common").Module().(*RuntimeResourceOverlay) + android.AssertPathRelativeToTopEquals(t, "Install dir is not correct for "+testCase.name, testCase.expectedPath, mod.installDir) + } +} |