mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 01:57:43 +00:00
Merge profiles: only include tests extras/abstractions/ if it exists
profiles make check was showing an error because profiles/extras/abstractions didn't exist, so only include tests for it if it exists. This commit also deduplicates the abstractions test. Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com> MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1687 Approved-by: John Johansen <john@jjmx.net> Merged-by: John Johansen <john@jjmx.net>
This commit is contained in:
commit
e55646c41c
@ -32,6 +32,11 @@ PROFILES_SOURCE=./apparmor.d
|
|||||||
ABSTRACTIONS_SOURCE=./apparmor.d/abstractions
|
ABSTRACTIONS_SOURCE=./apparmor.d/abstractions
|
||||||
EXTRAS_SOURCE=./apparmor/profiles/extras
|
EXTRAS_SOURCE=./apparmor/profiles/extras
|
||||||
EXTRAS_ABSTRACTIONS_SOURCE=./apparmor/profiles/extras/abstractions
|
EXTRAS_ABSTRACTIONS_SOURCE=./apparmor/profiles/extras/abstractions
|
||||||
|
ABSTRACTIONS=${ABSTRACTIONS_SOURCE}
|
||||||
|
# extras abstractions might not exist
|
||||||
|
ifneq ($(wildcard ${EXTRAS_ABSTRACTIONS_SOURCE}),)
|
||||||
|
ABSTRACTIONS:=${ABSTRACTIONS} ${EXTRAS_ABSTRACTIONS_SOURCE}
|
||||||
|
endif
|
||||||
|
|
||||||
ifdef USE_SYSTEM
|
ifdef USE_SYSTEM
|
||||||
PYTHONPATH=
|
PYTHONPATH=
|
||||||
@ -134,19 +139,13 @@ check-parser: test-dependencies
|
|||||||
done
|
done
|
||||||
|
|
||||||
@echo "*** Checking abstractions from ${ABSTRACTIONS_SOURCE} against apparmor_parser"
|
@echo "*** Checking abstractions from ${ABSTRACTIONS_SOURCE} against apparmor_parser"
|
||||||
$(Q)for abstraction in $$(find ${ABSTRACTIONS_SOURCE} -maxdepth 1 -type f -printf '%P\n') ; do \
|
$(Q)for abstraction_path in ${ABSTRACTIONS}; do \
|
||||||
[ -n "${VERBOSE}" ] && echo "Testing ${ABSTRACTIONS_SOURCE}/$${abstraction}" ; \
|
for abstraction in $$(find $${abstraction_path} -maxdepth 1 -type f -printf '%P\n') ; do \
|
||||||
echo "abi <abi/4.0>, include <tunables/global> profile test { include <abstractions/$${abstraction}> }" \
|
[ -n "${VERBOSE}" ] && echo "Testing $${abstraction_path}/$${abstraction}" ; \
|
||||||
| ${PARSER} --config-file=../parser/tst/parser.conf -S -b ${PROFILES_SOURCE} > /dev/null \
|
echo "abi <abi/4.0>, include <tunables/global> profile test { include <abstractions/$${abstraction}> }" \
|
||||||
|| exit 1; \
|
| ${PARSER} --config-file=../parser/tst/parser.conf -S -b ${PROFILES_SOURCE} -I $${abstraction_path}/../ > /dev/null \
|
||||||
done
|
|| exit 1; \
|
||||||
|
done; \
|
||||||
@echo "*** Checking abstractions from ${EXTRAS_ABSTRACTIONS_SOURCE} against apparmor_parser"
|
|
||||||
$(Q)for abstraction in $$(find ${EXTRAS_ABSTRACTIONS_SOURCE} -maxdepth 1 -type f -printf '%P\n') ; do \
|
|
||||||
[ -n "${VERBOSE}" ] && echo "Testing ${EXTRAS_ABSTRACTIONS_SOURCE}/$${abstraction}" ; \
|
|
||||||
echo "abi <abi/4.0>, include <tunables/global> profile test { include <abstractions/$${abstraction}> }" \
|
|
||||||
| ${PARSER} --config-file=../parser/tst/parser.conf -S -b ${PROFILES_SOURCE} -I ${EXTRAS_SOURCE} > /dev/null \
|
|
||||||
|| exit 1; \
|
|
||||||
done
|
done
|
||||||
|
|
||||||
.PHONY: check-logprof
|
.PHONY: check-logprof
|
||||||
@ -157,7 +156,7 @@ check-logprof: test-dependencies
|
|||||||
.PHONY: check-abstractions.d
|
.PHONY: check-abstractions.d
|
||||||
check-abstractions.d:
|
check-abstractions.d:
|
||||||
@echo "*** Checking if all abstractions (with a few exceptions) contain 'include if exists <abstractions/*.d>' and 'abi <abi/4.0>,'"
|
@echo "*** Checking if all abstractions (with a few exceptions) contain 'include if exists <abstractions/*.d>' and 'abi <abi/4.0>,'"
|
||||||
$(Q)for file in $$(find ${ABSTRACTIONS_SOURCE} ${EXTRAS_ABSTRACTIONS_SOURCE} -maxdepth 1 -type f) ; do \
|
$(Q)for file in $$(find ${ABSTRACTIONS} -maxdepth 1 -type f) ; do \
|
||||||
case "$${file}" in */ubuntu-browsers | */ubuntu-helpers) continue ;; esac ; \
|
case "$${file}" in */ubuntu-browsers | */ubuntu-helpers) continue ;; esac ; \
|
||||||
include="include if exists <abstractions/$$(basename $${file}).d>" ; \
|
include="include if exists <abstractions/$$(basename $${file}).d>" ; \
|
||||||
grep -q "^ $${include}\$$" $${file} || { echo "$${file} does not contain '$${include}'"; exit 1; } ; \
|
grep -q "^ $${include}\$$" $${file} || { echo "$${file} does not contain '$${include}'"; exit 1; } ; \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user