[apparmor] [patch] move strip_quotes from aa.py to regex.py

Steve Beattie steve at nxnw.org
Tue Mar 3 17:44:49 UTC 2015


On Tue, Mar 03, 2015 at 12:58:49AM +0100, Christian Boltz wrote:
> Hello,
> 
> the upcoming function parse_profile_start() (which is a wrapper around 
> the updated RE_PROFILE_START, and will live in regex.py) needs 
> strip_profile(), but importing it from aa.py fails with an import loop.
> Therefore this patch moves strip_quotes() from aa.py to regex.py and 
> re-imports it into aa.py.
> 
> As a bonus, the patch also adds some tests for strip_quotes() ;-)
> 
> 
> I propose this patch for trunk and 2.9
> (which also explains why I move the function to regex.py - 
> rule/__init__.py would be a better place, but makes backporting to 2.9
> more difficult)
> 

Acked-by: Steve Beattie <steve at nxnw.org> for both trunk and
2.9, as long as the following additional change is made to
utils/test/test-regex_matches.py

Index: b/utils/test/test-regex_matches.py
===================================================================
--- a/utils/test/test-regex_matches.py
+++ b/utils/test/test-regex_matches.py
@@ -382,6 +403,7 @@ if __name__ == '__main__':
     test_suite = unittest.TestSuite()
     test_suite.addTest(unittest.TestLoader().loadTestsFromTestCase(AARegexHasComma))
     test_suite.addTest(unittest.TestLoader().loadTestsFromTestCase(AARegexSplitComment))
+    test_suite.addTest(unittest.TestLoader().loadTestsFromTestCase(TestStripQuotes))
 
     for tests in (AARegexCapability, AARegexPath, AARegexBareFile,
                   AARegexDbus, AARegexMount, AARegexUnix,

as otherwise the added testscases don't get run (I noticed this by
generating the html coverage report and noticing that part of
strip_quotes() was not getting exercised by the tests).

Thanks.

-- 
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/20150303/c43a41c8/attachment.pgp>


More information about the AppArmor mailing list