From d275dfdd42a9195862b89cfe73fded85fb91726e Mon Sep 17 00:00:00 2001 From: John Johansen Date: Thu, 5 Dec 2024 10:20:15 -0800 Subject: [PATCH] parser: equality tests: output parser, config and features info When there is a failure output the exact call info used to invoke the parser. To facilitate manually recreating the test. Signed-off-by: John Johansen --- parser/tst/equality.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/parser/tst/equality.sh b/parser/tst/equality.sh index 29fee1d12..2dd1d5a17 100755 --- a/parser/tst/equality.sh +++ b/parser/tst/equality.sh @@ -88,6 +88,7 @@ verify_binary() then if [ -z "$verbose" ] ; then printf "Binary %s %s" "$t" "$desc" ; fi printf "\nFAIL: Hash values do not match\n" 2>&1 + printf "parser: %s --features-file=%s\n" "${APPARMOR_PARSER}" "${_SCRIPTDIR}/features_files/$features_file" 2>&1 printf "known-good (%s) != profile-under-test (%s) for the following profiles:\nknown-good %s\nprofile-under-test %s\n\n" \ "$good_hash" "$hash" "$good_profile" "$profile" 1>&2 ((fails++)) @@ -96,6 +97,7 @@ verify_binary() then if [ -z "$verbose" ] ; then printf "Binary %s %s" "$t" "$desc" ; fi printf "\nunexpected PASS: equality test with known problem, Hash values match\n" 2>&1 + printf "parser: %s --features-file=%s\n" "${APPARMOR_PARSER}" "${_SCRIPTDIR}/features_files/$features_file" 2>&1 printf "known-good (%s) == profile-under-test (%s) for the following profile:\nknown-good %s\nprofile-under-test %s\n\n" \ "$good_hash" "$hash" "$good_profile" "$profile" 1>&2 ((fails++)) @@ -107,6 +109,7 @@ verify_binary() then if [ -z "$verbose" ] ; then printf "Binary %s %s" "$t" "$desc" ; fi printf "\nFAIL: Hash values match\n" 2>&1 + printf "parser: %s --features-file=%s\n" "${APPARMOR_PARSER}" "${_SCRIPTDIR}/features_files/$features_file" 2>&1 printf "known-good (%s) == profile-under-test (%s) for the following profiles:\nknown-good %s\nprofile-under-test %s\n\n" \ "$good_hash" "$hash" "$good_profile" "$profile" 1>&2 ((fails++)) @@ -115,13 +118,15 @@ verify_binary() then if [ -z "$verbose" ] ; then printf "Binary %s %s" "$t" "$desc" ; fi printf "\nunexpected PASS: inequality test with known problem, Hash values do not match\n" 2>&1 + printf "parser: %s --features-file %s\n" "${APPARMOR_PARSER}" "${_SCRIPTDIR}/features_files/$features_file" 2>&1 printf "known-good (%s) != profile-under-test (%s) for the following profile:\nknown-good %s\nprofile-under-test %s\n\n" \ "$good_hash" "$hash" "$good_profile" "$profile" 1>&2 ((fails++)) ((ret++)) elif [ "$t" == "xinequality" ] && [ "$hash" == "$good_hash" ] then - printf "\nknown problem %s %s: unchanged" "$t" "$desc" 1>&2 + printf "\nknown problem %s %s: unchanged" "$t" "$desc" 1>&2 + printf "parser: %s --features-file=%s\n" "${APPARMOR_PARSER}" "${_SCRIPTDIR}/features_files/$features_file" 2>&1 fi done