Auto merge of #116509 - Enselic:rustc-test-op, r=Mark-Simulacrum
tests/run-make: Move RUSTC_TEST_OP to tools.mk and use in more places
This commit is contained in:
commit
6d271692b0
@ -3,9 +3,4 @@ include ../tools.mk
|
|||||||
|
|
||||||
all:
|
all:
|
||||||
$(RUSTC) main.rs --emit=mir -o "$(TMPDIR)"/dump.mir
|
$(RUSTC) main.rs --emit=mir -o "$(TMPDIR)"/dump.mir
|
||||||
|
$(RUSTC_TEST_OP) "$(TMPDIR)"/dump.mir dump.mir
|
||||||
ifdef RUSTC_BLESS_TEST
|
|
||||||
cp "$(TMPDIR)"/dump.mir dump.mir
|
|
||||||
else
|
|
||||||
$(DIFF) dump.mir "$(TMPDIR)"/dump.mir
|
|
||||||
endif
|
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
include ../tools.mk
|
include ../tools.mk
|
||||||
|
|
||||||
ifdef RUSTC_BLESS_TEST
|
|
||||||
RUSTC_TEST_OP = cp
|
|
||||||
else
|
|
||||||
RUSTC_TEST_OP = $(DIFF)
|
|
||||||
endif
|
|
||||||
|
|
||||||
all:
|
all:
|
||||||
$(RUSTC) --emit=metadata,dep-info --crate-type lib dash-separated.rs -C extra-filename=_something-extra
|
$(RUSTC) --emit=metadata,dep-info --crate-type lib dash-separated.rs -C extra-filename=_something-extra
|
||||||
# Strip TMPDIR since it is a machine specific absolute path
|
# Strip TMPDIR since it is a machine specific absolute path
|
||||||
|
@ -3,11 +3,5 @@ include ../tools.mk
|
|||||||
all:
|
all:
|
||||||
$(RUSTC) main.rs -o main.rs 2> $(TMPDIR)/file.stderr || echo "failed successfully"
|
$(RUSTC) main.rs -o main.rs 2> $(TMPDIR)/file.stderr || echo "failed successfully"
|
||||||
$(RUSTC) main.rs -o . 2> $(TMPDIR)/folder.stderr || echo "failed successfully"
|
$(RUSTC) main.rs -o . 2> $(TMPDIR)/folder.stderr || echo "failed successfully"
|
||||||
|
$(RUSTC_TEST_OP) "$(TMPDIR)"/file.stderr file.stderr
|
||||||
ifdef RUSTC_BLESS_TEST
|
$(RUSTC_TEST_OP) "$(TMPDIR)"/folder.stderr folder.stderr
|
||||||
cp "$(TMPDIR)"/file.stderr file.stderr
|
|
||||||
cp "$(TMPDIR)"/folder.stderr folder.stderr
|
|
||||||
else
|
|
||||||
$(DIFF) file.stderr "$(TMPDIR)"/file.stderr
|
|
||||||
$(DIFF) folder.stderr "$(TMPDIR)"/folder.stderr
|
|
||||||
endif
|
|
||||||
|
@ -16,17 +16,9 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
"$(TMPDIR)"/driver > "$(TMPDIR)"/output.txt
|
"$(TMPDIR)"/driver > "$(TMPDIR)"/output.txt
|
||||||
ifdef RUSTC_BLESS_TEST
|
$(RUSTC_TEST_OP) "$(TMPDIR)"/output.txt output.txt
|
||||||
cp "$(TMPDIR)"/output.txt output.txt
|
|
||||||
else
|
|
||||||
$(DIFF) output.txt "$(TMPDIR)"/output.txt
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef IS_MSVC
|
ifdef IS_MSVC
|
||||||
"$(TMPDIR)"/driver true > "$(TMPDIR)"/output.msvc.txt
|
"$(TMPDIR)"/driver true > "$(TMPDIR)"/output.msvc.txt
|
||||||
ifdef RUSTC_BLESS_TEST
|
$(RUSTC_TEST_OP) "$(TMPDIR)"/output.msvc.txt output.msvc.txt
|
||||||
cp "$(TMPDIR)"/output.msvc.txt output.msvc.txt
|
|
||||||
else
|
|
||||||
$(DIFF) output.msvc.txt "$(TMPDIR)"/output.msvc.txt
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
@ -14,9 +14,4 @@ else
|
|||||||
$(CC) "$(TMPDIR)"/extern.obj extern.gnu.def --no-leading-underscore -shared -o "$(TMPDIR)"/extern.dll
|
$(CC) "$(TMPDIR)"/extern.obj extern.gnu.def --no-leading-underscore -shared -o "$(TMPDIR)"/extern.dll
|
||||||
endif
|
endif
|
||||||
"$(TMPDIR)"/driver > "$(TMPDIR)"/output.txt
|
"$(TMPDIR)"/driver > "$(TMPDIR)"/output.txt
|
||||||
|
$(RUSTC_TEST_OP) "$(TMPDIR)"/output.txt output.txt
|
||||||
ifdef RUSTC_BLESS_TEST
|
|
||||||
cp "$(TMPDIR)"/output.txt output.txt
|
|
||||||
else
|
|
||||||
$(DIFF) output.txt "$(TMPDIR)"/output.txt
|
|
||||||
endif
|
|
||||||
|
@ -27,9 +27,4 @@ else
|
|||||||
$(CC) "$(TMPDIR)"/extern_2.obj -shared -o "$(TMPDIR)"/extern_2.dll
|
$(CC) "$(TMPDIR)"/extern_2.obj -shared -o "$(TMPDIR)"/extern_2.dll
|
||||||
endif
|
endif
|
||||||
$(call RUN,driver) > "$(TMPDIR)"/output.txt
|
$(call RUN,driver) > "$(TMPDIR)"/output.txt
|
||||||
|
$(RUSTC_TEST_OP) "$(TMPDIR)"/output.txt output.txt
|
||||||
ifdef RUSTC_BLESS_TEST
|
|
||||||
cp "$(TMPDIR)"/output.txt output.txt
|
|
||||||
else
|
|
||||||
$(DIFF) output.txt "$(TMPDIR)"/output.txt
|
|
||||||
endif
|
|
||||||
|
@ -14,9 +14,4 @@ else
|
|||||||
$(CC) "$(TMPDIR)"/exporter.obj exporter.def -shared -o "$(TMPDIR)"/exporter.dll
|
$(CC) "$(TMPDIR)"/exporter.obj exporter.def -shared -o "$(TMPDIR)"/exporter.dll
|
||||||
endif
|
endif
|
||||||
"$(TMPDIR)"/driver > "$(TMPDIR)"/output.txt
|
"$(TMPDIR)"/driver > "$(TMPDIR)"/output.txt
|
||||||
|
$(RUSTC_TEST_OP) "$(TMPDIR)"/output.txt output.txt
|
||||||
ifdef RUSTC_BLESS_TEST
|
|
||||||
cp "$(TMPDIR)"/output.txt output.txt
|
|
||||||
else
|
|
||||||
$(DIFF) output.txt "$(TMPDIR)"/output.txt
|
|
||||||
endif
|
|
||||||
|
@ -15,9 +15,4 @@ else
|
|||||||
$(CC) "$(TMPDIR)"/exporter.obj exporter-gnu.def -shared -o "$(TMPDIR)"/exporter.dll
|
$(CC) "$(TMPDIR)"/exporter.obj exporter-gnu.def -shared -o "$(TMPDIR)"/exporter.dll
|
||||||
endif
|
endif
|
||||||
"$(TMPDIR)"/driver > "$(TMPDIR)"/actual_output.txt
|
"$(TMPDIR)"/driver > "$(TMPDIR)"/actual_output.txt
|
||||||
|
$(RUSTC_TEST_OP) "$(TMPDIR)"/actual_output.txt expected_output.txt
|
||||||
ifdef RUSTC_BLESS_TEST
|
|
||||||
cp "$(TMPDIR)"/actual_output.txt expected_output.txt
|
|
||||||
else
|
|
||||||
$(DIFF) expected_output.txt "$(TMPDIR)"/actual_output.txt
|
|
||||||
endif
|
|
||||||
|
@ -3,12 +3,6 @@
|
|||||||
|
|
||||||
include ../tools.mk
|
include ../tools.mk
|
||||||
|
|
||||||
ifdef RUSTC_BLESS_TEST
|
|
||||||
RUSTC_TEST_OP = cp
|
|
||||||
else
|
|
||||||
RUSTC_TEST_OP = $(DIFF)
|
|
||||||
endif
|
|
||||||
|
|
||||||
all:
|
all:
|
||||||
echo '"comes from a file with a name that begins with <"' > "$(TMPDIR)/<leading-lt"
|
echo '"comes from a file with a name that begins with <"' > "$(TMPDIR)/<leading-lt"
|
||||||
echo '"comes from a file with a name that ends with >"' > "$(TMPDIR)/trailing-gt>"
|
echo '"comes from a file with a name that ends with >"' > "$(TMPDIR)/trailing-gt>"
|
||||||
|
@ -21,6 +21,28 @@ CGREP := "$(S)/src/etc/cat-and-grep.sh"
|
|||||||
# diff with common flags for multi-platform diffs against text output
|
# diff with common flags for multi-platform diffs against text output
|
||||||
DIFF := diff -u --strip-trailing-cr
|
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
|
# Some of the Rust CI platforms use `/bin/dash` to run `shell` script in
|
||||||
# Makefiles. Other platforms, including many developer platforms, default to
|
# Makefiles. Other platforms, including many developer platforms, default to
|
||||||
# `/bin/bash`. (In many cases, `make` is actually using `/bin/sh`, but `sh`
|
# `/bin/bash`. (In many cases, `make` is actually using `/bin/sh`, but `sh`
|
||||||
|
@ -4,12 +4,5 @@ include ../tools.mk
|
|||||||
|
|
||||||
all:
|
all:
|
||||||
echo 'mod unknown;' | $(RUSTC) --crate-type rlib - >$(TMPDIR)/unknown-mod.stdout 2>$(TMPDIR)/unknown-mod.stderr || echo "failed successfully"
|
echo 'mod unknown;' | $(RUSTC) --crate-type rlib - >$(TMPDIR)/unknown-mod.stdout 2>$(TMPDIR)/unknown-mod.stderr || echo "failed successfully"
|
||||||
|
$(RUSTC_TEST_OP) "$(TMPDIR)"/unknown-mod.stdout unknown-mod.stdout
|
||||||
# Bless like this: RUSTC_BLESS_TEST=1 ./x.py test tests/run-make/unknown-mod-stdin
|
$(RUSTC_TEST_OP) "$(TMPDIR)"/unknown-mod.stderr unknown-mod.stderr
|
||||||
ifdef RUSTC_BLESS_TEST
|
|
||||||
cp "$(TMPDIR)"/unknown-mod.stdout unknown-mod.stdout
|
|
||||||
cp "$(TMPDIR)"/unknown-mod.stderr unknown-mod.stderr
|
|
||||||
else
|
|
||||||
$(DIFF) unknown-mod.stdout "$(TMPDIR)"/unknown-mod.stdout
|
|
||||||
$(DIFF) unknown-mod.stderr "$(TMPDIR)"/unknown-mod.stderr
|
|
||||||
endif
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user