From 01c5cbf701ab0b0fa928691c6e16e69d13732f3f Mon Sep 17 00:00:00 2001 From: Albert S Date: Tue, 20 Dec 2022 10:50:37 +0100 Subject: [PATCH] test.sh: Make it more portable --- test.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/test.sh b/test.sh index b9b5488..fb71c46 100755 --- a/test.sh +++ b/test.sh @@ -8,41 +8,41 @@ COUNT_SUCCEEDED=0 COUNT_FAILED=0 COUNT_SKIPPED=0 -function print_fail() +print_fail() { - echo -e "${RED}$@${NC}" 1>&2 + printf "${RED}$@${NC}\n" 1>&2 } -function print_success() +print_success() { - echo -e "${GREEN}$@${NC}" + printf "${GREEN}$@${NC}\n" } -function print_skipped() +print_skipped() { - echo -e "${YELLOW}$@${NC}" + printf "${YELLOW}$@${NC}\n" } -function runtest_fail() +runtest_fail() { print_fail "failed" COUNT_FAILED=$(($COUNT_FAILED+1)) } -function runtest_success() +runtest_success() { print_success "ok" COUNT_SUCCEEDED=$((COUNT_SUCCEEDED+1)) } -function runtest_skipped() +runtest_skipped() { print_skipped "skipped" COUNT_SKIPPED=$((COUNT_SKIPPED+1)) } -function runtest() +runtest() { testbin="$1" testname="$2" @@ -52,7 +52,7 @@ function runtest() echo -n "Running $testname... " #exit $? to suppress shell message like "./test.sh: line 18: pid Bad system call" - (./$testbin "$testname" || exit $?) &>> "${test_log_file}" + (./$testbin "$testname" || exit $?) 2>&1 | tee 1>/dev/null -a "${test_log_file}" ret=$? SUCCESS="no" if [ $ret -eq 0 ] ; then