[libcxx-commits] [PATCH] D120979: [libcxx] [test] Skip the get/put long_double_ru_RU tests on Glibc < 2.27

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 4 00:55:30 PST 2022


mstorsjo created this revision.
mstorsjo added reviewers: uabelho, Quuxplusone, Mordante.
Herald added a project: All.
mstorsjo requested review of this revision.
Herald added a project: libc++.
Herald added a reviewer: libc++.

Those older versions used a different monetary decimal separator.
To avoid unnecessary churn to support that, just skip the test
on those older versions. (Up until recently, the whole test was
XFAILed on all versions of glibc.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120979

Files:
  libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp
  libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp


Index: libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp
===================================================================
--- libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp
+++ libcxx/test/std/localization/locale.categories/category.monetary/locale.money.put/locale.money.put.members/put_long_double_ru_RU.pass.cpp
@@ -20,6 +20,7 @@
 
 #include <locale>
 #include <ios>
+#include <iostream>
 #include <streambuf>
 #include <cassert>
 #include "test_macros.h"
@@ -56,6 +57,15 @@
 
 int main(int, char**)
 {
+#if defined(_CS_GNU_LIBC_VERSION)
+    // Glibc before 2.27 used '.' instead of ',' as monetary decimal separator.
+    // Just skip the test (which gets marked as PASS, though) to avoid
+    // unnecessary churn for such old versions.
+    if (glibc_version_less_than("2.27")) {
+        std::cerr << "Skipping test\n";
+        return 0;
+    }
+#endif
     std::ios ios(0);
     std::string loc_name(LOCALE_ru_RU_UTF_8);
     ios.imbue(std::locale(ios.getloc(),
Index: libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp
===================================================================
--- libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp
+++ libcxx/test/std/localization/locale.categories/category.monetary/locale.money.get/locale.money.get.members/get_long_double_ru_RU.pass.cpp
@@ -20,6 +20,7 @@
 
 #include <locale>
 #include <ios>
+#include <iostream>
 #include <streambuf>
 #include <cassert>
 #include "test_macros.h"
@@ -56,6 +57,15 @@
 
 int main(int, char**)
 {
+#if defined(_CS_GNU_LIBC_VERSION)
+    // Glibc before 2.27 used '.' instead of ',' as monetary decimal separator.
+    // Just skip the test (which gets marked as PASS, though) to avoid
+    // unnecessary churn for such old versions.
+    if (glibc_version_less_than("2.27")) {
+        std::cerr << "Skipping test\n";
+        return 0;
+    }
+#endif
     std::ios ios(0);
     std::string loc_name(LOCALE_ru_RU_UTF_8);
     ios.imbue(std::locale(ios.getloc(),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120979.412951.patch
Type: text/x-patch
Size: 2308 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220304/223e2c99/attachment-0001.bin>


More information about the libcxx-commits mailing list