lol
1From ad8b10870ee2092268f87144d8e5ab7db2011139 Mon Sep 17 00:00:00 2001
2From: Alyssa Ross <hi@alyssa.is>
3Date: Tue, 30 Jan 2024 20:47:21 +0100
4Subject: [PATCH] tests: Skip double test on stub locale impls
5
6On musl, setlocale() with an unknown locale name will succeed, but
7treat the requested locale as if it were C.UTF-8. Therefore, to
8properly check whether the locale is supported, we need to actually
9verify whether it works the way we expect when deciding whether to
10skip the test.
11---
12 tests/test-double.c | 6 ++++--
13 1 file changed, 4 insertions(+), 2 deletions(-)
14
15diff --git a/tests/test-double.c b/tests/test-double.c
16index 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)
22 {
23- g_assert_cmpstr (nl_langinfo(RADIXCHAR), ==, ",");
24-
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;
31
32+ /* Skip if locale doesn't work how we expect. */
33+ if (strcmp (nl_langinfo(RADIXCHAR), ","))
34+ return GNU_SKIP_RETURNCODE;
35+
36 g_test_init (&argc, &argv, NULL);
37
38 g_test_add ("/gudev/double", Fixture, NULL,
39--
40GitLab
41