[apparmor] [patch] add tests for aa.py check_for_apparmor()

Steve Beattie steve at nxnw.org
Thu Nov 27 20:24:18 UTC 2014


On Thu, Nov 27, 2014 at 07:02:11PM +0100, Christian Boltz wrote:
> this patch adds some tests for aa.py check_for_apparmor().
> 
> It also changes check_for_apparmor() to allow easier testing by optionally 
> specifying alternative locations for /proc/filesystems and /proc/mounts 
> as parameter.
> 
> I ran this testcase also with the old code (before applying Peter's patch). 
> The old code raised an unexpected TypeError in
>     if not valid_path(aa_mountpoint + '/profiles'):
> if aa_mountpoint was None. After temporarily fixing that in my local 
> copy, all tests passed. (No patch for that since Peter's patch fixed 
> that anyway.)
> 
> Needless to say that the tests also pass with Peter's patch applied.
> 
> Also note that the code in check_for_apparmor() differs from what the 
> comment says - valid_path() only does syntax checks, but doesn't 
> check if the directory exists. I added a comment saying exactly that. 
> 
> Currently things could explode if securityfs is mounted, but AppArmor 
> is disabled in the kernel (assumption based on reading the code, not 
> tested). Fixing that is worth another patch ;-) - any volunteers?

> [ add-aa.py-check_for_apparmor-tests.diff ]

Acked-by: Steve Beattie <steve at nxnw.org>

Thanks! I really appreciate the effort of going in and backfilling
tests.

-- 
Steve Beattie
<sbeattie at ubuntu.com>
http://NxNW.org/~steve/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20141127/1a3adb77/attachment-0001.pgp>


More information about the AppArmor mailing list