From: Jérémie Astor Date: Mon, 14 Sep 2020 13:22:43 +0000 (+0200) Subject: :wrench: test.sh summary function X-Git-Tag: nightly~1304 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=133c05b68f09908c54ea940aa58f8f2738d26767;p=gwion.git :wrench: test.sh summary function --- diff --git a/scripts/test.sh b/scripts/test.sh index a7d189b7..b3e3e48e 100644 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -321,6 +321,21 @@ do_test() { done } +summary() { + win=$1 + expected=$2 + skip=$3 + todo=$4 + if [ "$win" = "$expected" ] && [ "$skip" = 0 ] && [ "$todo" = 0 ] + then echo -e '\n\t'"${ANSI_GREEN}Everything is OK!${ANSI_RESET}"'\n' + else + echo -e '\n\t'"${ANSI_GREEN}Success: $win/$expected${ANSI_RESET}" + echo -e '\t'"${ANSI_RED}Failure: $failure${ANSI_RESET}" + echo -e '\t'"Skipped: ${ANSI_BOLD}$skip${ANSI_RESET}" + echo -e '\t'"todo : ${ANSI_BOLD}$todo${ANSI_RESET}"'\n' >&2 + fi +} + consummer() { local win failure skip todo expected win=0 @@ -365,14 +380,7 @@ consummer() { fi # ignore the rest done <&0 - if [ "$win" = "$expected" ] && [ "$skip" = 0 ] && [ "$todo" = 0 ] - then echo -e '\n\t'"${ANSI_GREEN}Everything is OK!${ANSI_RESET}"'\n' - else - echo -e '\n\t'"${ANSI_GREEN}Success: $win/$expected${ANSI_RESET}" - echo -e '\t'"${ANSI_RED}Failure: $failure${ANSI_RESET}" - echo -e '\t'"Skipped: ${ANSI_BOLD}$skip${ANSI_RESET}" - echo -e '\t'"todo : ${ANSI_BOLD}$todo${ANSI_RESET}"'\n' >&2 - fi + summary "$win" "$expected" "$skip" "$todo" [ "$failure" -gt 0 ] && return 1 return 0 }