Skip to content

Commit

Permalink
Fixed disabled spinner and formatted messaged bug 🐛
Browse files Browse the repository at this point in the history
  • Loading branch information
styczynski committed Oct 21, 2017
1 parent 3dc7751 commit 21a9905
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 30 deletions.
38 changes: 12 additions & 26 deletions utest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,51 +107,29 @@ function _spinner() {
case $1 in
start)
if [[ -z ${3} ]]; then
#echo "spinner is not running.."
# calculate the column where spinner and status msg will be displayed
# let column=$(tput cols)-${#2}-8
let column=1
# display message and position the cursor in $column column
#echo -ne ${2}
#printf "%${column}s"


# start spinner
i=1
sp='\|/-'
delay=${SPINNER_DELAY:-0.15}

#echo -ne " "
printf "\n "
while :
do
printf "\b${sp:i++%${#sp}:1}"
sleep $delay
done
else
#echo -e ""
sleep 0
fi
;;
stop)
if [[ -z ${3} ]]; then
#echo "spinner is not running.."
#exit 1
#echo -e ""
sleep 0
else
kill -9 $3 > /dev/null 2>&1
while kill -0 $3 2>/dev/null; do sleep 0.005; done
sleep 0.005
printf "\b\b\b \b\b\b"
# inform the user upon success or failure
#echo -ne "\b"
#if [[ $2 -eq 0 ]]; then
# echo -en "${green}${on_success}${nc}"
#else
# echo -en "${red}${on_fail}${nc}"
#fi
#echo -e ""
fi
;;
*)
Expand All @@ -163,7 +141,7 @@ function _spinner() {

# Disable spinner
spinner_is_running=false
flag_use_spinner=false
flag_use_spinner=true

function start_spinner {
if [[ "${flag_use_spinner}|${flag_no_builtin_outputs}" = "true|false" ]]; then
Expand Down Expand Up @@ -212,7 +190,7 @@ sbusy ""
# Usage: type test.sh --help to get some info
#
#
# @Piotr Styczyński 2017
# @Piotr Styczyñski 2017
#


Expand Down Expand Up @@ -300,6 +278,12 @@ function stdout {
fi
}

function stdoutplain {
if [[ "$flag_no_builtin_outputs" = "false" ]]; then
echo -en "$@"
fi
}

function clean_temp_content {
if [[ ${flag_out_temp} = 'true' ]]; then
rm -f -r $flag_out_path/*
Expand Down Expand Up @@ -1310,7 +1294,7 @@ function push_test_message_next_program {

function flush_test_messages {
sready
stdout "${message_accumulator}"
stdoutplain "${message_accumulator}"
message_accumulator=""
message_last_file_head=""
message_tooling_data_accumulator=""
Expand Down Expand Up @@ -1695,6 +1679,7 @@ function run_utest {
sbusy
print_summary
run_hook "deinit"
sready
clean_temp
}

Expand Down Expand Up @@ -1790,4 +1775,5 @@ do
fi
shift
done
run_utest
run_utest
sready
4 changes: 0 additions & 4 deletions utest.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
input: test/*.in
silent: true
good_output: test/%input_file_name.out
need_error_files: false
executions:
- prog1
- prog2
hooks:
test_case_fail:
- @echo ERR %{input_file}
prog1:
command: ./test/totest.sh
args: %input_file_name
Expand Down

0 comments on commit 21a9905

Please sign in to comment.