2
0
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:
Christian Boltz
2024-11-25 21:58:08 +00:00
6 changed files with 8 additions and 11 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 \"