From ef4e59256bec690484465ac4da4a9fe1a61373b4 Mon Sep 17 00:00:00 2001 From: Steve Beattie Date: Thu, 19 Mar 2015 04:35:08 -0700 Subject: [PATCH] parser: fix equality and valgrind test scripts to use features file 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 Acked-by: John Johansen --- parser/tst/equality.sh | 6 ++++-- parser/tst/valgrind_simple.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/parser/tst/equality.sh b/parser/tst/equality.sh index 22587580f..3082dbf59 100755 --- 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 $? } diff --git a/parser/tst/valgrind_simple.py b/parser/tst/valgrind_simple.py index 6508ab53d..4cc603fa2 100755 --- a/parser/tst/valgrind_simple.py +++ b/parser/tst/valgrind_simple.py @@ -42,7 +42,7 @@ class AAParserValgrindTests(testlib.AATestTemplate): 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)