[PATCH] D97472: [test] Use host platform specific error message substitution in lit tests

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 26 01:20:58 PST 2021


jhenderson requested changes to this revision.
jhenderson added a comment.
This revision now requires changes to proceed.

Bad news: this doesn't work on Windows. I've dug into why, and unfortunately it's a bizarre difference in behaviour between two different ways of getting the same error message from an error code on Windows. Given the following mini C++ program:

  int main()
  {
    printf("%s\n", strerror(EINVAL));
    printf("%s\n", std::make_error_code(std::errc(EINVAL)).message().c_str());
    return 0;
  }

The output is:

  Invalid argument
  invalid argument

Note that the first uses an upper-case first letter, and the second a lower-case letter. Python, which is written in C will be using the first of these lines to get its error message. However, for the messages produced by LLVM, we are using the C++ `std::error_code` version, which produes the other version. This is obviously a slight problem...!

I wonder if we could use the old approach but have the substitution use a regex still (i.e. something like `{{[Nn]}}`? That would satisfy our use cases at least. It may not work though. I'm not sure if FileCheck variables can be regex patterns or not.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97472/new/

https://reviews.llvm.org/D97472



More information about the llvm-commits mailing list