[apparmor] [PATCH] required feature test for regression tests

Seth Arnold seth.arnold at canonical.com
Sat Aug 10 00:12:46 UTC 2013


On Fri, Aug 02, 2013 at 03:07:56AM -0700, John Johansen wrote:
> This quick little patch adds the ability to specify the features required
> for a test to run. This will help keep the regression suite from reporting
> a lot of failures when it hits a kernel that doesn't support the feature
> being tested.
> 
> its current iteration is pretty brain dead, only testing for the existance
> of feature files/dirs (and not contents) but I think it is probably
> sufficient for now.
> 
> To use it, just call the required_features fn right after sourcing
> prologue.inc in the bash test script that is called by the make file.
> 
> If any of the requested features don't exist the bash script will exit
> reporting the first feature that was missing
> 
> Eg.
> 
> . $bin/prologue.inc
> required_features dbus
> required_features dbus dbus/mask network domain/change_hatv

Acked-by: Seth Arnold <seth.arnold at canonical.com>

Thanks

> ---
> 
> === modified file 'tests/regression/apparmor/prologue.inc'
> --- tests/regression/apparmor/prologue.inc	2012-10-01 18:05:24 +0000
> +++ tests/regression/apparmor/prologue.inc	2013-08-02 09:55:46 +0000
> @@ -21,6 +21,21 @@
>  #
>  # For this file, functions are first, entry point code is at end, see "MAIN"
>  
> +required_features()
> +{
> +	if [ ! -e "/sys/kernel/security/apparmor/features/" ] ; then
> +		echo "Kernel feature masks not supported. Skipping tests ..."
> +		exit 0
> +	fi
> +
> +	for f in $@ ; do
> +		if [ ! -e "/sys/kernel/security/apparmor/features/$f" ] ; then
> +			echo "Required feature $f not available. Skipping tests ..."
> +			exit 0
> +		fi
> +	done
> +}
> +
>  fatalerror()
>  {
>  	# global _fatal
> 
> 
> -- 
> AppArmor mailing list
> AppArmor at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20130809/6601b434/attachment.pgp>


More information about the AppArmor mailing list