Ticket #3784: extfs: add diff output to tester.

Signed-off-by: Mooffie <mooffie@gmail.com>
This commit is contained in:
Mooffie 2017-03-07 23:41:22 +02:00
parent 91b69d2652
commit 55624eae3b

View File

@ -110,11 +110,18 @@ has_prog() {
command -v "$1" >/dev/null 2>&1
}
#
# Are we running interactively? Or is our output redirected to a file/pipe?
#
is_interactive() {
[ -t 1 ]
}
#
# Can we use colors?
#
has_colors() {
[ -t 1 ] && has_string "$TERM" 'linux\|xterm\|screen\|tmux\|putty'
is_interactive && has_string "$TERM" 'linux\|xterm\|screen\|tmux\|putty'
}
init_colors() {
@ -329,6 +336,7 @@ run() {
err "If the actual output is the correct one, just copy the latter file"
err "onto the former (and commit to the git repository)."
err
if is_interactive; then
if [ $opt_run_mcdiff_on_error = "yes" ]; then
notice "Hit ENTER to launch mcdiff ..."
read dummy_var # dash needs this.
@ -337,6 +345,14 @@ run() {
notice "Tip: invoke this program with '--mcdiff' to automatically launch"
notice "mcdiff to visually inspect the diff."
notice
notice "(Running this program non-interactively (i.e., redirecting the"
notice "output to a file or pipe) automatically adds diff to the output.)"
notice
fi
else
err "------------ diff of the expected output vs the actual output: -------------"
diff -U2 "$expected_parsed_output" "$actual_parsed_output"
err "------------------------------- end of diff --------------------------------"
fi
continue
fi