mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 00:14:44 +01:00
Merge utils: test: various fixes for utils testing in Ubuntu packaging
The first patch fixes a `test-aa-notify.py` `TypeError` when `APPARMOR_NOTIFY` and `__AA_CONFDIR` are both specified, which is something that was broken all this time. The second patch ensures that `aa-notify` in the test suite is run using the same Python interpreter that the test suite itself is run with, which is necessary for testing the utils under different Pythons. The third patch does analogous modifications to the minitools tests that launch `aa-audit`, `aa-complain`, etc. Signed-off-by: Ryan Lee <ryan.lee@canonical.com> MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1498 Approved-by: Georgia Garcia <georgia.garcia@canonical.com> Merged-by: Georgia Garcia <georgia.garcia@canonical.com>
This commit is contained in:
commit
625a919bb8
2 changed files with 10 additions and 2 deletions
|
@ -14,6 +14,7 @@ import os
|
|||
import pwd
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import unittest
|
||||
from tempfile import NamedTemporaryFile
|
||||
|
@ -602,7 +603,10 @@ setup_aa(aa) # Wrapper for aa.init_aa()
|
|||
setup_all_loops(__name__)
|
||||
if __name__ == '__main__':
|
||||
if 'APPARMOR_NOTIFY' in os.environ:
|
||||
aanotify_bin = os.environ['APPARMOR_NOTIFY']
|
||||
aanotify_bin = [os.environ['APPARMOR_NOTIFY']]
|
||||
|
||||
if sys.executable:
|
||||
aanotify_bin = [sys.executable] + aanotify_bin
|
||||
|
||||
if '__AA_CONFDIR' in os.environ:
|
||||
aanotify_bin = aanotify_bin + ['--configdir', os.getenv('__AA_CONFDIR')]
|
||||
|
|
|
@ -14,12 +14,16 @@
|
|||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
import apparmor.aa as apparmor
|
||||
from common_test import AATest, read_file, write_file, setup_aa, setup_all_loops
|
||||
|
||||
python_interpreter = 'python3'
|
||||
# Use the same python as the one this script is being run with
|
||||
python_interpreter = sys.executable
|
||||
if not python_interpreter:
|
||||
python_interpreter = 'python3'
|
||||
|
||||
|
||||
class MinitoolsTest(AATest):
|
||||
|
|
Loading…
Add table
Reference in a new issue