[libcxx] [test] Fix the put_double, put_long_double tests for clang-cl

These tests are hit hard by a bug that is fixed in a newer version
of UCRT. Add a test for the specific bug, and XFAIL the tests if
that bug is present (as it is in CI).

Split out hex formatting of floats to separate test files, that
are excluded with `XFAIL: msvc`. (Based on reading the C standard for
printf formatting, it seems like this isn't necessarily a proper bug
in printf, but just a case of differing optional behaviour.)

Differential Revision: https://reviews.llvm.org/D120022
This commit is contained in:
Martin Storsjö 2022-02-10 09:56:44 +00:00
parent eb4dcc744d
commit d2617a6b52
5 changed files with 7293 additions and 7197 deletions

View File

@ -85,6 +85,19 @@ DEFAULT_FEATURES = [
}
""")),
# Check for a Windows UCRT bug (fixed in UCRT/Windows 10.0.19041.0).
# https://developercommunity.visualstudio.com/t/printf-formatting-with-g-outputs-too/1660837
Feature(name='win32-broken-printf-g-precision',
when=lambda cfg: '_WIN32' in compilerMacros(cfg) and not programSucceeds(cfg, """
#include <stdio.h>
#include <string.h>
int main(int, char**) {
char buf[100];
snprintf(buf, sizeof(buf), "%#.*g", 0, 0.0);
return strcmp(buf, "0.");
}
""")),
# Whether Bash can run on the executor.
# This is not always the case, for example when running on embedded systems.
#