[cfe-dev] How to check paths in tests

Rafael EspĂ­ndola rafael.espindola at gmail.com
Mon Jun 24 15:22:52 PDT 2013


One of the nice features of PathV2 is that we get "natural" paths on
Windows, but that does make testing them a bit harder. We go from

CHECK: foo/bar/zed

to

CHECK: foo{{/|\\}}bar{{/|\\}}zed

or

CHECK: foo{{/|\\\\}}bar{{/|\\\\}}zed

depending on whether the command being tested escapes \ or not. The
first question is why do we escape \? Do we expect some of  the
command to print valid C string? Can we just print a single \
everywhere?

Second question/suggesting is to improve FileCheck to make this a bit
simpler. We could add a

CHECK-PATH: foo/bar/zed

that for now would just replace the / with a regular expression. Once
the transition to PathV2 is complete (and it is used everywhere), we
could make it stricter and check for / on unix and \ on windows.

Sean Silva suggests using something like {{{foo/bar/zed}}} to make the
substitution more local.

What do you guys think?

Cheers,
Rafael



More information about the cfe-dev mailing list