From b80179834d1bb60c872ffe3d43e9de09c981f3fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20B=C3=A9lair?= Date: Fri, 29 Aug 2025 10:06:22 +0200 Subject: [PATCH] test-aa-show-usage: correctly handle disabled profiles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit test_show_unconfined_profiles did not exclude disabled profiles from the expected results, which led to test failures when some profiles were disabled. Disabled profiles are now correctly excluded from the results, fixing the test. Reported-by: Georgia Garcia Signed-off-by: Maxime Bélair --- utils/test/test-aa-show-usage.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/utils/test/test-aa-show-usage.py b/utils/test/test-aa-show-usage.py index 10251e2fd..054a42691 100644 --- a/utils/test/test-aa-show-usage.py +++ b/utils/test/test-aa-show-usage.py @@ -92,7 +92,16 @@ Filtering options: if line.startswith(' Profile '): nb_profile += 1 - command = ['grep', '-Er', r'flags=.*unconfined.*\{', '--', aa.profile_dir] + command = ['grep', '-Er', r'flags=.*unconfined.*\{'] + + # Remove disabled profiles from grep + disable_dir = os.path.join(aa.profile_dir, 'disable') + if os.path.isdir(disable_dir): + for name in os.listdir(disable_dir): + command.append('--exclude=' + name) + + command.extend(['--', aa.profile_dir]) + result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=True, check=False) self.assertEqual( len(result.stdout.splitlines()), nb_profile,