ModemManager/backport-test-modem-helpers-add-EOL-to-strings-matched-with-G_REGEX_NEWLINE_CRLF.patch
eaglegai 0919e84475 fix test failure because of glib2 switching to pcre2
(cherry picked from commit 53972dc64be14758edaa1c18f10463af5fcf7d9d)
2022-11-12 16:08:33 +08:00

65 lines
2.3 KiB
Diff

From 68af7f28c0d3bb1088dc58b9e6408d9941c9614c Mon Sep 17 00:00:00 2001
From: Aleksander Morgado <aleksandermj@chromium.org>
Date: Fri, 2 Sep 2022 17:13:29 +0200
Subject: [PATCH] test-modem-helpers: add EOL to strings matched with
G_REGEX_NEWLINE_CRLF
Looks like pcre2 (used since glib 2.73.2) requires EOLs to match if
G_REGEX_NEWLINE_CRLF is explicitly used. The tests are updated
accordingly, because the modem responses will anyway have the EOLs
as well.
See https://gitlab.gnome.org/GNOME/glib/-/issues/2729#note_1544130
Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/601
(cherry picked from commit 51a333cd9a6707de7c623fd4c94cb6032477572f)
---
src/tests/test-modem-helpers.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/tests/test-modem-helpers.c b/src/tests/test-modem-helpers.c
index dc22fbde7..d8cef0816 100644
--- a/src/tests/test-modem-helpers.c
+++ b/src/tests/test-modem-helpers.c
@@ -4228,8 +4228,8 @@ typedef struct {
} TestCcwa;
static TestCcwa test_ccwa[] = {
- { "+CCWA: 0,255", FALSE, FALSE }, /* all disabled */
- { "+CCWA: 1,255", TRUE, FALSE }, /* all enabled */
+ { "+CCWA: 0,255\r\n", FALSE, FALSE }, /* all disabled */
+ { "+CCWA: 1,255\r\n", TRUE, FALSE }, /* all enabled */
{ "+CCWA: 0,1\r\n"
"+CCWA: 0,4\r\n", FALSE, FALSE }, /* voice and fax disabled */
{ "+CCWA: 1,1\r\n"
@@ -4304,7 +4304,7 @@ common_test_clcc_response (const gchar *str,
static void
test_clcc_response_empty (void)
{
- const gchar *response = "";
+ const gchar *response = "\r\n";
common_test_clcc_response (response, NULL, 0);
}
@@ -4317,7 +4317,7 @@ test_clcc_response_single (void)
};
const gchar *response =
- "+CLCC: 1,1,0,0,0,\"123456789\",161";
+ "+CLCC: 1,1,0,0,0,\"123456789\",161\r\n";
common_test_clcc_response (response, expected_call_info_list, G_N_ELEMENTS (expected_call_info_list));
}
@@ -4331,7 +4331,7 @@ test_clcc_response_single_long (void)
/* NOTE: priority field is EMPTY */
const gchar *response =
- "+CLCC: 1,1,4,0,0,\"123456789\",129,\"\",,0";
+ "+CLCC: 1,1,4,0,0,\"123456789\",129,\"\",,0\r\n";
common_test_clcc_response (response, expected_call_info_list, G_N_ELEMENTS (expected_call_info_list));
}
--
GitLab