mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-31 14:25:52 +00:00
Merge Assorted fixes for test suite portability
I've been working on improved end-to-end testing of AppArmor on a number of popular Linux distributions. My first run contains Debian, Ubuntu and openSUSE. This branch contains three small fixes that, mainly, allow running more tests on openSUSE Tumbleweed. MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1431 Approved-by: Georgia Garcia <georgia.garcia@canonical.com> Approved-by: Christian Boltz <apparmor@cboltz.de> Merged-by: Christian Boltz <apparmor@cboltz.de>
This commit is contained in:
@@ -35,10 +35,7 @@ VERSION=$(shell cat $(COMMONDIR)/Version)
|
||||
pathsearch = $(firstword $(wildcard $(addsuffix /$(1),$(subst :, ,$(PATH)))))
|
||||
map = $(foreach a,$(2),$(call $(1),$(a)))
|
||||
|
||||
AWK:=$(shell which awk)
|
||||
ifndef AWK
|
||||
$(error awk utility required for build but not available)
|
||||
endif
|
||||
AWK?=$(or $(shell command -v awk),$(error awk utility required for build but not available))
|
||||
|
||||
define nl
|
||||
|
||||
|
@@ -38,7 +38,7 @@ MANPAGES=apparmor.d.5 apparmor.7 apparmor_parser.8 aa-teardown.8 apparmor_xattrs
|
||||
# parse.error=verbose supported from 3.0 so just test on that
|
||||
# TODO move to autoconf
|
||||
BISON_MAJOR:=$(shell bison --version | awk '/^bison/ { print ($$NF) }' | awk -F. '{print $$1 }')
|
||||
USE_PARSE_ERROR:=$(shell test ${BISON_MAJOR} -ge 3 && echo true)
|
||||
USE_PARSE_ERROR:=$(shell test "${BISON_MAJOR}" -ge 3 && echo true)
|
||||
|
||||
YACC := bison
|
||||
YFLAGS := -d
|
||||
|
@@ -27,7 +27,7 @@ manually, or build against in-tree libapparmor.${nl}\
|
||||
endif # LIBAPPARMOR not set
|
||||
LDLIBS += $(LIBAPPARMOR)
|
||||
|
||||
AA_EXEC = $(shell which aa-exec)
|
||||
AA_EXEC = $(shell command -v aa-exec)
|
||||
ifeq ($(AA_EXEC),)
|
||||
AA_EXEC_ERROR_MESSAGE = $(error ${nl}\
|
||||
************************************************************************${nl}\
|
||||
@@ -166,7 +166,7 @@ SRC+=syscall_sysctl.c
|
||||
endif
|
||||
|
||||
# Only do xattrs_profile test if we have the required setfattr binary
|
||||
ifneq (,$(shell which -s setfattr && echo TRUE))
|
||||
ifneq (,$(shell command -v setfattr))
|
||||
SRC+=xattrs_profile.c
|
||||
else
|
||||
$(warning ${nl}\
|
||||
@@ -295,7 +295,7 @@ TESTS=aa_exec \
|
||||
nfs
|
||||
|
||||
# Only do xattrs_profile test if we have the required setfattr binary
|
||||
ifneq (,$(shell which -s setfattr && echo TRUE))
|
||||
ifneq (,$(shell command -v setfattr))
|
||||
TESTS+=xattrs_profile
|
||||
endif
|
||||
|
||||
|
@@ -29,5 +29,5 @@ runchecktest "Complain mode profile (file exec no permission entry)" pass exec e
|
||||
|
||||
# This test will fail on a kernel that doesn't have
|
||||
# https://lists.ubuntu.com/archives/apparmor/2024-August/013338.html applied
|
||||
genprofile -C $(which echo):cx
|
||||
genprofile -C $(command -v echo):cx
|
||||
runchecktest "Complain mode profile (file exec cx permission entry)" pass exec echo PASS
|
||||
|
@@ -55,7 +55,7 @@ mkdirperm_fail=r
|
||||
linkperm=rl
|
||||
readperm=r
|
||||
|
||||
dd if=/dev/zero of=$image bs=4096 count=128 > /dev/null 2>&1
|
||||
dd if=/dev/zero of=$image bs=4096 count=4096 > /dev/null 2>&1
|
||||
mkfs.ext2 -F -m 0 -N 10 $image > /dev/null 2>&1
|
||||
|
||||
mkdir $mp1 $mp2
|
||||
|
@@ -417,7 +417,7 @@ syntax_failure = (
|
||||
'generated_perms_leading/dominate-Cuxtarget.sd',
|
||||
'generated_perms_leading/dominate-ownerPuxtarget2.sd',
|
||||
|
||||
# escaping with \
|
||||
# escaping with "\"
|
||||
'file/ok_embedded_spaces_4.sd', # \-escaped space
|
||||
'file/file/ok_embedded_spaces_4.sd', # \-escaped space
|
||||
'file/ok_quoted_4.sd', # quoted string including \"
|
||||
|
Reference in New Issue
Block a user