From c5a7bcd50ee2c6c2e40950634d3530f039b0e545 Mon Sep 17 00:00:00 2001 From: Steve Beattie Date: Tue, 26 May 2020 23:02:03 -0700 Subject: [PATCH] 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 Acked-by: John Johansen MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/548 --- utils/test/test-include.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/test/test-include.py b/utils/test/test-include.py index 3d7e67753..a7d22948b 100644 --- a/utils/test/test-include.py +++ b/utils/test/test-include.py @@ -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'] ), # ('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/incfoo', '@@/abstractions/inc.d/incbar'] ), + ('include ', ['@@/abstractions/inc.d/incbar', '@@/abstractions/inc.d/incfoo'] ), ('include ', [] ), ('include ', ['@@/abstractions/not_found'] ), ('include if exists ', [] ), @@ -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 --- #