Handling platform-specific spellings of the same error in lit tests


There are different spellings of the same error based on the platform. For example,

Windows: no such file or directory
Linux: No such file or directory
z/OS: EDC5129I No such file or directory.

So far, these have been handled in lit tests using a regex like so: {{[Nn]}}o such file or directory

Instead of making this regex more complicated when adding support for more spellings, an alternative solution was proposed in my patch https://reviews.llvm.org/D95246. This was to use a lit substitution for error messages based on the host platform.

//RUN: ..... | FileCheck -DFILE=%t -DMSG=%errc_ENOENT %s
//CHECK: error: '[[FILE]]': [[MSG]]

If there are any alternative solutions or feedback on this approach, please reply here or on the patch.

Thanks in advance,