Open
Description
I find the way in which FileCheck renders its output very confusing and difficult to read. It would be good if there was a --diff
option that let users render their mismatches in the form of various diff outputs too. In addition to making the output more readable, this would also make it easier to show multiple mismatches in the same run.
FileCheck default
--
/tmp/example/test:52:17: error: CHECK_CMAKE: expected string not found in input
// CHECK_CMAKE: -- The C compiler identification is [[COMPILER]] {{\d+(.\d+)*}}
^
<stdin>:6:32: note: scanning from here
-- Running vcpkg install - done
^
<stdin>:6:32: note: with "COMPILER" equal to "GNU"
-- Running vcpkg install - done
^
<stdin>:7:1: note: possible intended match here
-- The C compiler identification is GNU 13.2.1
^
Input file: <stdin>
Check file: /tmp/example/test
-dump-input=help explains the following input dump.
Input was:
<<<<<<
1: -- Bootstrapping vcpkg before install
2: -- Bootstrapping vcpkg before install - done
3: -- Running vcpkg install
4: All requested packages are currently installed.
5: Total install time: 581 ns
6: -- Running vcpkg install - done
check:52'0 X error: no match found
check:52'1 with "COMPILER" equal to "GNU"
7: -- The C compiler identification is GNU 13.2.1
check:52'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check:52'2 ? possible intended match
8: -- The CXX compiler identification is GNU 13.2.1
check:52'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9: -- Detecting C compiler ABI info
check:52'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10: -- Detecting C compiler ABI info - done
check:52'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11: -- Check for working C compiler: /usr/bin/gcc - skipped
check:52'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12: -- Detecting C compile features
check:52'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.
.
.
>>>>>>
Unified diff
A lot of the information that FileCheck provides should be implicitly available via the change in output structure. The failing check prefix is presented next to the filename.
--- /tmp/example/test (CHECK_CMAKE)
+++ <stdin>
@@ -52,1 +7,1 @@
- -- The C compiler identification is GNU {{\d+(.\d+)*}}
+ -- The C compiler identification is GNU 13.2.1
- -- The CXX compiler identification is GNU {{\d+(.\d+)*}}
+ -- The CXX compiler identification is GNU 13.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
Substitutions are automatically applied in the diff: perhaps there should be a --diff=unidiff-no-substitutions
to show [[COMPILER]]
instead of GNU
.
Possible interface
--diff=<value> - Format how output is dumped to stderr
=llvm - Outputs a traditional FileCheck output. `--dump-input-*` are
ignored unless this mode is selected.
=unidiff - Outputs a unified diff
=unidiff-no-substitutions - Outputs a unified diff, without substituting macros in the
diff output