[libcxx-commits] [PATCH] D155182: [libcxx] [test] Skip timezone formatting tests on Windows
Martin Storsjö via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jul 13 04:43:38 PDT 2023
mstorsjo created this revision.
mstorsjo added a reviewer: Mordante.
Herald added a project: All.
mstorsjo requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
While these tests do pass in the CI environment, they fail elsewhere.
On GitHub Action runners, they produce '+0000' instead of '-0000' for
the UTC offset, and on local machines, it outputs the UTC offset of
the local timezone.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D155182
Files:
libcxx/test/std/time/time.syn/formatter.file_time.pass.cpp
libcxx/test/std/time/time.syn/formatter.sys_time.pass.cpp
Index: libcxx/test/std/time/time.syn/formatter.sys_time.pass.cpp
===================================================================
--- libcxx/test/std/time/time.syn/formatter.sys_time.pass.cpp
+++ libcxx/test/std/time/time.syn/formatter.sys_time.pass.cpp
@@ -859,7 +859,9 @@
// The Apple CI gives %z='-0700' %Ez='-0700' %Oz='-0700' %Z='UTC'
// -0700 looks like the local time where the CI happens to recide, therefore
// omit this test on Apple.
-#if !defined(__APPLE__)
+// The Windows CI gives %z='-0000', but on local machines set to a different
+// timezone, it gives e.g. %z='+0200'.
+#if !defined(__APPLE__) && !defined(_WIN32)
using namespace std::literals::chrono_literals;
constexpr std::basic_string_view<CharT> fmt = SV("{:%%z='%z'%t%%Ez='%Ez'%t%%Oz='%Oz'%t%%Z='%Z'%n}");
@@ -884,22 +886,6 @@
SV("%z='UTC'\t%Ez='UTC'\t%Oz='UTC'\t%Z='UTC'\n"),
lfmt,
std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
-# elif defined(_WIN32) // defined(_AIX)
- // Non localized output using C-locale
- check(SV("%z='-0000'\t%Ez='-0000'\t%Oz='-0000'\t%Z='UTC'\n"),
- fmt,
- std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
-
- // Use the global locale (fr_FR)
- check(SV("%z='-0000'\t%Ez='-0000'\t%Oz='-0000'\t%Z='UTC'\n"),
- lfmt,
- std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
-
- // Use supplied locale (ja_JP). This locale has a different alternate.a
- check(loc,
- SV("%z='-0000'\t%Ez='-0000'\t%Oz='-0000'\t%Z='UTC'\n"),
- lfmt,
- std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
# else // defined(_AIX)
// Non localized output using C-locale
check(SV("%z='+0000'\t%Ez='+0000'\t%Oz='+0000'\t%Z='UTC'\n"),
@@ -918,7 +904,7 @@
std::chrono::sys_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
# endif // defined(_AIX)
std::locale::global(std::locale::classic());
-#endif // !defined(__APPLE__)
+#endif // !defined(__APPLE__) && !defined(_WIN32)
}
template <class CharT>
Index: libcxx/test/std/time/time.syn/formatter.file_time.pass.cpp
===================================================================
--- libcxx/test/std/time/time.syn/formatter.file_time.pass.cpp
+++ libcxx/test/std/time/time.syn/formatter.file_time.pass.cpp
@@ -861,7 +861,9 @@
// The Apple CI gives %z='-0700' %Ez='-0700' %Oz='-0700' %Z='UTC'
// -0700 looks like the local time where the CI happens to recide, therefore
// omit this test on Apple.
-#if !defined(__APPLE__)
+// The Windows CI gives %z='-0000', but on local machines set to a different
+// timezone, it gives e.g. %z='+0200'.
+#if !defined(__APPLE__) && !defined(_WIN32)
using namespace std::literals::chrono_literals;
constexpr std::basic_string_view<CharT> fmt = SV("{:%%z='%z'%t%%Ez='%Ez'%t%%Oz='%Oz'%t%%Z='%Z'%n}");
@@ -886,22 +888,6 @@
SV("%z='UTC'\t%Ez='UTC'\t%Oz='UTC'\t%Z='UTC'\n"),
lfmt,
file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
-# elif defined(_WIN32) // defined(_AIX)
- // Non localized output using C-locale
- check(SV("%z='-0000'\t%Ez='-0000'\t%Oz='-0000'\t%Z='UTC'\n"),
- fmt,
- file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
-
- // Use the global locale (fr_FR)
- check(SV("%z='-0000'\t%Ez='-0000'\t%Oz='-0000'\t%Z='UTC'\n"),
- lfmt,
- file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
-
- // Use supplied locale (ja_JP). This locale has a different alternate.a
- check(loc,
- SV("%z='-0000'\t%Ez='-0000'\t%Oz='-0000'\t%Z='UTC'\n"),
- lfmt,
- file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
# else // defined(_AIX)
// Non localized output using C-locale
check(SV("%z='+0000'\t%Ez='+0000'\t%Oz='+0000'\t%Z='UTC'\n"),
@@ -920,7 +906,7 @@
file_seconds(0s)); // 00:00:00 UTC Thursday, 1 January 1970
# endif // defined(_AIX)
std::locale::global(std::locale::classic());
-#endif // !defined(__APPLE__)
+#endif // !defined(__APPLE__) && !defined(_WIN32)
}
template <class CharT>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155182.539956.patch
Type: text/x-patch
Size: 4235 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230713/185330a9/attachment-0001.bin>
More information about the libcxx-commits
mailing list