~ubuntu-branches/ubuntu/trusty/apparmor/trusty-updates

« back to all changes in this revision

Viewing changes to utils/test/test-pivot_root_parse.py

  • Committer: Package Import Robot
  • Author(s): Steve Beattie
  • Date: 2015-04-30 12:18:08 UTC
  • mfrom: (72.1.1 trusty-security)
  • Revision ID: package-import@ubuntu.com-20150430121808-ksonjffnoo5ela3r
Tags: 2.8.95~2430-0ubuntu5.2
* debian/patches/php5-Zend_semaphore-lp1401084.patch: allow php5
  abstraction access to Zend opcache files (LP: #1401084)
* debian/patches/dnsmasq-lxc_networking-lp1403468.patch: update
  profile for lxc support (LP: #1403468)
* debian/patches/profiles-texlive_font_generation-lp1010909.patch:
  allow generation of texlive fonts by sanitized-helpers
  (LP: #1010909)
* debian/apport/source_apparmor.py: fix the apparmor apport hook
  so it does not raise an exception if a non-unicode character is
  found in /var/log/kern.log or in /var/log/syslog. This should
  work under python3 or python2.7 (LP: #1304447)
* debian/patches/profiles-dovecot-updates-lp1296667.patch: update
  dovecot profiles to address several missing permissions.
  (LP: #1296667)
* debian/patches/profiles-adjust_X_for_lightdm-lp1339727.patch:
  adjust X abstraction for LightDM xauthority location (LP: #1339727)
* debian/patches/libapparmor-fix_memory_leaks-lp1340927.patch; fix
  memory leaks in log parsing component of libapparmor (LP: #1340927)
* debian/patches/libapparmor-another_audit_format-lp1399027.patch:
  add support for another log format style (LP: #1399027)
* debian/patches/tests-workaround_for_unix_socket_change-lp1425398.patch:
  work around apparmor kernel behavioral change in regression tests
  (LP: #1425398)
* debian/control: add breaks on python3-apparmor against older
  apparmor-utils that used to be where python bits lived
  (LP: #1373259)
* debian/patches/utils-update_to_2.9.2.patch: update the python
  utilities to the upstream 2.9.2 (LP: #1449769, incorporating a
  large number of fixes and improvements, including:
  - fix aa-genprof traceback with apparmor 2.8.95 (LP: #1294797)
  - fix aa-genprof crashing when selecting scan on Ubuntu 14.04 server
    (LP: #1319829)
  - make aa-logprof read profile instead of program binary
    (LP: #1317176, LP: #1324154)
  - aa-complain: don't traceback when marking multiple profiles
    (LP: #1378095)
  - make python tools able to parse mounts with UTF-8 non-ascii
    characters (LP: #1310598)

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
import apparmor.aa as aa
13
13
import unittest
14
 
 
15
 
class AAParsePivotRootTest(unittest.TestCase):
16
 
 
17
 
    def _test_parse_pivot_root_rule(self, rule):
18
 
        pivot_root = aa.parse_pivot_root_rule(rule)
19
 
        print(pivot_root.serialize())
20
 
        self.assertEqual(rule, pivot_root.serialize(),
21
 
                'pivot_root object returned "%s", expected "%s"' % (pivot_root.serialize(), rule))
22
 
 
23
 
    def test_parse_plain_pivot_root_rule(self):
24
 
        self._test_parse_pivot_root_rule('pivot_root,')
25
 
 
26
 
    def test_parse_old_pivot_root_rule(self):
27
 
        self._test_parse_pivot_root_rule('pivot_root /old,')
28
 
 
29
 
    def test_parse_new_pivot_root_rule(self):
30
 
        self._test_parse_pivot_root_rule('pivot_root /old /new,')
31
 
 
32
 
    def test_parse_child_pivot_root_rule(self):
33
 
        self._test_parse_pivot_root_rule('pivot_root /old /new -> /usr/bin/child,')
 
14
from common_test import AAParseTest, setup_regex_tests
 
15
 
 
16
class AAParsePivotRootTest(AAParseTest):
 
17
    def setUp(self):
 
18
        self.parse_function = aa.parse_pivot_root_rule
 
19
 
 
20
    tests = [
 
21
        ('pivot_root,', 'pivot_root base keyword'),
 
22
        ('pivot_root /old,', 'pivot_root oldroot rule'),
 
23
        ('pivot_root /old /new,', 'pivot_root old and new root rule'),
 
24
        ('pivot_root /old /new -> /usr/bin/child,', 'pivot_root child rule'),
 
25
    ]
34
26
 
35
27
if __name__ == '__main__':
36
 
    unittest.main()
 
28
    setup_regex_tests(AAParsePivotRootTest)
 
29
    unittest.main(verbosity=2)