regression tests: fix aa_policy_cache when using system parser

Merge branch 'fix-policy-cache-regression-tests' into 'master'

When using the system parser ${parser_config} will be empty and so if this
is unconditionally passed as an argument to the parser then this gets in
interpreted as the name of a file to be compiled and hence the parser just
prints:

File  not found, skipping...
File  not found, skipping...
File  not found, skipping...
...

for all the aa_policy_cache tests - instead fix this to pass a single args
argument to the parser which will only include parser_config if it is not
empty.

This fixes the regression tests to run to completion without error when
USE_SYSTEM=1 is set.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/782
Signed-off-by: Alex Murray <alex.murray@canonical.com>
Acked-by: Steve Beattie <steve@nxnw.org>
This commit is contained in:
Steve Beattie 2021-08-12 05:32:07 +00:00
commit 8d0b48df12

View file

@ -56,7 +56,13 @@ create_cache_files()
do
cachefile="${cachedir}/${policy}"
echo "profile $policy { /f r, }" | ${subdomain} "${parser_config}" -qS > "$cachefile"
args="-qS"
if [ -n "${parser_config}" ]
then
args="${args} ${parser_config}"
fi
echo "profile $policy { /f r, }" | ${subdomain} "${args}" > "$cachefile"
done
}