[apparmor] [patch] Move str_to_mode() tests to test-aamode.py

Seth Arnold seth.arnold at canonical.com
Tue Oct 11 19:39:58 UTC 2016


On Sun, Oct 09, 2016 at 08:32:48PM +0200, Christian Boltz wrote:
> +class AamodeTest_str_to_mode(AATest):
> +    tests = [
> +        ('x',   apparmor.aamode.AA_MAY_EXEC),
> +        ('w',   apparmor.aamode.AA_MAY_WRITE),
> +        ('r',   apparmor.aamode.AA_MAY_READ),
> +        ('a',   apparmor.aamode.AA_MAY_APPEND),
> +        ('l',   apparmor.aamode.AA_MAY_LINK),
> +        ('k',   apparmor.aamode.AA_MAY_LOCK),
> +        ('m',   apparmor.aamode.AA_EXEC_MMAP),
> +        ('i',   apparmor.aamode.AA_EXEC_INHERIT),
> +        ('u',   apparmor.aamode.AA_EXEC_UNCONFINED | apparmor.aamode.AA_EXEC_UNSAFE),
> +        ('U',   apparmor.aamode.AA_EXEC_UNCONFINED),
> +        ('p',   apparmor.aamode.AA_EXEC_PROFILE | apparmor.aamode.AA_EXEC_UNSAFE),
> +        ('P',   apparmor.aamode.AA_EXEC_PROFILE),
> +        ('c',   apparmor.aamode.AA_EXEC_CHILD | apparmor.aamode.AA_EXEC_UNSAFE),
> +        ('C',   apparmor.aamode.AA_EXEC_CHILD),
> +    ]

I didn't find where this 'tests' array is actually used in the patch.

Also, 'tests' is a bit generic -- is there a better description of what
this array mapping actually provides?

A dictionary would allow quicker lookups from key to value; an array
makes more sense if it's only ever iterated, or if lookups can go both
directions. But since I didn't find any use of this array it's hard to
guess which would be better. :)

Thanks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20161011/dde6106b/attachment.pgp>


More information about the AppArmor mailing list