modem-helpers-cinterion: allow spaces in ^SXRAT test response

^SXRAT: (0-6), (0,2,3), (0,2,3)

Fixes: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/974

Signed-off-by: Dan Williams <dan@ioncontrol.co>
(cherry picked from commit 6b6997362b)
This commit is contained in:
Dan Williams
2025-05-08 16:07:33 -05:00
parent 018e440848
commit 240a9145ad
2 changed files with 34 additions and 1 deletions
@@ -794,7 +794,7 @@ mm_cinterion_parse_sxrat_test (const gchar *response,
return FALSE;
}
r = g_regex_new ("\\^SXRAT:\\s*\\(([^\\)]*)\\),\\(([^\\)]*)\\)(,\\(([^\\)]*)\\))?(?:\\r\\n)?",
r = g_regex_new ("\\^SXRAT:\\s*\\(([^\\)]*)\\),\\s*\\(([^\\)]*)\\)(,\\s*\\(([^\\)]*)\\))?(?:\\r\\n)?",
G_REGEX_DOLLAR_ENDONLY | G_REGEX_RAW,
0, NULL);
@@ -1826,6 +1826,38 @@ test_sxrat_response_els61 (void)
g_array_unref (expected_pref2);
}
static void
test_sxrat_response_pls63_w (void)
{
GArray *expected_rat;
GArray *expected_pref1;
GArray *expected_pref2;
const guint vals[] = { 0, 2, 3 };
guint val;
const gchar *response =
"^SXRAT: (0-6), (0,2,3), (0,2,3)\r\n"
"\r\n";
expected_rat = g_array_sized_new (FALSE, FALSE, sizeof (guint), 7);
for (val = 0; val < 7; val++)
g_array_append_val (expected_rat, val);
expected_pref1 = g_array_sized_new (FALSE, FALSE, sizeof (guint), 3);
g_array_append_vals (expected_pref1, &vals, 3);
expected_pref2 = g_array_sized_new (FALSE, FALSE, sizeof (guint), 3);
g_array_append_vals (expected_pref2, &vals, 3);
common_test_sxrat (response,
expected_rat,
expected_pref1,
expected_pref2);
g_array_unref (expected_rat);
g_array_unref (expected_pref1);
g_array_unref (expected_pref2);
}
static void
test_sxrat_response_other (void)
{
@@ -2177,6 +2209,7 @@ int main (int argc, char **argv)
g_test_add_func ("/MM/cinterion/sgauth", test_sgauth_response);
g_test_add_func ("/MM/cinterion/sxrat", test_sxrat);
g_test_add_func ("/MM/cinterion/sxrat/response/els61", test_sxrat_response_els61);
g_test_add_func ("/MM/cinterion/sxrat/response/pls63w", test_sxrat_response_pls63_w);
g_test_add_func ("/MM/cinterion/sxrat/response/other", test_sxrat_response_other);
g_test_add_func ("/MM/cinterion/cops/only-mode-2g", test_cops_only_mode_2g);
g_test_add_func ("/MM/cinterion/cops/only-mode-3g", test_cops_only_mode_3g);