mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 13:09:50 +00:00
75215fbce6
Backport 3 patches [1][2][3] for gdatetime test to fix the ptest failure. [1] https://github.com/GNOME/glib/commit/c0619f08e6c608fd6464d2f0c6970ef0bbfb9ecf [2] https://github.com/GNOME/glib/commit/30e9cfa5733003cd1079e0e9e8a4bff1a191171a [3] https://github.com/GNOME/glib/commit/fe2699369f79981dcf913af4cfd98b342b84a9c1 (From OE-Core rev: aaeac4978111fa4051296cb800251432dc02226a) Signed-off-by: Jinfeng Wang <jinfeng.wang.cn@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 0c8f87d5d4ec9f286b1e85d114cb9a728c1ff64b) Signed-off-by: Steve Sakoman <steve@sakoman.com>
64 lines
2.3 KiB
Diff
64 lines
2.3 KiB
Diff
From df251923fb2c80cc7acfe99aaf8c98d7d7cbd29f Mon Sep 17 00:00:00 2001
|
|
From: Simon McVittie <smcv@debian.org>
|
|
Date: Fri, 18 Oct 2024 11:23:42 +0100
|
|
Subject: [PATCH 3/3] gdatetime test: Fall back if legacy System V PST8PDT is
|
|
not available
|
|
|
|
On recent versions of Debian, PST8PDT is part of the tzdata-legacy
|
|
package, which is not always installed and might disappear in future.
|
|
Successfully tested with and without tzdata-legacy on Debian unstable.
|
|
|
|
Signed-off-by: Simon McVittie <smcv@debian.org>
|
|
|
|
Upstream-Status: Backport
|
|
[https://github.com/GNOME/glib/commit/fe2699369f79981dcf913af4cfd98b342b84a9c1]
|
|
|
|
Signed-off-by: Jinfeng Wang <jinfeng.wang.cn@windriver.com>
|
|
---
|
|
glib/tests/gdatetime.c | 19 +++++++++++++++++--
|
|
1 file changed, 17 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/glib/tests/gdatetime.c b/glib/tests/gdatetime.c
|
|
index 728b87343..9e1acd097 100644
|
|
--- a/glib/tests/gdatetime.c
|
|
+++ b/glib/tests/gdatetime.c
|
|
@@ -2931,6 +2931,7 @@ test_posix_parse (void)
|
|
GTimeZone *tz;
|
|
GDateTime *gdt1, *gdt2;
|
|
gint i1, i2;
|
|
+ const char *expect_id;
|
|
|
|
/* Check that an unknown zone name falls back to UTC. */
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|
@@ -2953,11 +2954,25 @@ test_posix_parse (void)
|
|
g_time_zone_unref (tz);
|
|
|
|
/* This fails rules_from_identifier on Unix (though not on Windows)
|
|
- * but passes anyway because PST8PDT is a zone name.
|
|
+ * but can pass anyway because PST8PDT is a legacy System V zone name.
|
|
*/
|
|
tz = g_time_zone_new_identifier ("PST8PDT");
|
|
+ expect_id = "PST8PDT";
|
|
+
|
|
+#ifndef G_OS_WIN32
|
|
+ /* PST8PDT is in tzdata's "backward" set, packaged as tzdata-legacy and
|
|
+ * not always present in some OSs; fall back to the equivalent geographical
|
|
+ * name if the "backward" time zones are absent. */
|
|
+ if (tz == NULL)
|
|
+ {
|
|
+ g_test_message ("Legacy PST8PDT time zone not available, falling back");
|
|
+ tz = g_time_zone_new_identifier ("America/Los_Angeles");
|
|
+ expect_id = "America/Los_Angeles";
|
|
+ }
|
|
+#endif
|
|
+
|
|
g_assert_nonnull (tz);
|
|
- g_assert_cmpstr (g_time_zone_get_identifier (tz), ==, "PST8PDT");
|
|
+ g_assert_cmpstr (g_time_zone_get_identifier (tz), ==, expect_id);
|
|
/* a date in winter = non-DST */
|
|
gdt1 = g_date_time_new (tz, 2024, 1, 1, 0, 0, 0);
|
|
i1 = g_time_zone_find_interval (tz, G_TIME_TYPE_STANDARD, g_date_time_to_unix (gdt1));
|
|
--
|
|
2.34.1
|
|
|