[apparmor] [patch] parser: fix equality and vlagrind test scripts to use features file

John Johansen john.johansen at canonical.com
Thu Mar 19 08:39:04 UTC 2015


On 03/19/2015 01:29 AM, Steve Beattie wrote:
> This patch fixes the equality test script and the valgrind wrapper
> script to make the parser under test use the features.all features file
> from the features_files/ subdirectory. Otherwise, the equality tests
> will fail on systems where the not all of the current language features
> are supported. The equality fix does so in a way to make the script work
> correctly regardless of the directory it is run from.
> 
> Signed-off-by: Steve Beattie <steve at nxnw.org> for trunk and 2.9
Acked-by: John Johansen <john.johansen at canonical.com>

> ---
>  parser/tst/equality.sh        |    6 ++++--
>  parser/tst/valgrind_simple.py |    2 +-
>  2 files changed, 5 insertions(+), 3 deletions(-)
> 
> Index: b/parser/tst/valgrind_simple.py
> ===================================================================
> --- a/parser/tst/valgrind_simple.py
> +++ b/parser/tst/valgrind_simple.py
> @@ -42,7 +42,7 @@ class AAParserValgrindTests(testlib.AATe
>          self.maxDiff = None
>  
>      def _runtest(self, testname, config):
> -        parser_args = ['-Q', '-I', config.testdir]
> +        parser_args = ['-Q', '-I', config.testdir, '-M', './features_files/features.all']
>          failure_rc = [VALGRIND_ERROR_CODE, testlib.TIMEOUT_ERROR_CODE]
>          command = [config.valgrind]
>          command.extend(VALGRIND_ARGS)
> Index: b/parser/tst/equality.sh
> ===================================================================
> --- a/parser/tst/equality.sh
> +++ b/parser/tst/equality.sh
> @@ -22,13 +22,15 @@
>  
>  set -o pipefail
>  
> -APPARMOR_PARSER="${APPARMOR_PARSER:-../apparmor_parser}"
> +_SCRIPTDIR=$(dirname "${BASH_SOURCE[0]}" )
> +
> +APPARMOR_PARSER="${APPARMOR_PARSER:-${_SCRIPTDIR}/../apparmor_parser}"
>  fails=0
>  errors=0
>  
>  hash_binary_policy()
>  {
> -	printf %s "$1" | ${APPARMOR_PARSER} -qS 2>/dev/null| md5sum | cut -d ' ' -f 1
> +	printf %s "$1" | ${APPARMOR_PARSER} --features-file ${_SCRIPTDIR}/features_files/features.all -qS 2>/dev/null| md5sum | cut -d ' ' -f 1
>  	return $?
>  }
>  
> 
> 
> 




More information about the AppArmor mailing list