mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 18:17:09 +00:00
utils: remove the skip_*_profiles testing bypass
The utils should be able to skip profiles that it can't parse now, so this test suite bypass mechanism should no longer be necessary. Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
This commit is contained in:
parent
e80d5bd3d4
commit
930218193b
@ -24,13 +24,6 @@ import unittest
|
|||||||
# print("Please press the Y button on the keyboard.")
|
# print("Please press the Y button on the keyboard.")
|
||||||
# self.assertEqual(apparmor.common.readkey().lower(), 'y', 'Error reading key from shell!')
|
# self.assertEqual(apparmor.common.readkey().lower(), 'y', 'Error reading key from shell!')
|
||||||
|
|
||||||
# If a profile can't be parsed by the tools, add it to skip_active_profiles or skip_extra_profiles.
|
|
||||||
# Add only the filename (without path), for example 'usr.bin.foo'.
|
|
||||||
# These skip lists are meant as a temporary solution, and should be empty on release.
|
|
||||||
skip_active_profiles = []
|
|
||||||
|
|
||||||
skip_extra_profiles = []
|
|
||||||
|
|
||||||
|
|
||||||
class AATest(unittest.TestCase):
|
class AATest(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -16,7 +16,7 @@ import sys
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
# import apparmor.aa as aa # see the setup_aa() call for details
|
# import apparmor.aa as aa # see the setup_aa() call for details
|
||||||
from common_test import AATest, read_file, setup_all_loops, skip_active_profiles # , setup_aa
|
from common_test import AATest, read_file, setup_all_loops # , setup_aa
|
||||||
|
|
||||||
|
|
||||||
class TestLogprof(AATest):
|
class TestLogprof(AATest):
|
||||||
@ -36,7 +36,7 @@ class TestLogprof(AATest):
|
|||||||
# copy the local profiles to the test directory
|
# copy the local profiles to the test directory
|
||||||
self.profile_dir = self.tmpdir + '/profiles'
|
self.profile_dir = self.tmpdir + '/profiles'
|
||||||
shutil.copytree('../../profiles/apparmor.d/', self.profile_dir,
|
shutil.copytree('../../profiles/apparmor.d/', self.profile_dir,
|
||||||
symlinks=True, ignore=shutil.ignore_patterns(*skip_active_profiles))
|
symlinks=True)
|
||||||
|
|
||||||
def AATeardown(self):
|
def AATeardown(self):
|
||||||
self._terminate()
|
self._terminate()
|
||||||
|
@ -18,7 +18,7 @@ import sys
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import apparmor.aa as apparmor
|
import apparmor.aa as apparmor
|
||||||
from common_test import AATest, read_file, write_file, setup_aa, setup_all_loops, skip_active_profiles
|
from common_test import AATest, read_file, write_file, setup_aa, setup_all_loops
|
||||||
|
|
||||||
# Use the same python as the one this script is being run with
|
# Use the same python as the one this script is being run with
|
||||||
python_interpreter = sys.executable
|
python_interpreter = sys.executable
|
||||||
@ -35,7 +35,7 @@ class MinitoolsTest(AATest):
|
|||||||
# Should be the set of cleanprofile
|
# Should be the set of cleanprofile
|
||||||
self.profile_dir = self.tmpdir + '/profiles'
|
self.profile_dir = self.tmpdir + '/profiles'
|
||||||
shutil.copytree('../../profiles/apparmor.d/', self.profile_dir,
|
shutil.copytree('../../profiles/apparmor.d/', self.profile_dir,
|
||||||
symlinks=True, ignore=shutil.ignore_patterns(*skip_active_profiles))
|
symlinks=True)
|
||||||
|
|
||||||
apparmor.profile_dir = self.profile_dir
|
apparmor.profile_dir = self.profile_dir
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ from apparmor.rule.alias import AliasRule
|
|||||||
from apparmor.rule.boolean import BooleanRule
|
from apparmor.rule.boolean import BooleanRule
|
||||||
from apparmor.rule.include import IncludeRule
|
from apparmor.rule.include import IncludeRule
|
||||||
from apparmor.rule.variable import VariableRule
|
from apparmor.rule.variable import VariableRule
|
||||||
from common_test import AATest, setup_aa, setup_all_loops, write_file, skip_active_profiles
|
from common_test import AATest, setup_aa, setup_all_loops, write_file
|
||||||
|
|
||||||
|
|
||||||
class TestAdd_profile(AATest):
|
class TestAdd_profile(AATest):
|
||||||
@ -430,7 +430,7 @@ class AaTest_get_all_merged_variables(AATest):
|
|||||||
apparmor.aa.loadincludes()
|
apparmor.aa.loadincludes()
|
||||||
# Keep this synced with the list in test-logprof.py and
|
# Keep this synced with the list in test-logprof.py and
|
||||||
# test-minitools.py
|
# test-minitools.py
|
||||||
apparmor.aa.read_profiles(skip_profiles=skip_active_profiles)
|
apparmor.aa.read_profiles()
|
||||||
|
|
||||||
def test_unchanged(self):
|
def test_unchanged(self):
|
||||||
self._load_profiles()
|
self._load_profiles()
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import apparmor.aa as aa
|
import apparmor.aa as aa
|
||||||
from common_test import AATest, setup_aa, setup_all_loops, skip_active_profiles, skip_extra_profiles
|
from common_test import AATest, setup_aa, setup_all_loops
|
||||||
|
|
||||||
|
|
||||||
class TestFoo(AATest):
|
class TestFoo(AATest):
|
||||||
@ -23,12 +23,12 @@ class TestFoo(AATest):
|
|||||||
# (to make sure an empty or non-existing directory won't make this test useless).
|
# (to make sure an empty or non-existing directory won't make this test useless).
|
||||||
|
|
||||||
def test_active_profiles(self):
|
def test_active_profiles(self):
|
||||||
aa.read_profiles(skip_profiles=skip_active_profiles)
|
aa.read_profiles()
|
||||||
|
|
||||||
self.assertGreaterEqual(len(aa.active_profiles.profile_names), 42)
|
self.assertGreaterEqual(len(aa.active_profiles.profile_names), 42)
|
||||||
|
|
||||||
def test_extra_profiles(self):
|
def test_extra_profiles(self):
|
||||||
aa.read_inactive_profiles(skip_profiles=skip_extra_profiles)
|
aa.read_inactive_profiles()
|
||||||
|
|
||||||
self.assertGreaterEqual(len(aa.extra_profiles.profile_names), 100)
|
self.assertGreaterEqual(len(aa.extra_profiles.profile_names), 100)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user