[apparmor] test-aa-easyprof.py fails because of UsrMove
Kshitij Gupta
kgupta8592 at gmail.com
Sat Mar 1 19:03:01 UTC 2014
Hello,
On Sat, Mar 1, 2014 at 3:41 AM, Christian Boltz <apparmor at cboltz.de> wrote:
> Hello,
>
> test-aa-easyprof.py depends on /bin/ls being a real binary.
> In practise, it is a symlink to /usr/bin/ls on some distributions.
>
> The patch below fixes this for me, but I know it isn't a good solution
> because it breaks on systems that didn't follow UsrMove and still have
> /bin/ls as real binary.
>
How about using os.path.islink() to determine if the given system
followed UsrMove or not and accordingly setting test up?
Something on the lines of:
ls_path='/bin/ls'
if os.path.islink(ls_path):
ls_path='/usr/bin/ls'
and then use ls_path everywhere.
> Please take this as a bugreport only - I don't expect an Ack for it, but
> hope for someone to come up with a better patch ;-)
>
>
> === modified file 'utils/test/test-aa-easyprof.py'
> --- utils/test/test-aa-easyprof.py 2014-02-14 01:53:40 +0000
> +++ utils/test/test-aa-easyprof.py 2014-02-28 21:54:06 +0000
> @@ -424,14 +424,14 @@
> #
> def test_binary_without_profile_name(self):
> '''Test binary (<binary> { })'''
> - easyprof.AppArmorEasyProfile('/bin/ls', self.options)
> + easyprof.AppArmorEasyProfile('/usr/bin/ls', self.options)
>
> def test_binary_with_profile_name(self):
> '''Test binary (profile <name> <binary> { })'''
> args = self.full_args
> args += ['--profile-name=some-profile-name']
> (self.options, self.args) = easyprof.parse_args(args)
> - easyprof.AppArmorEasyProfile('/bin/ls', self.options)
> + easyprof.AppArmorEasyProfile('/usr/bin/ls', self.options)
>
> def test_binary_omitted_with_profile_name(self):
> '''Test binary (profile <name> { })'''
> @@ -1206,7 +1206,7 @@
> def test_gen_manifest_policy_with_binary_with_profile_name(self):
> '''Test gen_manifest_policy (binary with profile name)'''
> m = Manifest("test_gen_manifest_policy")
> - m.add_binary('/bin/ls')
> + m.add_binary('/usr/bin/ls')
> self._gen_manifest_policy(m)
>
> def test_gen_manifest_policy_without_binary_with_profile_name(self):
>
>
> Even with this fixed, I still get two failures in utils "make check":
>
> ======================================================================
> FAIL: test_policygroups_dir_relative (__main__.T)
> Test --policy-groups-dir (relative DIR)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "test-aa-easyprof.py", line 240, in test_policygroups_dir_relative
> self.assertTrue(easyp.dirs['policygroups'] == rel, "Not using specified --policy-groups-dir")
> AssertionError: Not using specified --policy-groups-dir
>
> ======================================================================
> FAIL: test_templates_dir_relative (__main__.T)
> Test --templates-dir (relative DIR)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "test-aa-easyprof.py", line 363, in test_templates_dir_relative
> self.assertTrue(easyp.dirs['templates'] == rel, "Not using specified --template-dir")
> AssertionError: Not using specified --template-dir
>
> ----------------------------------------------------------------------
>
>
>
> Regards,
>
> Christian Boltz
> --
> Die Lösung ist denkbar einfach und naheliegend: Ich bin ein Trottel.
> Aber das wussten wir ja schon. :-) [Ratti in suse-linux]
>
>
> --
> AppArmor mailing list
> AppArmor at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
More information about the AppArmor
mailing list