Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f8baa897 authored by Tom Cherry's avatar Tom Cherry
Browse files

libcutils: update fs_config tests for current behavior

Update fs_config tests for the new behavior in
a8eb0072.

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
parent 2ea7c7d3
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -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  },