... and tests for it. This replaces the old code that just stores the full rule as text. We also get rid of the old ['allow'] and ['deny'] items in ProfileStorage, the handling of old write functions, and the last usage of _Raw_Rule (and therefore _Raw_Rule itsself). Also delete the old test-pivot_root_parse.py which relied on the ancient code, and even used a wrong syntax in its test rules. Oh, and aa-logprof can now ask about pivot_root events. See the individual commits for details. MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1232 Approved-by: Georgia Garcia <georgia.garcia@canonical.com> Merged-by: Christian Boltz <apparmor@cboltz.de>
Test data generated elsewhere
The tests in parser
generate additional test profiles in
parser/tst/simple_tests/
: see gen-dbus.py
and gen-xtrans.py
.
utils/test/test-parser-simple-tests.py
uses this test data when it is
available. If this test data has not been generated, this test will not
complain: it will simply exercise fewer test profiles.
Running individual tests
Python's unittest allows individual tests to be executed by specifying the class name and the test on the command line. When running tests individually, the unittest framework executes the "setUp" and "tearDown" methods automatically. For more information, refer to the unittest documentation.
Make sure to set the environment variables pointing to the in-tree apparmor modules, and the in-tree libapparmor and its python wrapper:
$ export PYTHONPATH=..:../../libraries/libapparmor/swig/python/build/$(/usr/bin/python3 ../../libraries/libapparmor/swig/python/test/buildpath.py)
$ export __AA_CONFDIR=.
To execute the test individually, run:
$ python3 ./test-tile.py ClassFoo.test_bar