summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Cherry <tomcherry@google.com>2019-11-06 09:29:56 -0800
committerTom Cherry <tomcherry@google.com>2019-11-06 09:40:33 -0800
commitf8baa897ec952f60e49b9f86310fd9a305bf6f3a (patch)
tree0ccc058b6ab678c163e2c640c2c84ebc42354cca
parent2ea7c7d39fd8998f1007b2214811c6b5d30d43c8 (diff)
libcutils: update fs_config tests for current behavior
Update fs_config tests for the new behavior in a8eb00720ca0ea02ace5942e54860c07ca35a14f. Before the above CL, fs_config_cmp() would match any partition prefix to any path, even if there is not a logical relationship between them. For example, these two lines in the test the demonstrate the changed behavior: { true, "vendor/lib", "system/vendor/lib/hw", true }, { true, "system/vendor/lib", "vendor/lib/hw", true }, The first line should match and does; it is testing that files located at system/vendor/lib/hw are matched by an fs_path_config entry specified as vendor/lib. This is to allow for applying the policy we have for the vendor partition to files in /system/vendor in the case that there is no vendor partition. The second line should not match. This is testing that a file that's located at vendor/lib/hw is matched by an fs_path_config entry specified as system/vendor/lib. This is backwards; we do not want to have policy specified for system/vendor to impact policy for the vendor partition. Also, we never have any relationships from /system/oem to /oem or /system/odm to /odm, so these are logically unrelated and should fail to match. We do however have a relationship from /vendor/odm to /odm, so this test is added. Test: libcutils unit tests pass on CF Change-Id: I026f0233e00bbd0aad9bc0fb701aef000d2a037c
-rw-r--r--libcutils/fs_config_test.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/libcutils/fs_config_test.cpp b/libcutils/fs_config_test.cpp
index 9627152a7..c6684b493 100644
--- a/libcutils/fs_config_test.cpp
+++ b/libcutils/fs_config_test.cpp
@@ -46,7 +46,7 @@ static const struct fs_config_cmp_test {
// clang-format off
{ true, "system/lib", "system/lib/hw", true },
{ true, "vendor/lib", "system/vendor/lib/hw", true },
- { true, "system/vendor/lib", "vendor/lib/hw", true },
+ { true, "system/vendor/lib", "vendor/lib/hw", false },
{ true, "system/vendor/lib", "system/vendor/lib/hw", true },
{ true, "foo/*/bar/*", "foo/1/bar/2", true },
{ true, "foo/*/bar/*", "foo/1/bar", true },
@@ -56,13 +56,14 @@ static const struct fs_config_cmp_test {
{ false, "vendor/bin/wifi", "system/vendor/bin/wifi", true },
{ false, "vendor/bin/wifi", "system/vendor/bin/wifi2", false },
{ false, "system/vendor/bin/wifi", "system/vendor/bin/wifi", true, },
- { false, "odm/bin/wifi", "system/odm/bin/wifi", true },
- { false, "oem/bin/wifi", "system/oem/bin/wifi", true },
+ { false, "odm/bin/wifi", "system/odm/bin/wifi", false },
+ { false, "odm/bin/wifi", "vendor/odm/bin/wifi", true },
+ { false, "oem/bin/wifi", "system/oem/bin/wifi", false },
{ false, "data/bin/wifi", "system/data/bin/wifi", false },
{ false, "system/bin/*", "system/bin/wifi", true },
{ false, "vendor/bin/*", "system/vendor/bin/wifi", true },
{ false, "system/bin/*", "system/bin", false },
- { false, "system/vendor/bin/*", "vendor/bin/wifi", true },
+ { false, "system/vendor/bin/*", "vendor/bin/wifi", false },
{ false, "foo/*/bar/*", "foo/1/bar/2", true },
{ false, "foo/*/bar/*", "foo/1/bar", false },
{ false, "foo/*/bar/*", "foo/1/bar/2/3", true },