File tree Expand file tree Collapse file tree 11 files changed +33
-69
lines changed
raw-dylib-alt-calling-convention
raw-dylib-import-name-type
raw-dylib-inline-cross-dylib
raw-dylib-stdcall-ordinal Expand file tree Collapse file tree 11 files changed +33
-69
lines changed Original file line number Diff line number Diff line change @@ -3,9 +3,4 @@ include ../tools.mk
33
44all :
55 $(RUSTC ) main.rs --emit=mir -o " $( TMPDIR) " /dump.mir
6-
7- ifdef RUSTC_BLESS_TEST
8- cp "$(TMPDIR)"/dump.mir dump.mir
9- else
10- $(DIFF) dump.mir "$(TMPDIR)"/dump.mir
11- endif
6+ $(RUSTC_TEST_OP ) " $( TMPDIR) " /dump.mir dump.mir
Original file line number Diff line number Diff line change 11include ../tools.mk
22
3- ifdef RUSTC_BLESS_TEST
4- RUSTC_TEST_OP = cp
5- else
6- RUSTC_TEST_OP = $(DIFF )
7- endif
8-
93all :
104 $(RUSTC ) --emit=metadata,dep-info --crate-type lib dash-separated.rs -C extra-filename=_something-extra
115 # Strip TMPDIR since it is a machine specific absolute path
Original file line number Diff line number Diff line change @@ -3,11 +3,5 @@ include ../tools.mk
33all :
44 $(RUSTC ) main.rs -o main.rs 2> $(TMPDIR ) /file.stderr || echo " failed successfully"
55 $(RUSTC ) main.rs -o . 2> $(TMPDIR ) /folder.stderr || echo " failed successfully"
6-
7- ifdef RUSTC_BLESS_TEST
8- cp "$(TMPDIR)"/file.stderr file.stderr
9- cp "$(TMPDIR)"/folder.stderr folder.stderr
10- else
11- $(DIFF) file.stderr "$(TMPDIR)"/file.stderr
12- $(DIFF) folder.stderr "$(TMPDIR)"/folder.stderr
13- endif
6+ $(RUSTC_TEST_OP ) " $( TMPDIR) " /file.stderr file.stderr
7+ $(RUSTC_TEST_OP ) " $( TMPDIR) " /folder.stderr folder.stderr
Original file line number Diff line number Diff line change 1616endif
1717
1818 "$(TMPDIR)"/driver > "$(TMPDIR)"/output.txt
19- ifdef RUSTC_BLESS_TEST
20- cp "$(TMPDIR)"/output.txt output.txt
21- else
22- $(DIFF) output.txt "$(TMPDIR)"/output.txt
23- endif
19+ $(RUSTC_TEST_OP) "$(TMPDIR)"/output.txt output.txt
2420
2521ifdef IS_MSVC
2622 "$(TMPDIR)"/driver true > "$(TMPDIR)"/output.msvc.txt
27- ifdef RUSTC_BLESS_TEST
28- cp "$(TMPDIR)"/output.msvc.txt output.msvc.txt
29- else
30- $(DIFF) output.msvc.txt "$(TMPDIR)"/output.msvc.txt
31- endif
23+ $(RUSTC_TEST_OP) "$(TMPDIR)"/output.msvc.txt output.msvc.txt
3224endif
Original file line number Diff line number Diff line change 1414 $(CC) "$(TMPDIR)"/extern.obj extern.gnu.def --no-leading-underscore -shared -o "$(TMPDIR)"/extern.dll
1515endif
1616 "$(TMPDIR)"/driver > "$(TMPDIR)"/output.txt
17-
18- ifdef RUSTC_BLESS_TEST
19- cp "$(TMPDIR)"/output.txt output.txt
20- else
21- $(DIFF) output.txt "$(TMPDIR)"/output.txt
22- endif
17+ $(RUSTC_TEST_OP) "$(TMPDIR)"/output.txt output.txt
Original file line number Diff line number Diff line change 2727 $(CC) "$(TMPDIR)"/extern_2.obj -shared -o "$(TMPDIR)"/extern_2.dll
2828endif
2929 $(call RUN,driver) > "$(TMPDIR)"/output.txt
30-
31- ifdef RUSTC_BLESS_TEST
32- cp "$(TMPDIR)"/output.txt output.txt
33- else
34- $(DIFF) output.txt "$(TMPDIR)"/output.txt
35- endif
30+ $(RUSTC_TEST_OP) "$(TMPDIR)"/output.txt output.txt
Original file line number Diff line number Diff line change 1414 $(CC) "$(TMPDIR)"/exporter.obj exporter.def -shared -o "$(TMPDIR)"/exporter.dll
1515endif
1616 "$(TMPDIR)"/driver > "$(TMPDIR)"/output.txt
17-
18- ifdef RUSTC_BLESS_TEST
19- cp "$(TMPDIR)"/output.txt output.txt
20- else
21- $(DIFF) output.txt "$(TMPDIR)"/output.txt
22- endif
17+ $(RUSTC_TEST_OP) "$(TMPDIR)"/output.txt output.txt
Original file line number Diff line number Diff line change 1515 $(CC) "$(TMPDIR)"/exporter.obj exporter-gnu.def -shared -o "$(TMPDIR)"/exporter.dll
1616endif
1717 "$(TMPDIR)"/driver > "$(TMPDIR)"/actual_output.txt
18-
19- ifdef RUSTC_BLESS_TEST
20- cp "$(TMPDIR)"/actual_output.txt expected_output.txt
21- else
22- $(DIFF) expected_output.txt "$(TMPDIR)"/actual_output.txt
23- endif
18+ $(RUSTC_TEST_OP) "$(TMPDIR)"/actual_output.txt expected_output.txt
Original file line number Diff line number Diff line change 33
44include ../tools.mk
55
6- ifdef RUSTC_BLESS_TEST
7- RUSTC_TEST_OP = cp
8- else
9- RUSTC_TEST_OP = $(DIFF )
10- endif
11-
126all :
137 echo ' "comes from a file with a name that begins with <"' > " $( TMPDIR) /<leading-lt"
148 echo ' "comes from a file with a name that ends with >"' > " $( TMPDIR) /trailing-gt>"
Original file line number Diff line number Diff line change @@ -21,6 +21,28 @@ CGREP := "$(S)/src/etc/cat-and-grep.sh"
2121# diff with common flags for multi-platform diffs against text output
2222DIFF := diff -u --strip-trailing-cr
2323
24+ # With RUSTC_TEST_OP you can elegantly support blessing of run-make tests. Do
25+ # like this in a Makefile recipe:
26+ #
27+ # "$(TMPDIR)"/your-test > "$(TMPDIR)"/your-test.run.stdout
28+ # $(RUSTC_TEST_OP) "$(TMPDIR)"/your-test.run.stdout your-test.run.stdout
29+ #
30+ # When running the test normally with
31+ #
32+ # ./x test tests/run-make/your-test
33+ #
34+ # the actual output will be diffed against the expected output. When running in
35+ # bless-mode with
36+ #
37+ # ./x test --bless tests/run-make/your-test
38+ #
39+ # the actual output will be blessed as the expected output.
40+ ifdef RUSTC_BLESS_TEST
41+ RUSTC_TEST_OP = cp
42+ else
43+ RUSTC_TEST_OP = $(DIFF )
44+ endif
45+
2446# Some of the Rust CI platforms use `/bin/dash` to run `shell` script in
2547# Makefiles. Other platforms, including many developer platforms, default to
2648# `/bin/bash`. (In many cases, `make` is actually using `/bin/sh`, but `sh`
You can’t perform that action at this time.
0 commit comments