mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-30 22:05:27 +00:00
utils/tests: test-include.py sometimes fails due to ordering
With the includes rule class landing, this particular test failed in a test vm due to the sort ordering being different. It's not clear that there should be an expectation of ordering returned from get_full_paths(), so sort the result. Signed-off-by: Steve Beattie <steve.beattie@canonical.com> Acked-by: John Johansen <john.johansen@canonical.com> MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/548
This commit is contained in:
@@ -360,11 +360,11 @@ class IncludeFullPathsTest(AATest):
|
|||||||
os.mkdir(empty_dir, 0o755)
|
os.mkdir(empty_dir, 0o755)
|
||||||
|
|
||||||
tests = [
|
tests = [
|
||||||
# @@ will be replaced with self.profile_dir
|
# @@ will be replaced with self.profile_dir; if multiple entries, need to be sorted
|
||||||
('include <abstractions/base>', ['@@/abstractions/base'] ),
|
('include <abstractions/base>', ['@@/abstractions/base'] ),
|
||||||
# ('include "foo"', ['@@/foo'] ), # TODO: adjust logic to honor quoted vs. magic paths (and allow quoted relative paths in re_match_include_parse())
|
# ('include "foo"', ['@@/foo'] ), # TODO: adjust logic to honor quoted vs. magic paths (and allow quoted relative paths in re_match_include_parse())
|
||||||
('include "/foo/bar"', ['/foo/bar'] ),
|
('include "/foo/bar"', ['/foo/bar'] ),
|
||||||
('include <abstractions/inc.d>', ['@@/abstractions/inc.d/incfoo', '@@/abstractions/inc.d/incbar'] ),
|
('include <abstractions/inc.d>', ['@@/abstractions/inc.d/incbar', '@@/abstractions/inc.d/incfoo'] ),
|
||||||
('include <abstractions/empty.d>', [] ),
|
('include <abstractions/empty.d>', [] ),
|
||||||
('include <abstractions/not_found>', ['@@/abstractions/not_found'] ),
|
('include <abstractions/not_found>', ['@@/abstractions/not_found'] ),
|
||||||
('include if exists <abstractions/not_found>', [] ),
|
('include if exists <abstractions/not_found>', [] ),
|
||||||
@@ -376,7 +376,7 @@ class IncludeFullPathsTest(AATest):
|
|||||||
exp2.append(path.replace('@@', self.profile_dir))
|
exp2.append(path.replace('@@', self.profile_dir))
|
||||||
|
|
||||||
obj = IncludeRule._parse(params)
|
obj = IncludeRule._parse(params)
|
||||||
self.assertEqual(obj.get_full_paths(self.profile_dir), exp2)
|
self.assertEqual(sorted(obj.get_full_paths(self.profile_dir)), exp2)
|
||||||
|
|
||||||
## --- tests for IncludeRuleset --- #
|
## --- tests for IncludeRuleset --- #
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user