utils: fixup test-aa.py tests that fail due to usr-merge

Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
This commit is contained in:
Steve Beattie 2019-02-01 00:27:17 -08:00
parent f2c0a11327
commit 45c26214cc
Failed to generate hash of commit
2 changed files with 6 additions and 6 deletions

View file

@ -5,7 +5,7 @@ import sys
if len(sys.argv) != 2:
raise Exception('wrong number of arguments in fake_ldd')
if sys.argv[1] == '/AATest/bin/bash' or sys.argv[1] == '/bin/bash':
if sys.argv[1] in ['/AATest/bin/bash', '/bin/bash', '/usr/bin/bash']:
print(' linux-vdso.so.1 (0x00007ffcf97f4000)')
print(' libreadline.so.6 => /AATest/lib64/libreadline.so.6 (0x00007f2c41324000)')
print(' libtinfo.so.6 => /AATest/lib64/libtinfo.so.6 (0x00007f2c410f9000)')

View file

@ -135,6 +135,9 @@ class AaTest_create_new_profile(AATest):
apparmor.aa.load_include('abstractions/bash')
exp_interpreter_path, exp_abstraction = expected
# damn symlinks!
if exp_interpreter_path:
exp_interpreter_path = os.path.realpath(exp_interpreter_path)
program = self.writeTmpfile('script', params)
profile = create_new_profile(program)
@ -178,11 +181,8 @@ class AaTest_get_interpreter_and_abstraction(AATest):
interpreter_path, abstraction = get_interpreter_and_abstraction(program)
# damn symlinks!
if exp_interpreter_path and os.path.islink(exp_interpreter_path):
dirname = os.path.dirname(exp_interpreter_path)
exp_interpreter_path = os.readlink(exp_interpreter_path)
if not exp_interpreter_path.startswith('/'):
exp_interpreter_path = os.path.join(dirname, exp_interpreter_path)
if exp_interpreter_path:
exp_interpreter_path = os.path.realpath(exp_interpreter_path)
self.assertEqual(interpreter_path, exp_interpreter_path)
self.assertEqual(abstraction, exp_abstraction)