Remove artificial slowdown of ansi screenshots, use an ASCII character instead of an UTF-8 one to avoid corruption by travis. Cleanup.

This commit is contained in:
Georges Dupéron 2018-07-08 18:10:53 +02:00
parent 51189eb2cb
commit a1a80feeea
4 changed files with 13 additions and 9 deletions

View File

@ -1,4 +0,0 @@
./utils/gui-wrapper.sh ./test/qemu-system-i386.sh
./utils/gui-wrapper.sh ./test/qemu-system-arm.sh
./utils/gui-wrapper.sh ./test/virtualbox.sh
./utils/gui-wrapper.sh ./test/bochs.sh

View File

@ -5,6 +5,6 @@ set -e
screenshot="$(mktemp --suffix=".png")"
scrot "$screenshot"
"$(dirname "$0")/to_ansi.sh" "$screenshot" 107
"$(dirname "$0")/to_ansi.sh" "$screenshot" 128
rm "$screenshot"

View File

@ -36,13 +36,21 @@ done
| sed -r -e 's/ +/ /g' \
| fold -w $((width*3)) \
| awk "{ if (NR % 2 == 0) print > \"$even_lines\"; else print > \"$odd_lines\"; }"
cat "$odd_lines" | sed -e 's/ $//' | tr ' ' '\n' > "$odd_lines_px"
cat "$even_lines" | sed -e 's/ $//' | tr ' ' '\n' > "$even_lines_px"
nodd="$(wc -l "$odd_lines" | cut -d ' ' -f 1)"
neven="$(wc -l "$even_lines" | cut -d ' ' -f 1)"
if test "$nodd" -gt "$neven"; then nlines="$neven"; else nlines="$nodd"; fi
head -n "$nlines" "$odd_lines" | sed -e 's/ $//' | tr ' ' '\n' > "$odd_lines_px"
head -n "$nlines" "$even_lines" | sed -e 's/ $//' | tr ' ' '\n' > "$even_lines_px"
paste "$odd_lines_px" "$even_lines_px" \
| tr '\t\n' ' ' \
| fold -w $((width*6)) \
| sed -r -e 's/([01])([0-7]) ([01])([0-7]) /[\1;3\2;4\4m▀/g' -e 's/$//' \
| if test "$CI" = "true" -a "$TRAVIS" = "true"; then while IFS=$'\n' read -n 11 ab; do if test "${#ab}" -ne 11; then echo "$ab"; else echo -n "$ab"; fi; sleep 0.01; done; else cat; fi
| if test "$CI" = "true" -a "$TRAVIS" = "true"; then sed -e 's/▀/"/g'; else cat; fi
# Using the line below instead of the one above will ensure that the output is
# printed slow enought that unicode corruption by Travis is unlikely.
#
# | if test "$CI" = "true" -a "$TRAVIS" = "true"; then while IFS=$'\n' read -n 11 ab; do if test "${#ab}" -ne 11; then echo "$ab"; else echo -n "$ab"; fi; sleep 0.01; done; else cat; fi
echo
rm "${mini_png}" "${colors_gif}" "${indexed_gif}" "${indexed_pgm}" "${odd_lines}" "${even_lines}" "${odd_lines_px}" "${even_lines_px}"

View File

@ -25,7 +25,7 @@ EOF
# -fg chocolate -bg coral looks nice too :)
echo "$bg $twm_cfg $anim"
xvfb-run -a --server-args="-screen 0 ${resolution}" sh -c 'SM_SAVE_DIR="'"$twm_session_dir"'" twm -f "'"$twm_cfg"'" & xsetroot -bitmap "'"$bg"'" -fg gray75 -bg gray50; sleep 1; utils/screenshots-loop.sh "'"$anim"'" & "$@"' utils/gui-wrapper.sh-subshell "$@"
xvfb-run -a --server-args="-screen 0 ${resolution}" sh -c 'sleep 1; SM_SAVE_DIR="'"$twm_session_dir"'" twm -f "'"$twm_cfg"'" & xsetroot -bitmap "'"$bg"'" -fg gray75 -bg gray50; sleep 1; utils/screenshots-loop.sh "'"$anim"'" & "$@"' utils/gui-wrapper.sh-subshell "$@"
touch "$anim/stop-screenshots"
for i in `seq 60`; do if test -e "$anim/anim-done"; then break; fi; sleep 1; done