Skip to content

Commit 21a9905

Browse files
committed
Fixed disabled spinner and formatted messaged bug 🐛
1 parent 3dc7751 commit 21a9905

File tree

2 files changed

+12
-30
lines changed

2 files changed

+12
-30
lines changed

utest.sh

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -107,51 +107,29 @@ function _spinner() {
107107
case $1 in
108108
start)
109109
if [[ -z ${3} ]]; then
110-
#echo "spinner is not running.."
111-
# calculate the column where spinner and status msg will be displayed
112-
# let column=$(tput cols)-${#2}-8
113110
let column=1
114-
# display message and position the cursor in $column column
115-
#echo -ne ${2}
116-
#printf "%${column}s"
117-
118-
119111
# start spinner
120112
i=1
121113
sp='\|/-'
122114
delay=${SPINNER_DELAY:-0.15}
123-
124-
#echo -ne " "
125115
printf "\n "
126116
while :
127117
do
128118
printf "\b${sp:i++%${#sp}:1}"
129119
sleep $delay
130120
done
131121
else
132-
#echo -e ""
133122
sleep 0
134123
fi
135124
;;
136125
stop)
137126
if [[ -z ${3} ]]; then
138-
#echo "spinner is not running.."
139-
#exit 1
140-
#echo -e ""
141127
sleep 0
142128
else
143129
kill -9 $3 > /dev/null 2>&1
144130
while kill -0 $3 2>/dev/null; do sleep 0.005; done
145131
sleep 0.005
146132
printf "\b\b\b \b\b\b"
147-
# inform the user upon success or failure
148-
#echo -ne "\b"
149-
#if [[ $2 -eq 0 ]]; then
150-
# echo -en "${green}${on_success}${nc}"
151-
#else
152-
# echo -en "${red}${on_fail}${nc}"
153-
#fi
154-
#echo -e ""
155133
fi
156134
;;
157135
*)
@@ -163,7 +141,7 @@ function _spinner() {
163141

164142
# Disable spinner
165143
spinner_is_running=false
166-
flag_use_spinner=false
144+
flag_use_spinner=true
167145

168146
function start_spinner {
169147
if [[ "${flag_use_spinner}|${flag_no_builtin_outputs}" = "true|false" ]]; then
@@ -212,7 +190,7 @@ sbusy ""
212190
# Usage: type test.sh --help to get some info
213191
#
214192
#
215-
# @Piotr Styczyński 2017
193+
# @Piotr Styczyñski 2017
216194
#
217195

218196

@@ -300,6 +278,12 @@ function stdout {
300278
fi
301279
}
302280

281+
function stdoutplain {
282+
if [[ "$flag_no_builtin_outputs" = "false" ]]; then
283+
echo -en "$@"
284+
fi
285+
}
286+
303287
function clean_temp_content {
304288
if [[ ${flag_out_temp} = 'true' ]]; then
305289
rm -f -r $flag_out_path/*
@@ -1310,7 +1294,7 @@ function push_test_message_next_program {
13101294

13111295
function flush_test_messages {
13121296
sready
1313-
stdout "${message_accumulator}"
1297+
stdoutplain "${message_accumulator}"
13141298
message_accumulator=""
13151299
message_last_file_head=""
13161300
message_tooling_data_accumulator=""
@@ -1695,6 +1679,7 @@ function run_utest {
16951679
sbusy
16961680
print_summary
16971681
run_hook "deinit"
1682+
sready
16981683
clean_temp
16991684
}
17001685

@@ -1790,4 +1775,5 @@ do
17901775
fi
17911776
shift
17921777
done
1793-
run_utest
1778+
run_utest
1779+
sready

utest.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
input: test/*.in
2-
silent: true
32
good_output: test/%input_file_name.out
43
need_error_files: false
54
executions:
65
- prog1
76
- prog2
8-
hooks:
9-
test_case_fail:
10-
- @echo ERR %{input_file}
117
prog1:
128
command: ./test/totest.sh
139
args: %input_file_name

0 commit comments

Comments
 (0)