[libcxx-commits] [libcxx] 3277aaa - [libcxx] [test] Skip timezone formatting tests on Windows
Martin Storsjö via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jul 13 23:54:19 PDT 2023
Author: Martin Storsjö
Date: 2023-07-14T09:53:19+03:00
New Revision: 3277aaae6feca4960b6546d20c17bcd796934a52
URL: https://github.com/llvm/llvm-project/commit/3277aaae6feca4960b6546d20c17bcd796934a52
DIFF: https://github.com/llvm/llvm-project/commit/3277aaae6feca4960b6546d20c17bcd796934a52.diff
LOG: [libcxx] [test] Skip timezone formatting tests on Windows
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.
Differential Revision: https://reviews.llvm.org/D155182
Added:
Modified:
libcxx/test/std/time/time.syn/formatter.file_time.pass.cpp
libcxx/test/std/time/time.syn/formatter.sys_time.pass.cpp
Removed:
################################################################################
diff --git a/libcxx/test/std/time/time.syn/formatter.file_time.pass.cpp b/libcxx/test/std/time/time.syn/formatter.file_time.pass.cpp
index 952b9803d82e62..bde40239c6bc58 100644
--- a/libcxx/test/std/time/time.syn/formatter.file_time.pass.cpp
+++ b/libcxx/test/std/time/time.syn/formatter.file_time.pass.cpp
@@ -861,7 +861,9 @@ static void test_valid_values_time_zone() {
// 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
diff erent
+// 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 @@ static void test_valid_values_time_zone() {
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
diff erent 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 @@ static void test_valid_values_time_zone() {
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>
diff --git a/libcxx/test/std/time/time.syn/formatter.sys_time.pass.cpp b/libcxx/test/std/time/time.syn/formatter.sys_time.pass.cpp
index 782facd2f2c4f7..d8626102edb66b 100644
--- a/libcxx/test/std/time/time.syn/formatter.sys_time.pass.cpp
+++ b/libcxx/test/std/time/time.syn/formatter.sys_time.pass.cpp
@@ -859,7 +859,9 @@ static void test_valid_values_time_zone() {
// 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
diff erent
+// 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 @@ static void test_valid_values_time_zone() {
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
diff erent 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 @@ static void test_valid_values_time_zone() {
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>
More information about the libcxx-commits
mailing list