[tests] Use git diff instead of diff to colorize `make test` output

Summary:
`diff` by default doesn't colorize its output, while `git diff`
does. Since we already depend on git it seems like a safe change and
brings some quality of life improvement while working with tests.

Reviewed By: ngorogiannis

Differential Revision: D19374691

fbshipit-source-id: 8872b527c
master
Artem Pianykh 5 years ago committed by Facebook Github Bot
parent 9aebdd242f
commit 774223165c

@ -25,7 +25,8 @@ define check_no_duplicates
endef endef
define check_no_diff define check_no_diff
diff -u $(1) $(2) >&2 || \ git --no-pager diff --color=auto --no-ext-diff --no-index --word-diff --unified=1 --minimal \
$$(realpath $(1)) $$(realpath $(2)) >&2 || \
(printf '\n' >&2; \ (printf '\n' >&2; \
printf '$(TERM_ERROR)Test output ($(2)) differs from expected test output $(1)$(TERM_RESET)\n' >&2; \ printf '$(TERM_ERROR)Test output ($(2)) differs from expected test output $(1)$(TERM_RESET)\n' >&2; \
printf '$(TERM_ERROR)Run the following command to replace the expected test output with the new output:$(TERM_RESET)\n' >&2; \ printf '$(TERM_ERROR)Run the following command to replace the expected test output with the new output:$(TERM_RESET)\n' >&2; \

Loading…
Cancel
Save