apparmor/utils/test
Christian Boltz 7d86bf9fe2
severity: replace load_variables() with set_variables()
Add set_variables() to severity.py to set the variables for severity
rating. It typically gets the data from the get_all_merged_variables()
result.

This replaces the slightly broken load_variables() that parsed profile
files for variables. (For example, parsing "@{foo} = /bar" resulted
in a variable name "@{foo} " with trailing space.)

Also adjust aa.py and the severity tests to use set_variables() (with
get_all_merged_variables()) instead of load_variables().

This also re-adds the checks that were removed in the "Store variables
in active_profiles (ProfileList)" commit earlier, while still fixing
lp:1331856.

With this change, unload_variables() becomes useless (the variables get
overwritten in set_variables() anyway), drop it and its calls.

Note that load_variables() silently ignored non-existing files while the
get_all_merged_variables() call only works for existing files that are
known to active_profiles. Since the input of ask_the_questions() and
ask_exec() comes from log_dict (= audit.log or a profile to merge), add
a check if that profile actually exists in the set of active profiles.

Also adjust the severity tests to use set_variables().

Finally, drop the tests that check for handling non-existing include
files, redefining and adding to non-existing variables - all these
things get now handled in include_list_recursive() and
get_all_merged_variables() and their tests.

Fixes: https://bugs.launchpad.net/apparmor/+bug/1331856
2020-05-27 13:32:44 +02:00
..
cleanprof_test.in Let aa-cleanprof remove duplicate preamble rules 2020-05-20 18:54:53 +02:00
cleanprof_test.out Store variables in active_profiles (ProfileList) 2020-05-27 13:32:44 +02:00
common_test.py utils: Require apparmor.aa users to call init_aa() 2017-03-02 21:21:53 +00:00
easyprof.conf This patchset is broken into 4 parts: 2012-05-07 22:37:48 -07:00
fake_ldd utils: fixup test-aa.py tests that fail due to usr-merge 2019-02-12 23:17:59 -08:00
logprof.conf Drop profile repo code from utils 2020-05-05 13:09:16 +02:00
Makefile Re-implement aa-notify in Python (Closes: #16) 2019-04-21 18:37:10 +03:00
minitools_test.py change_profile_flags: use ', ' as flags delimiter 2018-07-25 21:33:22 +02:00
runtests-py2.sh utils/tests: fix bashisms in runtests-py2.sh 2014-09-03 13:00:33 -07:00
runtests-py3.sh fix utils/test/runtests-py*.sh exitcode 2014-10-03 11:48:21 +02:00
severity.db Update perl abstraction, logprof.conf, severity.db and tests for Debian/Ubuntu 2014-08-20 19:14:24 -05:00
severity_broken.db Update perl abstraction, logprof.conf, severity.db and tests for Debian/Ubuntu 2014-08-20 19:14:24 -05:00
test-aa-cli-bootstrap.py Add tests for shared aa library functions used in command line scripts 2019-04-21 18:37:10 +03:00
test-aa-decode.py Bugfix aa-decode test: Get stderr correctly, don't ignore stderr contents 2019-02-05 00:15:13 +02:00
test-aa-easyprof.py Replace deprecated assertEquals with assertEqual 2019-02-26 21:27:00 +01:00
test-aa-notify.py aa-notify: Use fixed output width in tests so results always look same 2019-04-21 18:37:10 +03:00
test-aa.py Drop now unused store_list_var() and its tests 2020-05-27 13:32:44 +02:00
test-aare.py test that '\*' from audit.log gets correctly escaped 2020-04-13 19:46:05 +02:00
test-abi.py Add AbiRule and testsuite 2020-05-09 21:02:06 +02:00
test-baserule.py make utils tests less verbose 2018-04-08 20:18:30 +02:00
test-capability.py Remove superfluous self-cast in Invalid*Test 2020-05-02 22:13:34 +02:00
test-change_profile.py Remove superfluous self-cast in Invalid*Test 2020-05-02 22:13:34 +02:00
test-common.py add a split_name() function to split a profile name 2019-05-09 17:15:35 +02:00
test-config.py Drop profile repo code from utils 2020-05-05 13:09:16 +02:00
test-dbus.py Remove superfluous self-cast in Invalid*Test 2020-05-02 22:13:34 +02:00
test-example.py add an example for setup_aa() to test-example.py 2019-02-10 23:24:29 +01:00
test-file.py Remove superfluous self-cast in Invalid*Test 2020-05-02 22:13:34 +02:00
test-include.py IncludeRuleset: add get_all_full_paths() 2020-05-20 18:54:53 +02:00
test-libapparmor-test_multi.py Get rid of the 'filelist' hasher() 2020-05-27 13:32:44 +02:00
test-logparser.py Drop unused 'pid' parameter from ReadLog.__init__() 2019-05-09 17:15:35 +02:00
test-mount_parse.py make utils tests less verbose 2018-04-08 20:18:30 +02:00
test-network.py Remove superfluous self-cast in Invalid*Test 2020-05-02 22:13:34 +02:00
test-parser-simple-tests.py Store variables in active_profiles (ProfileList) 2020-05-27 13:32:44 +02:00
test-pivot_root_parse.py make utils tests less verbose 2018-04-08 20:18:30 +02:00
test-profile-list.py severity: replace load_variables() with set_variables() 2020-05-27 13:32:44 +02:00
test-profile-storage.py extend add_or_remove_flag() to handle str for old flags 2018-07-25 20:59:34 +02:00
test-ptrace.py Remove superfluous self-cast in Invalid*Test 2020-05-02 22:13:34 +02:00
test-regex_matches.py re_match_include_parse() raise bug exceptions only for include 2020-05-09 21:02:06 +02:00
test-rlimit.py Remove superfluous self-cast in Invalid*Test 2020-05-02 22:13:34 +02:00
test-severity.py severity: replace load_variables() with set_variables() 2020-05-27 13:32:44 +02:00
test-signal.py Remove superfluous self-cast in Invalid*Test 2020-05-02 22:13:34 +02:00
test-translations.py Drop profile repo code from utils 2020-05-05 13:09:16 +02:00
test-unix_parse.py make utils tests less verbose 2018-04-08 20:18:30 +02:00
test-variable.py VariableRuleset: add get_merged_variables() 2020-05-27 13:32:44 +02:00