[apparmor] test-aa-easyprof.py fails because of UsrMove

Steve Beattie steve at nxnw.org
Sat Mar 1 07:02:49 UTC 2014

[Skipping the issue with UsrMove and ls for the moment.]

On Fri, Feb 28, 2014 at 11:11:02PM +0100, Christian Boltz wrote:
> Even with this fixed, I still get two failures in utils "make check":
> ======================================================================
> FAIL: test_policygroups_dir_relative (__main__.T)
> Test --policy-groups-dir (relative DIR)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "test-aa-easyprof.py", line 240, in test_policygroups_dir_relative
>     self.assertTrue(easyp.dirs['policygroups'] == rel, "Not using specified --policy-groups-dir")
> AssertionError: Not using specified --policy-groups-dir
> ======================================================================
> FAIL: test_templates_dir_relative (__main__.T)
> Test --templates-dir (relative DIR)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "test-aa-easyprof.py", line 363, in test_templates_dir_relative
>     self.assertTrue(easyp.dirs['templates'] == rel, "Not using specified --template-dir")
> AssertionError: Not using specified --template-dir
> ----------------------------------------------------------------------

Unfortunately, I can't reproduce these failures.  So to try to diagnose
this further, you could try modifying test-aa-easyprof.py like so[1]:

=== modified file 'utils/test/test-aa-easyprof.py'
--- utils/test/test-aa-easyprof.py	2014-02-14 01:53:40 +0000
+++ utils/test/test-aa-easyprof.py	2014-03-01 06:37:53 +0000
@@ -168,7 +168,8 @@
         if os.path.exists(self.tmpdir):
             if debugging:
                 sys.stdout.write("%s\n" % self.tmpdir)
-            recursive_rm(self.tmpdir)
+            else:
+                recursive_rm(self.tmpdir)
 # config file tests

and then run test-aa-easyprof.y with the -d argument[2]. You'll want to
capture the output somehow, because then you can search for the tests
that are failing in the output and look for the temporary directory that
they're created in. You can try to manually run aa-easyprof to see how
things are failing; e.g. for the test_policygroups_dir_relative test:

  cd /tmpdir/for/this/test
  PYTHONPATH=/your/utils/path /your/utils/path/aa-easyprof --policy-groups-dir ./relative/ --show-policy-group --policy-groups=test-policygroup

If things are working correctly, you should see:

  # test-policygroup
  #include <abstractions/gnome>
  #include <abstractions/nameservice>

Hope this helps track what's going wrong.

[1] Yeah, we should probably commit something like this. Though again,
    I'd prefer to have the tests keep around their temporary directories
    only on test failure, but the metaclass method I used in the parser
    caching tests isn't easily portable across python 2 and python 3.

[2] Alas, you'll have a whole ton of temporary directories you get
    to clean up afterwards. Unfortunately, because of the work that
    goes on in the __main__ section of the test script, you can't use
    python-nose/nosetests to simply cherry pick out the failing tests,
    so you get them all.

Steve Beattie
<sbeattie at ubuntu.com>
-------------- 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/20140228/12c2bc0c/attachment.pgp>

More information about the AppArmor mailing list