From 36428d34c9cf123c877fba6e21b193e7b137d12d Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Wed, 15 May 2019 17:29:15 +0200 Subject: [PATCH] Print a command trace if the check-names.sh exits unexpectedly We've observed that sometimes check-names.sh exits unexpectedly with status 2 and no error message. The failure is not reproducible. This commits makes the script print a trace if it exits unexpectedly. --- tests/scripts/check-names.sh | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/tests/scripts/check-names.sh b/tests/scripts/check-names.sh index f18a162cc..82ec54a29 100755 --- a/tests/scripts/check-names.sh +++ b/tests/scripts/check-names.sh @@ -16,12 +16,22 @@ if grep --version|head -n1|grep GNU >/dev/null; then :; else exit 1 fi +trace= +if [ $# -ne 0 ] && [ "$1" = "-v" ]; then + shift + trace='-x' + exec 2>check-names.err + trap 'echo "FAILED UNEXPECTEDLY, status=$?"; + cat check-names.err' EXIT + set -x +fi + printf "Analysing source code...\n" -tests/scripts/list-macros.sh +sh $trace tests/scripts/list-macros.sh tests/scripts/list-enum-consts.pl -tests/scripts/list-identifiers.sh -tests/scripts/list-symbols.sh +sh $trace tests/scripts/list-identifiers.sh +sh $trace tests/scripts/list-symbols.sh FAIL=0 @@ -82,6 +92,12 @@ else FAIL=1 fi +if [ -n "$trace" ]; then + set +x + trap - EXIT + rm check-names.err +fi + printf "\nOverall: " if [ "$FAIL" -eq 0 ]; then rm macros actual-macros enum-consts identifiers exported-symbols