|
13 | 13 | BASEDIR=../coverage-reports-base
|
14 | 14 | SOURCEDIR=../coverage
|
15 | 15 |
|
| 16 | +# The `llvm-cov show` flag `--debug`, used to generate the `counters` output files, is only enabled |
| 17 | +# if LLVM assertions are enabled. Some CI builds disable debug assertions. |
| 18 | +ifndef NO_LLVM_ASSERTIONS |
| 19 | +DEBUG_FLAG=--debug |
| 20 | +endif |
| 21 | + |
| 22 | +# When generating `expected_*` results (using `x.py test --bless`), the `--debug` flag is forced. |
| 23 | +# If assertions are disabled, the command will fail with an error, rather than attempt to generate |
| 24 | +# only partial results. |
| 25 | +ifdef RUSTC_BLESS_TEST |
| 26 | +DEBUG_FLAG=--debug |
| 27 | +endif |
| 28 | + |
16 | 29 | all: $(patsubst $(SOURCEDIR)/%.rs,%,$(wildcard $(SOURCEDIR)/*.rs))
|
17 | 30 |
|
18 | 31 | # Ensure there are no `expected` results for tests that may have been removed or renamed
|
@@ -50,24 +63,27 @@ endif
|
50 | 63 |
|
51 | 64 |
|
52 | 65 |
|
53 |
| - # Generate a coverage report using `llvm-cov show`. The output ordering |
54 |
| - # can be non-deterministic, so ignore the return status. If the test fails |
55 |
| - # when comparing the JSON `export`, the `show` output may be useful when |
56 |
| - # debugging. |
| 66 | + # Generate a coverage report using `llvm-cov show`. |
57 | 67 | "$(LLVM_BIN_DIR)"/llvm-cov show \
|
58 |
| - --debug \ |
| 68 | + $(DEBUG_FLAG) \ |
59 | 69 | --Xdemangler="$(RUST_DEMANGLER)" \
|
60 | 70 | --show-line-counts-or-regions \
|
61 | 71 | --instr-profile="$(TMPDIR)"/ [email protected] \
|
62 | 72 | $(call BIN,"$(TMPDIR)"/$@) \
|
63 | 73 |
|
64 |
| - |
| 74 | + 2> "$(TMPDIR)"/ [email protected] || \ |
| 75 | + ( status=$$? ; \ |
| 76 | + >&2 cat "$(TMPDIR)"/ [email protected] ; \ |
| 77 | + exit $$status \ |
| 78 | + ) |
65 | 79 |
|
| 80 | +ifdef DEBUG_FLAG |
66 | 81 | # The first line (beginning with "Args:" contains hard-coded, build-specific
|
67 | 82 | # file paths. Strip that line and keep the remaining lines with counter debug
|
68 | 83 | # data.
|
69 | 84 | tail -n +2 "$(TMPDIR)"/ [email protected] \
|
70 | 85 |
|
| 86 | +endif |
71 | 87 |
|
72 | 88 | ifdef RUSTC_BLESS_TEST
|
73 | 89 | cp "$(TMPDIR)"/ [email protected] \
|
|
87 | 103 | false \
|
88 | 104 | )
|
89 | 105 |
|
| 106 | +ifdef DEBUG_FLAG |
90 | 107 |
|
91 | 108 | ( grep -q '^\/\/ ignore-llvm-cov-show-diffs' $(SOURCEDIR)/ [email protected] && \
|
92 | 109 | >&2 echo 'diff failed, but suppressed with `// ignore-llvm-cov-show-diffs` in $(SOURCEDIR)/ [email protected]' \
|
|
99 | 116 | # so the crate disambiguator differences will be stripped away. At that point, these files
|
100 | 117 | # will be less likely to vary, and the last `echo` above (starting with "Ignore anyway")
|
101 | 118 | # can be replaced with `false` to fail the test.
|
| 119 | +endif |
102 | 120 |
|
103 | 121 | endif
|
104 | 122 |
|
|
0 commit comments