[apparmor] [patch] modify regression tests to use USE_SYSTEM to select parser

John Johansen john.johansen at canonical.com
Sat Mar 1 13:57:37 UTC 2014


On 02/28/2014 10:15 PM, Seth Arnold wrote:
> Hello,
> 
> The Ubuntu QRT tests for AppArmor 2.8.95 are failing when running the
> 'upstream' regression tests:
> 
> ...
> running access
> Fatal Error (): AppArmor parser '/tmp/testlibXaSBb9/source/trusty/apparmor-2.8.95~2402/tests/regression/apparmor/../../../parser/apparmor_parser' is not executable
> ...
> 
> This is becuse the uservars.inc file that defined the location of the
> AppArmor parser hasn't yet been modified to use the USE_SYSTEM environment
> variable to select between the system parser or a parser built in the
> source tree.
> 
> (Note that the message -feels- like a missing library symbol or binary
> format handler, but it's really just a message from prologue.inc when the
> pathname fails the if -x test -- in this case, the file doesn't even exist.
> We can probably improve this error message too.)
> 
yep

> So, this patch makes two uservars.inc.* files, modifies the Makefile to
> copy the correct one in place, and has 'make clean' delete it again. This
> should allow local modifications to the uservars.inc file to persist, but
> won't handle repeated "make clean all tests" with a non-standard parser.
> 
> I'm not thrilled with this patch but it seems to work. Any better ideas?
> 
I'm not thrilled with this either but we do need something. It has to
be able to handle running the tests without the make file
  bash test_foo -r

is used a lot when tests fail.

that said I would make a few changes


> Thanks
> 
> Signed-off-by: Seth Arnold <seth.arnold at canonical.com>
> 
> 
> 0009-uservars-inc-use-system-support.patch
> 
> 
> Description: Modify regression tests to use USE_SYSTEM to also select parser
> Author: Seth Arnold <seth.arnold at canonical.com>
> 
> ---
>  tests/regression/apparmor/Makefile            |   11 +++++++++--
>  tests/regression/apparmor/uservars.inc        |   14 --------------
>  tests/regression/apparmor/uservars.inc.source |   14 ++++++++++++++
>  tests/regression/apparmor/uservars.inc.system |   14 ++++++++++++++
>  4 files changed, 37 insertions(+), 16 deletions(-)
> 
> Index: b/tests/regression/apparmor/Makefile
> ===================================================================
> --- a/tests/regression/apparmor/Makefile
> +++ b/tests/regression/apparmor/Makefile
> @@ -180,7 +180,14 @@
>  		return 1 ; \
>  	fi
>  
> -all: libapparmor_check $(EXEC) changehat.h
> +all: libapparmor_check $(EXEC) changehat.h uservars.inc
> +
> +uservars.inc: uservars.inc.source uservars.inc.system
> +ifdef USE_SYSTEM
> +	mv uservars.inc.system uservars.inc

cp not mv, I'd like this to be able to be used make than once
> +else # !USE_SYSTEM
> +	mv uservars.inc.source uservars.inc

same here

> +endif # USE_SYSTEM
>  
>  changehat_pthread: changehat_pthread.c changehat.h
>  	${CC} ${CFLAGS} ${LDFLAGS} $< -o $@ ${LDLIBS} -pthread
> @@ -236,6 +243,6 @@
>  	fi
>  
>  clean:
> -	rm -f $(EXEC) dbus_common.o
> +	rm -f $(EXEC) dbus_common.o uservars.inc
>  
>  regex.sh: open exec
> Index: b/tests/regression/apparmor/uservars.inc.source
> ===================================================================
> --- /dev/null
> +++ b/tests/regression/apparmor/uservars.inc.source
> @@ -0,0 +1,14 @@
> +# 1. Path to apparmor parser
> +subdomain=${PWD}/../../../parser/apparmor_parser
> +#subdomain=/sbin/apparmor_parser
> +
> +# 2. additional arguments to the apparmor parser
> +parser_args="-q -K"
> +
> +# 3. directory to be used for temp files
> +# Need to be able to access this directory by the root and nobody users.
> +tmpdir=/tmp/sdtest.$$-$RANDOM
> +
> +
> +# 4. Location of load system profiles for verification
> +sys_profiles=/sys/kernel/security/apparmor/profiles
> Index: b/tests/regression/apparmor/uservars.inc.system
> ===================================================================
> --- /dev/null
> +++ b/tests/regression/apparmor/uservars.inc.system
> @@ -0,0 +1,14 @@
> +# 1. Path to apparmor parser
> +#subdomain=${PWD}/../../../parser/apparmor_parser
> +subdomain=/sbin/apparmor_parser
> +
> +# 2. additional arguments to the apparmor parser
> +parser_args="-q -K"
> +
> +# 3. directory to be used for temp files
> +# Need to be able to access this directory by the root and nobody users.
> +tmpdir=/tmp/sdtest.$$-$RANDOM
> +
> +
> +# 4. Location of load system profiles for verification
> +sys_profiles=/sys/kernel/security/apparmor/profiles
> Index: b/tests/regression/apparmor/uservars.inc
> ===================================================================
> --- a/tests/regression/apparmor/uservars.inc
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -# 1. Path to apparmor parser
> -subdomain=${PWD}/../../../parser/apparmor_parser
> -#subdomain=/sbin/apparmor_parser
> -
> -# 2. additional arguments to the apparmor parser
> -parser_args="-q -K"
> -
> -# 3. directory to be used for temp files
> -# Need to be able to access this directory by the root and nobody users.
> -tmpdir=/tmp/sdtest.$$-$RANDOM
> -
> -
> -# 4. Location of load system profiles for verification
> -sys_profiles=/sys/kernel/security/apparmor/profiles
> 
> 
> 
> -- AppArmor mailing list AppArmor at lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
> 




More information about the AppArmor mailing list