[apparmor] [patch] Move all tests from test-signal_parse.py to test-signal.py

Kshitij Gupta kgupta8592 at gmail.com
Wed Nov 18 22:13:03 UTC 2015


On Sat, Oct 24, 2015 at 6:18 PM, Christian Boltz <apparmor at cboltz.de> wrote:

> Hello,
>
> it's pointless to keep a separate file for those tests - they integrate
> well in test-signal.py.
>
> After the move, test-signal_parse.py is empty and will be deleted.
>
>
> [ 14-move-test-signal_parse-tests-to-test-signal.diff ]
>
> --- utils/test/test-signal.py   2015-10-23 20:12:19.576200988 +0200
> +++ utils/test/test-signal.py   2015-10-24 14:40:45.321428839 +0200
> @@ -227,13 +227,26 @@
>          ('     signal         ,    # foo        '              , 'signal,
> # foo'),
>          ('    audit     signal send,'                          , 'audit
> signal send,'),
>          ('    audit     signal (send  ),'                      , 'audit
> signal send,'),
> -        ('    audit     signal (send , receive ),'                      ,
> 'audit signal (receive send),'),
> +        ('    audit     signal (send , receive ),'             , 'audit
> signal (receive send),'),
>          ('   deny signal         send      set=quit,# foo bar' , 'deny
> signal send set=quit, # foo bar'),
>          ('   deny signal         send      set=(quit),  '      , 'deny
> signal send set=quit,'),
>          ('   deny signal         send      set=(int , quit),'  , 'deny
> signal send set=(int quit),'),
>          ('   deny signal         send      set=(quit, int ),'  , 'deny
> signal send set=(int quit),'),
>          ('   deny signal         send      ,# foo bar'         , 'deny
> signal send, # foo bar'),
>          ('   allow signal             set=int    ,# foo bar'   , 'allow
> signal set=int, # foo bar'),
> +        ('signal,'                                             ,
> 'signal,'),
> +        ('signal (receive),'                                   , 'signal
> receive,'),
> +        ('signal (send),'                                      , 'signal
> send,'),
> +        ('signal (send receive),'                              , 'signal
> (receive send),'),
> +        ('signal r,'                                           , 'signal
> r,'),
> +        ('signal w,'                                           , 'signal
> w,'),
> +        ('signal rw,'                                          , 'signal
> rw,'),
> +        ('signal send set=("hup"),'                            , 'signal
> send set=hup,'),
> +        ('signal (receive) set=kill,'                          , 'signal
> receive set=kill,'),
> +        ('signal w set=(quit int),'                            , 'signal
> w set=(int quit),'),
> +        ('signal receive peer=foo,'                            , 'signal
> receive peer=foo,'),
> +        ('signal (send receive) peer=/usr/bin/bar,'            , 'signal
> (receive send) peer=/usr/bin/bar,'),
> +        ('signal wr set=(pipe, usr1) peer=/sbin/baz,'          , 'signal
> wr set=(pipe usr1) peer=/sbin/baz,'),
>      ]
>
>      def test_write_manually(self):
> --- utils/test/test-signal_parse.py     2015-10-23 15:02:53.710834017 +0200
> +++ utils/test/test-signal_parse.py     2015-10-24 14:41:24.358159030 +0200
> @@ -1,42 +0,0 @@
> -#! /usr/bin/env python
> -# ------------------------------------------------------------------
> -#
> -#    Copyright (C) 2014 Canonical Ltd.
> -#
> -#    This program is free software; you can redistribute it and/or
> -#    modify it under the terms of version 2 of the GNU General Public
> -#    License published by the Free Software Foundation.
> -#
> -# ------------------------------------------------------------------
> -
> -import unittest
> -from common_test import AATest, setup_all_loops
> -
> -from apparmor.rule.signal import SignalRule
> -
> -class AAParseSignalTest(AATest):
> -    def _run_test(self, params, expected):
> -        parsed = SignalRule.parse(params)
> -        self.assertEqual(expected, parsed.get_clean())
> -
> -
> -    tests = [
> -        ('signal,',                     'signal,'),
> -        ('signal (receive),',           'signal receive,'),
> -        ('signal (send),',              'signal send,'),
> -        ('signal (send receive),',      'signal (receive send),'),
> -        ('signal r,',                   'signal r,'),
> -        ('signal w,',                   'signal w,'),
> -        ('signal rw,',                  'signal rw,'),
> -        ('signal send set=("hup"),',    'signal send set=hup,'),
> -        ('signal (receive) set=kill,',  'signal receive set=kill,'),
> -        ('signal w set=(quit int),',    'signal w set=(int quit),'),
> -        ('signal receive peer=foo,',    'signal receive peer=foo,'),
> -        ('signal (send receive) peer=/usr/bin/bar,',    'signal (receive
> send) peer=/usr/bin/bar,'),
> -        ('signal wr set=(pipe, usr1) peer=/sbin/baz,',  'signal wr
> set=(pipe usr1) peer=/sbin/baz,'),
> -    ]
> -
> -
> -setup_all_loops(__name__)
> -if __name__ == '__main__':
> -    unittest.main(verbosity=2)
>
>
>
> Regards,
>
> Christian Boltz
> --
> Yes, I know how much devs hate writing documentation... I was a dev.
> [Carlos E. R. in opensuse-factory]
>
>
> --
> AppArmor mailing list
> AppArmor at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/apparmor
>

Thanks for the patch.

Acked-by: Kshitij Gupta <kgupta8592 at gmail.com>


-- 
Regards,

Kshitij Gupta
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20151119/f288fbdf/attachment-0001.html>


More information about the AppArmor mailing list