From 2f37d68d9b0f4af2ba3d913ae96968fa59ff5871 Mon Sep 17 00:00:00 2001 From: Pierre Souchay Date: Wed, 28 Aug 2019 16:26:05 +0200 Subject: [PATCH] [BUGFIX][BUILD] When test fail in circle-ci in main, have a proper error message (#6416) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since FUNCNAME is not defined when running outside a function, trap does not work and display wrong error message. Example from https://circleci.com/gh/hashicorp/consul/69506 : ``` тип FAIL /home/circleci/project/test/integration/connect/envoy/run-tests.sh: line 1: FUNCNAME[0]: unbound variable make: *** [GNUmakefile:363: test-envoy-integ] Error 1 ``` This fix will avoid this error message and display the real cause. --- test/integration/connect/envoy/run-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/connect/envoy/run-tests.sh b/test/integration/connect/envoy/run-tests.sh index fe8c90e6b9..85084f085e 100755 --- a/test/integration/connect/envoy/run-tests.sh +++ b/test/integration/connect/envoy/run-tests.sh @@ -64,7 +64,7 @@ function command_error { # printf '%s\n' "${BASH_LINENO[@]}" } -trap 'command_error $? "${BASH_COMMAND}" "${LINENO}" "${FUNCNAME[0]}" "${BASH_SOURCE[0]}:${BASH_LINENO[0]}"' ERR +trap 'command_error $? "${BASH_COMMAND}" "${LINENO}" "${FUNCNAME[0]:-main}" "${BASH_SOURCE[0]}:${BASH_LINENO[0]}"' ERR # Cleanup from any previous unclean runs. docker-compose down -v --remove-orphans