summaryrefslogtreecommitdiffstats
path: root/tests/run-make/tools.mk
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /tests/run-make/tools.mk
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/run-make/tools.mk')
-rw-r--r--tests/run-make/tools.mk22
1 files changed, 22 insertions, 0 deletions
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`