mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-03 15:55:46 +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)))))
|
pathsearch = $(firstword $(wildcard $(addsuffix /$(1),$(subst :, ,$(PATH)))))
|
||||||
map = $(foreach a,$(2),$(call $(1),$(a)))
|
map = $(foreach a,$(2),$(call $(1),$(a)))
|
||||||
|
|
||||||
AWK:=$(shell which awk)
|
AWK?=$(or $(shell command -v awk),$(error awk utility required for build but not available))
|
||||||
ifndef AWK
|
|
||||||
$(error awk utility required for build but not available)
|
|
||||||
endif
|
|
||||||
|
|
||||||
define nl
|
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
|
# parse.error=verbose supported from 3.0 so just test on that
|
||||||
# TODO move to autoconf
|
# TODO move to autoconf
|
||||||
BISON_MAJOR:=$(shell bison --version | awk '/^bison/ { print ($$NF) }' | awk -F. '{print $$1 }')
|
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
|
YACC := bison
|
||||||
YFLAGS := -d
|
YFLAGS := -d
|
||||||
|
@@ -27,7 +27,7 @@ manually, or build against in-tree libapparmor.${nl}\
|
|||||||
endif # LIBAPPARMOR not set
|
endif # LIBAPPARMOR not set
|
||||||
LDLIBS += $(LIBAPPARMOR)
|
LDLIBS += $(LIBAPPARMOR)
|
||||||
|
|
||||||
AA_EXEC = $(shell which aa-exec)
|
AA_EXEC = $(shell command -v aa-exec)
|
||||||
ifeq ($(AA_EXEC),)
|
ifeq ($(AA_EXEC),)
|
||||||
AA_EXEC_ERROR_MESSAGE = $(error ${nl}\
|
AA_EXEC_ERROR_MESSAGE = $(error ${nl}\
|
||||||
************************************************************************${nl}\
|
************************************************************************${nl}\
|
||||||
@@ -166,7 +166,7 @@ SRC+=syscall_sysctl.c
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# Only do xattrs_profile test if we have the required setfattr binary
|
# 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
|
SRC+=xattrs_profile.c
|
||||||
else
|
else
|
||||||
$(warning ${nl}\
|
$(warning ${nl}\
|
||||||
@@ -295,7 +295,7 @@ TESTS=aa_exec \
|
|||||||
nfs
|
nfs
|
||||||
|
|
||||||
# Only do xattrs_profile test if we have the required setfattr binary
|
# 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
|
TESTS+=xattrs_profile
|
||||||
endif
|
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
|
# This test will fail on a kernel that doesn't have
|
||||||
# https://lists.ubuntu.com/archives/apparmor/2024-August/013338.html applied
|
# 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
|
runchecktest "Complain mode profile (file exec cx permission entry)" pass exec echo PASS
|
||||||
|
@@ -55,7 +55,7 @@ mkdirperm_fail=r
|
|||||||
linkperm=rl
|
linkperm=rl
|
||||||
readperm=r
|
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
|
mkfs.ext2 -F -m 0 -N 10 $image > /dev/null 2>&1
|
||||||
|
|
||||||
mkdir $mp1 $mp2
|
mkdir $mp1 $mp2
|
||||||
|
@@ -417,7 +417,7 @@ syntax_failure = (
|
|||||||
'generated_perms_leading/dominate-Cuxtarget.sd',
|
'generated_perms_leading/dominate-Cuxtarget.sd',
|
||||||
'generated_perms_leading/dominate-ownerPuxtarget2.sd',
|
'generated_perms_leading/dominate-ownerPuxtarget2.sd',
|
||||||
|
|
||||||
# escaping with \
|
# escaping with "\"
|
||||||
'file/ok_embedded_spaces_4.sd', # \-escaped space
|
'file/ok_embedded_spaces_4.sd', # \-escaped space
|
||||||
'file/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 \"
|
'file/ok_quoted_4.sd', # quoted string including \"
|
||||||
|
Reference in New Issue
Block a user