From a65cbef5f434c4930b6af4a9261f09c3830bfed5 Mon Sep 17 00:00:00 2001 From: Yakun Xu Date: Tue, 23 Mar 2021 19:40:44 +0800 Subject: [PATCH] [test] support VERBOSE logging --- tests/integration/common.sh | 4 ++-- tests/integration/run_tests.sh | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/integration/common.sh b/tests/integration/common.sh index f7673e15c..39095a10e 100755 --- a/tests/integration/common.sh +++ b/tests/integration/common.sh @@ -86,7 +86,7 @@ start_daemon() { fi sudo rm -rf ${OT_DAEMON_SETTINGS_PATH} - sudo "${OT_DAEMON}" "spinel+hdlc+uart://${NON_CCM_RCP}?forkpty-arg=1" > "${OT_DAEMON_LOG}" 2>&1 & + sudo "${OT_DAEMON}" "spinel+hdlc+uart://${NON_CCM_RCP}?forkpty-arg=1" 2>&1 | tee "${OT_DAEMON_LOG}" & sleep 10 } @@ -107,7 +107,7 @@ start_commissioner() { local config=$1 echo "starting commissioner daemon: [ ${COMMISSIONER_DAEMON} --cli ${COMMISSIONER_CLI} ]" - python -u "${COMMISSIONER_DAEMON}" --cli "${COMMISSIONER_CLI}" --timeout 200 > "${COMMISSIONER_DAEMON_LOG}" 2>&1 & + python -u "${COMMISSIONER_DAEMON}" --cli "${COMMISSIONER_CLI}" --timeout 200 2>&1 | tee "${COMMISSIONER_DAEMON_LOG}" & sleep 1 pgrep -f "${COMMISSIONER_DAEMON}" diff --git a/tests/integration/run_tests.sh b/tests/integration/run_tests.sh index 4fd73c0be..f165bbc26 100755 --- a/tests/integration/run_tests.sh +++ b/tests/integration/run_tests.sh @@ -64,7 +64,11 @@ run_test_case() { ## we cannot declare output with `local`, ## because `local` is a command and its return value iwll override ## return value of the test case. - $(set -xeuo pipefail && ${test_case} &> "${output_file}") + if [[ ${VERBOSE} ]]; then + (set -xeuo pipefail && ${test_case}) + else + (set -xeuo pipefail && ${test_case} &> "${output_file}") + fi local result=$? if [ ${result} = 0 ]; then