2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-30 05:47:59 +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:
Steve Beattie 2020-05-26 23:02:03 -07:00
parent 7fa74521fb
commit c5a7bcd50e
No known key found for this signature in database
GPG Key ID: 2F099E8D005E81F4

View File

@ -360,11 +360,11 @@ class IncludeFullPathsTest(AATest):
os.mkdir(empty_dir, 0o755)
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 "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 <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/not_found>', ['@@/abstractions/not_found'] ),
('include if exists <abstractions/not_found>', [] ),
@ -376,7 +376,7 @@ class IncludeFullPathsTest(AATest):
exp2.append(path.replace('@@', self.profile_dir))
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 --- #