On 2013-08-02 03:07:56, 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
> 

This looks good and works well. Thanks!

Acked-by: Tyler Hicks <tyhi...@canonical.com>

> ---
> 
> === 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@lists.ubuntu.com
> Modify settings or unsubscribe at: 
> https://lists.ubuntu.com/mailman/listinfo/apparmor

Attachment: signature.asc
Description: Digital signature

-- 
AppArmor mailing list
AppArmor@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/apparmor

Reply via email to