]> git.proxmox.com Git - rustc.git/blame - src/test/run-make-fulldeps/coverage-spanview/Makefile
Merge tag 'debian/1.52.1+dfsg1-1_exp2' into proxmox/buster
[rustc.git] / src / test / run-make-fulldeps / coverage-spanview / Makefile
CommitLineData
fc512014 1# needs-profiler-support
5869c6ff 2# min-llvm-version: 11.0
fc512014
XL
3
4-include ../coverage/coverage_tools.mk
5
6BASEDIR=../coverage-spanview
7SOURCEDIR=../coverage
8
9define SPANVIEW_HEADER
10<!DOCTYPE html>
11<!--
12
13Preview this file as rendered HTML from the github source at:
14https://htmlpreview.github.io/?https://github.com/rust-lang/rust/blob/master/src/test/run-make-fulldeps/coverage-spanview/expected_mir_dump.%s/%s
15
16For revisions in Pull Requests (PR):
17 * Replace "rust-lang" with the github PR author
18 * Replace "master" with the PR branch name
19
20-->
21endef
22export SPANVIEW_HEADER
23
fc512014 24all: $(patsubst $(SOURCEDIR)/lib/%.rs,%,$(wildcard $(SOURCEDIR)/lib/*.rs)) $(patsubst $(SOURCEDIR)/%.rs,%,$(wildcard $(SOURCEDIR)/*.rs))
fc512014
XL
25
26# Ensure there are no `expected` results for tests that may have been removed or renamed
27.PHONY: clear_expected_if_blessed
28clear_expected_if_blessed:
29ifdef RUSTC_BLESS_TEST
30 rm -rf expected_mir_dump.*/
31endif
32
33-include clear_expected_if_blessed
34
35# FIXME(richkadel): The actions for these two types of targets (libraries and binaries) should be
36# combined.
37
38%: $(SOURCEDIR)/lib/%.rs
39 # Compile the test library with coverage instrumentation
40 $(RUSTC) $(SOURCEDIR)/lib/$@.rs \
6a06907d 41 $$( sed -nE 's#^// compile-flags:(.*)#\1# p' $(SOURCEDIR)/lib/$@.rs) \
fc512014 42 --crate-type rlib \
6a06907d 43 -Ztrim-diagnostic-paths=no \
fc512014
XL
44 -Zinstrument-coverage \
45 -Zdump-mir=InstrumentCoverage \
46 -Zdump-mir-spanview \
47 -Zdump-mir-dir="$(TMPDIR)"/mir_dump.$@
48
49 for path in "$(TMPDIR)"/mir_dump.$@/*; do \
50 file="$$(basename "$$path")"; \
51 urlescaped="$$("$(PYTHON)" $(BASEDIR)/escape_url.py $$file)" || exit $$?; \
52 printf "$$SPANVIEW_HEADER\n" "$@" "$$urlescaped" > "$$path".modified; \
53 tail -n +2 "$$path" >> "$$path".modified; \
54 mv "$$path".modified "$$path"; \
55 done && true # for/done ends in non-zero status
56
57ifdef RUSTC_BLESS_TEST
58 mkdir -p expected_mir_dump.$@
59 cp "$(TMPDIR)"/mir_dump.$@/*InstrumentCoverage.0.html expected_mir_dump.$@/
60else
61 # Check that the selected `mir_dump` files match what we expect (`--bless` refreshes `expected`)
62 mkdir -p "$(TMPDIR)"/actual_mir_dump.$@
63 rm -f "$(TMPDIR)"/actual_mir_dump.$@/*
64 cp "$(TMPDIR)"/mir_dump.$@/*InstrumentCoverage.0.html "$(TMPDIR)"/actual_mir_dump.$@/
65 $(DIFF) -r expected_mir_dump.$@/ "$(TMPDIR)"/actual_mir_dump.$@/
66endif
67
68%: $(SOURCEDIR)/%.rs
69 # Compile the test program with coverage instrumentation
70 $(RUSTC) $(SOURCEDIR)/$@.rs \
6a06907d 71 $$( sed -nE 's#^// compile-flags:(.*)#\1# p' $(SOURCEDIR)/$@.rs) \
fc512014 72 -L "$(TMPDIR)" \
6a06907d 73 -Ztrim-diagnostic-paths=no \
fc512014
XL
74 -Zinstrument-coverage \
75 -Zdump-mir=InstrumentCoverage \
76 -Zdump-mir-spanview \
77 -Zdump-mir-dir="$(TMPDIR)"/mir_dump.$@
78
79 for path in "$(TMPDIR)"/mir_dump.$@/*; do \
80 file="$$(basename "$$path")"; \
81 urlescaped="$$("$(PYTHON)" $(BASEDIR)/escape_url.py $$file)" || exit $$?; \
82 printf "$$SPANVIEW_HEADER\n" "$@" "$$urlescaped" > "$$path".modified; \
83 tail -n +2 "$$path" >> "$$path".modified; \
84 mv "$$path".modified "$$path"; \
85 done && true # for/done ends in non-zero status
86
87ifdef RUSTC_BLESS_TEST
88 mkdir -p expected_mir_dump.$@
89 cp "$(TMPDIR)"/mir_dump.$@/*InstrumentCoverage.0.html expected_mir_dump.$@/
90else
91 # Check that the selected `mir_dump` files match what we expect (`--bless` refreshes `expected`)
92 mkdir -p "$(TMPDIR)"/actual_mir_dump.$@
93 rm -f "$(TMPDIR)"/actual_mir_dump.$@/*
94 cp "$(TMPDIR)"/mir_dump.$@/*InstrumentCoverage.0.html "$(TMPDIR)"/actual_mir_dump.$@/
95 $(DIFF) -r expected_mir_dump.$@/ "$(TMPDIR)"/actual_mir_dump.$@/
96endif