Catch2
Catch2 copied to clipboard
improve `-ffile-prefix-map` detection
Description
the current implementation has two problems:
clang-cldoes not know-ffile-prefix-map, but it identifies as "Clang", so the compiler will warn about an unknown compiler option- xcode's clang however does not identify as "Clang", but as "AppleClang". so
-ffile-prefix-mapis not passed although it is supported by the compiler
Codecov Report
Merging #2517 (2848c2c) into devel (32eae0e) will increase coverage by
0.03%. The diff coverage isn/a.
:exclamation: Current head 2848c2c differs from pull request most recent head 752743b. Consider uploading reports for the commit 752743b to get more accurate results
@@ Coverage Diff @@
## devel #2517 +/- ##
==========================================
+ Coverage 91.54% 91.56% +0.03%
==========================================
Files 183 183
Lines 7561 7560 -1
==========================================
+ Hits 6921 6922 +1
+ Misses 640 638 -2
I think it's a bug with CMake if they identify two different compilers, clang and clang-cl, as the same.
https://gitlab.kitware.com/cmake/cmake/-/issues/22668
This will need some fixes to the path normalization code in approval tests.
This will need some fixes to the path normalization code in approval tests.
do you have any pointers for the entry points to do these fixes?
@timblechmann Approval tests run the SelfTest binary and compare the output to a known good one. The implementation is in tools/scripts/approvalTests.py, and the problematic part is in normalizePath function, which looks for the absolute path to the binary in the text output, and if it finds it, it removes prefix.
-ffile-prefix-map also removes the prefix, but uses a slightly different prefix than the approval test normalization. This leads me to an idea; we could instead change the mapping used by -ffile-prefix-map to ${CATCH_DIR}/=, so that the resulting path is the same as what the approval tests want.