On a platforms that we build LLVM on, we have some failing test cases that are related to the system's toolchain. This patch aims to:
- Explicitly add macro guards for a compiler_rt builtins test case
- Change a sanitizer test case to remove the use of std::string (this causes a false positive on our system)
The compiler-rt builtin test case, compiler_rt_logb_test.c compares its computed values to the values of its libm counterpart. Our version of libm seems to be older, and because of this dependency on libm, we see errors and inconsistencies. If a minimum version of GLIBC 2.23 is detected, then these tests are run. The version 2.23 was chosen because it is the version that I found has not been error-prone for these tests.
Another test is related to MSan/sanitizer-common (getpw_getgr.cc). There are two lines that are problematic. A global string is defined at the top of the file, is later assigned in a function, and then the string's c_str() becomes a parameter to a function afterwards. This may be related to using/not using the C++11 ABI, as the test case fails when _GLIBCXX_USE_CXX11_ABI=0 and succeeds when _GLIBCXX_USE_CXX11_ABI=1. We guard the problematic lines, such that we only execute the lines when the macro is set.
Edit (Apr 26): This could be a false positive. Instead of adding the checks for the GLIBCXX macro, we should adjust the test such that we avoid the use of std::string in this test case.
I've added some individuals who have worked with these test cases in the past as reviewers. I apologize if I missed anyone else. Please, if anyone has any comments or concerns on if these are suitable changes for these tests, I would greatly appreciate the feedback.
I think the test should continue to run on non-GLIBC systems.
The __GLIBC_PREREQ checking used in the above is based on how compiler-rt/test/sanitizer_common/TestCases/Linux/mprobe.cc uses that macro.