From ef24de24a82fe681581cc130f342363c47c0969a Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 7 Jun 2024 07:48:48 +0200 Subject: Merging upstream version 1.75.0+dfsg1. Signed-off-by: Daniel Baumann --- tests/run-make/tools.mk | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests/run-make/tools.mk') diff --git a/tests/run-make/tools.mk b/tests/run-make/tools.mk index 6121a91e9..1d4e91113 100644 --- a/tests/run-make/tools.mk +++ b/tests/run-make/tools.mk @@ -21,6 +21,28 @@ CGREP := "$(S)/src/etc/cat-and-grep.sh" # diff with common flags for multi-platform diffs against text output DIFF := diff -u --strip-trailing-cr +# With RUSTC_TEST_OP you can elegantly support blessing of run-make tests. Do +# like this in a Makefile recipe: +# +# "$(TMPDIR)"/your-test > "$(TMPDIR)"/your-test.run.stdout +# $(RUSTC_TEST_OP) "$(TMPDIR)"/your-test.run.stdout your-test.run.stdout +# +# When running the test normally with +# +# ./x test tests/run-make/your-test +# +# the actual output will be diffed against the expected output. When running in +# bless-mode with +# +# ./x test --bless tests/run-make/your-test +# +# the actual output will be blessed as the expected output. +ifdef RUSTC_BLESS_TEST + RUSTC_TEST_OP = cp +else + RUSTC_TEST_OP = $(DIFF) +endif + # Some of the Rust CI platforms use `/bin/dash` to run `shell` script in # Makefiles. Other platforms, including many developer platforms, default to # `/bin/bash`. (In many cases, `make` is actually using `/bin/sh`, but `sh` -- cgit v1.2.3