[apparmor] [patch] AATest: don't limit diff length

Steve Beattie steve at nxnw.org
Mon Apr 13 19:29:55 UTC 2015


On Sat, Apr 11, 2015 at 08:23:09PM +0200, Christian Boltz wrote:
> this patch adds setUp() to AATest that sets "self.maxDiff = None" 
> (unlimited). This gives us unlimited array diffs everywhere where AATest
> is used.

> === modified file utils/test/common_test.py
> --- utils/test/common_test.py   2015-04-03 17:41:54.632932445 +0200
> +++ utils/test/common_test.py   2015-04-11 20:06:33.272044715 +0200
> @@ -39,6 +39,9 @@
>  
>  
>  class AATest(unittest.TestCase):
> +    def setUp(self):
> +        self.maxDiff = None
> +
>      tests = []
>  
>  class AAParseTest(unittest.TestCase):

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

> Also replace several setUp() functions in test-regex_matches.py that
> just set a class variable with setting the class variable directly.
> This avoids that the shiny new AATest setUp() gets overwritten.

This part, NACK. This undoes the bit from
https://lists.ubuntu.com/archives/apparmor/2014-August/006276.html (and
acked in
https://lists.ubuntu.com/archives/apparmor/2014-September/006311.html ).

The better way to fix this I think would be to do e.g.

> === modified file utils/test/test-regex_matches.py
> --- utils/test/test-regex_matches.py    2015-04-03 17:41:54.634932327 +0200
> +++ utils/test/test-regex_matches.py    2015-04-11 20:14:03.718860436 +0200
> @@ -203,8 +203,7 @@
>  class AARegexCapability(AARegexTest):
>      '''Tests for RE_PROFILE_CAP'''
>  
>      def setUp(self):
> +        super(AARegexTest, self).setUp()
>          self.regex = aa.RE_PROFILE_CAP
>  
>      tests = [
>          ('   capability net_raw,', (None, None, 'net_raw', 'net_raw', None)),

Annoyingly, python2.7 requires explicit arguments, and when doing so, it
won't work to reference AATest directly if there's an intermediate class
in the hierarchy, like AARegexTest here (tested via using a print()
statement in AATest's setUp() method).

-- 
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/20150413/a2eccb78/attachment.pgp>


More information about the AppArmor mailing list