@@ -138,6 +138,7 @@ endif
138138 ) \
139139 2> "$(TMPDIR)"/show_coverage_stderr.$@.txt \
140140 | "$(PYTHON)" $(BASEDIR)/normalize_paths.py \
141+ | "$(PYTHON)" $(BASEDIR)/sort_subviews.py \
141142 > "$(TMPDIR)"/actual_show_coverage.$@.txt || \
142143 ( status=$$? ; \
143144 >&2 cat "$(TMPDIR)"/show_coverage_stderr.$@.txt ; \
@@ -158,28 +159,10 @@ ifdef RUSTC_BLESS_TEST
158159else
159160 # Compare the show coverage output (`--bless` refreshes `typical` files).
160161 #
161- # FIXME(richkadel): None of the Rust test source samples have the
162- # `// ignore-llvm-cov-show-diffs` anymore. This directive exists to work around a limitation
163- # with `llvm-cov show`. When reporting coverage for multiple instantiations of a generic function,
164- # with different type substitutions, `llvm-cov show` prints these in a non-deterministic order,
165- # breaking the `diff` comparison.
166- #
167- # A partial workaround is implemented below, with `diff --ignore-matching-lines=RE`
168- # to ignore each line prefixing each generic instantiation coverage code region.
169- #
170- # This workaround only works if the coverage counts are identical across all reported
171- # instantiations. If there is no way to ensure this, you may need to apply the
172- # `// ignore-llvm-cov-show-diffs` directive, and check for differences using the
173- # `.json` files to validate that results have not changed. (Until then, the JSON
174- # files are redundant, so there is no need to generate `expected_*.json` files or
175- # compare actual JSON results.)
176-
177- $(DIFF) --ignore-matching-lines='^ \| .*::<.*>.*:$$' --ignore-matching-lines='^ \| <.*>::.*:$$' \
178- expected_show_coverage.$@.txt "$(TMPDIR)"/actual_show_coverage.$@.txt || \
179- ( grep -q '^\/\/ ignore-llvm-cov-show-diffs' $(SOURCEDIR)/$@.rs && \
180- >&2 echo 'diff failed, but suppressed with `// ignore-llvm-cov-show-diffs` in $(SOURCEDIR)/$@.rs' \
181- ) || \
182- ( >&2 echo 'diff failed, and not suppressed without `// ignore-llvm-cov-show-diffs` in $(SOURCEDIR)/$@.rs'; \
183- false \
184- )
162+ # `llvm-cov show` normally prints instantiation groups in an unpredictable
163+ # order, but we have used `sort_subviews.py` to sort them, so we can still
164+ # check the output directly with `diff`.
165+
166+ $(DIFF) expected_show_coverage.$@.txt "$(TMPDIR)"/actual_show_coverage.$@.txt || \
167+ ( >&2 echo 'diff failed in $(SOURCEDIR)/$@.rs'; false)
185168endif
0 commit comments