openxray: 2188-november-2023-rc1 -> 2921-january-2025-rc1 (#375925)
[NixPkgs.git] / pkgs / by-name / li / libgudev / tests-skip-double-test-on-stub-locale-impls.patch
blob277670aeed2b70dc9149d2fd83756aad06ccae8d
1 From ad8b10870ee2092268f87144d8e5ab7db2011139 Mon Sep 17 00:00:00 2001
2 From: Alyssa Ross <hi@alyssa.is>
3 Date: Tue, 30 Jan 2024 20:47:21 +0100
4 Subject: [PATCH] tests: Skip double test on stub locale impls
6 On musl, setlocale() with an unknown locale name will succeed, but
7 treat the requested locale as if it were C.UTF-8. Therefore, to
8 properly check whether the locale is supported, we need to actually
9 verify whether it works the way we expect when deciding whether to
10 skip the test.
11 ---
12 tests/test-double.c | 6 ++++--
13 1 file changed, 4 insertions(+), 2 deletions(-)
15 diff --git a/tests/test-double.c b/tests/test-double.c
16 index 91e77c9..e9d9232 100644
17 --- a/tests/test-double.c
18 +++ b/tests/test-double.c
19 @@ -39,8 +39,6 @@ fixture_teardown (Fixture *f, G_GNUC_UNUSED const void *data)
20 static void
21 test_double (Fixture *f, G_GNUC_UNUSED const void *data)
23 - g_assert_cmpstr (nl_langinfo(RADIXCHAR), ==, ",");
25 umockdev_testbed_add_device (f->testbed, "platform", "dev1", NULL,
26 "in_accel_scale", "0.0000098", NULL,
27 "ID_MODEL", "KoolGadget", "SCALE", "0.0000098", NULL);
28 @@ -73,6 +71,10 @@ int main(int argc, char **argv)
29 if (setlocale (LC_NUMERIC, "fr_FR.UTF-8") == NULL)
30 return GNU_SKIP_RETURNCODE;
32 + /* Skip if locale doesn't work how we expect. */
33 + if (strcmp (nl_langinfo(RADIXCHAR), ","))
34 + return GNU_SKIP_RETURNCODE;
36 g_test_init (&argc, &argv, NULL);
38 g_test_add ("/gudev/double", Fixture, NULL,
39 --
40 GitLab