commit a1a80feeea22dcc910b8fcd7dd3d9a5f82d716b2
parent 51189eb2cb692b1dae0fa5ce77bb82c1f35665de
Author: Georges Dupéron <georges.duperon@gmail.com>
Date: Sun, 8 Jul 2018 18:10:53 +0200
Remove artificial slowdown of ansi screenshots, use an ASCII character instead of an UTF-8 one to avoid corruption by travis. Cleanup.
Diffstat:
4 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/test/all.sh b/test/all.sh
@@ -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
diff --git a/utils/ansi-screenshots/ansi_screenshot.sh b/utils/ansi-screenshots/ansi_screenshot.sh
@@ -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"
diff --git a/utils/ansi-screenshots/to_ansi.sh b/utils/ansi-screenshots/to_ansi.sh
@@ -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/$/[m/' \
- | 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}"
+
diff --git a/utils/gui-wrapper.sh b/utils/gui-wrapper.sh
@@ -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