[apparmor] [PATCH v2 0/8] Adjust the utils tests to test what's in the source tree

Tyler Hicks tyhicks at canonical.com
Wed Mar 1 20:51:58 UTC 2017


The utils tests, ran via $(make -C utils/ check), have long suffered from
requiring files which originate in the AppArmor source tree to be installed
in a system-wide manner. Some examples of files that are assumed to be
installed in system-wide locations are profiles, abstractions, configuration
files for the utils, and the parser itself. This patch set adjusts the utils
tests to, by default, utilize the files in the source tree rather than looking
outside of the source tree. This drove some changes into the utils themselves
in the case of aa-easyprof.

With this patch set applied, I can successfully perform a run of the utils
tests in a minimal, pristine Ubuntu Zesty chroot containing no installed
AppArmor packages.

For developers that want to continue testing against the system packages, the
USE_SYSTEM=1 make variable can be passed to the make command.

* Changes since v1:
  - Rewrote the third patch from using an env var to set a non-default config
    directory to requiring that a new init_aa() method be called when using the
    apparmor.aa module, as requested by cboltz.
  - Separately committed the fourth patch, titled "Fix failing tests in
    test-aa.py", and dropped it from this patch set.
  - Wrapped the changes to the aa-easyprof man page at 80 chars
  - Added a new patch to the series, patch 8, which fixes flaky test results in
    test-aa-easyprof.py

Tyler

Tyler Hicks (8):
  utils: Improve error messages when profiles/parser is not found
  utils: Update the logprof.conf in the test dir to point to in-tree paths
  utils: Require apparmor.aa users to call init_aa()
  utils: Accept parser base and include options in aa-easyprof
  utils: Set parser base path according to USE_SYSTEM make variable
  utils: Add option to aa-easyprof to specify the apparmor_parser path
  utils: Set parser executable path according to USE_SYSTEM make variable
  utils: Fix apparmor.easyprof import in test-aa-easyprof.py

 utils/aa-easyprof.pod                     |  16 ++++
 utils/aa-genprof                          |   1 +
 utils/aa-logprof                          |   1 +
 utils/aa-mergeprof                        |   3 +
 utils/aa-unconfined                       |   1 +
 utils/apparmor/aa.py                      |  43 ++++++----
 utils/apparmor/cleanprofile.py            |   1 +
 utils/apparmor/easyprof.py                |  64 +++++++++++----
 utils/apparmor/tools.py                   |   2 +
 utils/test/Makefile                       |  10 ++-
 utils/test/common_test.py                 |  11 +++
 utils/test/logprof.conf                   |   6 +-
 utils/test/minitools_test.py              |   3 +-
 utils/test/test-aa-easyprof.py            | 131 ++++++++++++++++++++++++------
 utils/test/test-aa.py                     |   3 +-
 utils/test/test-config.py                 |   2 +-
 utils/test/test-libapparmor-test_multi.py |   3 +-
 utils/test/test-mount_parse.py            |   3 +-
 utils/test/test-parser-simple-tests.py    |   3 +-
 utils/test/test-pivot_root_parse.py       |   3 +-
 utils/test/test-regex_matches.py          |   3 +-
 utils/test/test-unix_parse.py             |   3 +-
 22 files changed, 247 insertions(+), 69 deletions(-)

-- 
2.7.4




More information about the AppArmor mailing list