[apparmor] [PATCH 1/2] tests: Add an optional final check to checktestfg and checktestbg

John Johansen john.johansen at canonical.com
Thu Aug 1 18:01:06 UTC 2013


On 08/01/2013 02:01 AM, Tyler Hicks wrote:
> Allows for the test script to specify a final check to be performed
> after checking the output of the test binary. This may be useful, for
> example, if the test script wants to compare logging output of the test
> binary to known-good logging output.
> 
> Signed-off-by: Tyler Hicks <tyhicks at canonical.com>
Acked-by: John Johansen <john.johansen at canonical.com>

> ---
> 
> I'm not real happy about this patch. It is definitely a shortcut to what I need
> for the dbus tests, which is a way to compare two log files after the test
> program status is checked and before the test is declared a failure or not. The
> log comparison function itself may also decide if the test was a failure or
> not.
> 
> That said, this isn't all that bad so I'm not sure if it is worth it to spend
> more time on coming up with a cleaner solution.
> 
It works, and the long term plan is to switch away from the bash test harness
to something better so I don't think putting effort into a cleaner solution is
worth it


>  tests/regression/apparmor/prologue.inc | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/regression/apparmor/prologue.inc b/tests/regression/apparmor/prologue.inc
> index 150ac1e..7068298 100755
> --- a/tests/regression/apparmor/prologue.inc
> +++ b/tests/regression/apparmor/prologue.inc
> @@ -129,7 +129,7 @@ checktestbg()
>  	then
>  		echo "SIGNAL$(($rc - 128))" > $outfile
>  	fi
> -	checktestfg
> +	checktestfg "$@"
>  }
>  
>  runtestfg()
> @@ -207,6 +207,15 @@ checktestfg()
>  			;;
>  	esac
>  
> +	if [ $# -gt 0 ]
> +	then
> +		$1
> +		if [ "$teststatus" != "pass" ]
> +		then
> +			return
> +		fi
> +	fi
> +
>  	if [ -n "$VERBOSE" ]; then
>  		echo "ok: ${_testdesc}"
>  	fi
> 




More information about the AppArmor mailing list