From a1a80feeea22dcc910b8fcd7dd3d9a5f82d716b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Georges=20Dup=C3=A9ron?= Date: Sun, 8 Jul 2018 18:10:53 +0200 Subject: [PATCH] Remove artificial slowdown of ansi screenshots, use an ASCII character instead of an UTF-8 one to avoid corruption by travis. Cleanup. --- test/all.sh | 4 ---- utils/ansi-screenshots/ansi_screenshot.sh | 2 +- utils/ansi-screenshots/to_ansi.sh | 14 +++++++++++--- utils/gui-wrapper.sh | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) delete mode 100755 test/all.sh diff --git a/test/all.sh b/test/all.sh deleted file mode 100755 index 366779b..0000000 --- a/test/all.sh +++ /dev/null @@ -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 index 2056dd2..ea19c03 100755 --- 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 index 9dba805..80f88dc 100755 --- 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/$//' \ - | 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 index f382c5d..086f3f8 100755 --- 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