Skip to content

Commit add74c2

Browse files
committed
Improve the output.
1 parent ff3013e commit add74c2

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

tutorials/run_tutorial_tests.sh

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ status=()
5353
RED="\033[31;1m" #bold red
5454
GREEN="\033[32;1m" #bold green
5555
BLUE="\033[34;1m" # bold blue
56+
MAGENTA="\033[35;1m" # bold blue
5657
BOLD="\033[1m"
5758
CLEAR="\033[0m"
5859
UNDERLINE="\033[4m"
@@ -71,7 +72,7 @@ for t in */tests.txt; do
7172

7273
test_result=0
7374
for script in $(cat tests.txt); do
74-
printf " ${script}: "
75+
printf " ${script}: ${MAGENTA}"
7576

7677
if [ ! -e "scripts/${script}" ] ; then
7778
echo "script '${script}' from ${t} is missing!"
@@ -90,15 +91,18 @@ for t in */tests.txt; do
9091
)
9192
${rb_exec} -b scripts/cp_$script &> "output/${script%.[Rr]ev}.errout"
9293
script_result="$?"
93-
94+
printf "${CLEAR}"
9495
if [ "${script_result}" = 139 ]; then
9596
script_result="SEGFAULT"
97+
elif [ "${script_result}" = 134 ]; then
98+
script_result="Aborted"
9699
elif [ "${script_result}" != 0 ]; then
97100
script_result="error ${script_result}"
98101
fi
99102

100103
if [ "${script_result}" != 0 ] ; then
101-
script_result="${script}=${script_result}"
104+
script_result="${script}: ${script_result}"
105+
echo
102106
tail -n 5 "output/${script%.[Rr]ev}.errout" | sed "s/^/ ${BLUE2}|${CLEAR2} /g"
103107
printf "\n ${RED}FAIL${CLEAR}: ${script_result}\n"
104108
echo
@@ -120,7 +124,7 @@ for t in */tests.txt; do
120124

121125
done
122126

123-
printf "\n\n#### Checking output from tests... \n"
127+
printf "\n\n${BOLD}#### Checking output from tests... ${CLEAR}\n"
124128
xfailed=0
125129
failed=0
126130
pass=0
@@ -132,25 +136,25 @@ while [ $i -lt ${#tests[@]} ]; do
132136
if [ "${status[$i]}" != 0 ]; then
133137
if [ -f XFAIL ] ; then
134138
((xfailed++))
135-
printf ">>>> Test ${RED}failed${CLEAR}: $t (expected)\n"
139+
printf ">>>> Test ${RED}failed${CLEAR}: ${UNDERLINE}$t${CLEAR} (expected)\n"
136140
else
137141
((failed++))
138-
printf ">>>> Test ${RED}failed${CLEAR}: $t\n"
142+
printf ">>>> Test ${RED}failed${CLEAR}: ${UNDERLINE}$t${CLEAR}\n"
139143
fi
140144
printf "${status[$i]}"
141145
else
142146
((pass++))
143-
printf "#### Test passed: $t\n"
147+
printf "#### Test ${GREEN}passed${CLEAR}: ${UNDERLINE}$t${CLEAR}\n"
144148
fi
145149

146150
((i++))
147151
done
148152

149153

150154
if [ $failed -gt 0 ]; then
151-
printf "\n\n#### Warning! unexpected failures: $failed expected failures: $xfailed total tests: $i\n\n"
155+
printf "${BOLD}\n\n#### ${MAGENTA}Warning!${CLEAR}${BOLD} unexpected failures: ${RED}$failed${CLEAR}${BOLD} expected failures: $xfailed total tests: $i\n\n${CLEAR}"
152156
exit 113
153157
else
154-
printf "\n\n#### Success! unexpected failures: $failed expected failures: $xfailed total tests: $i\n\n"
155-
printf "\n\n#### All tests passed.\n\n"
158+
printf "${BOLD}\n\n#### ${GREEN}Success!${CLEAR}${BOLD} unexpected failures: $failed expected failures: $xfailed total tests: $i\n\n${CLEAR}"
159+
printf "${BOLD}\n\n#### All tests passed.\n\n${CLEAR}"
156160
fi

0 commit comments

Comments
 (0)