summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-12-22 22:39:35 +0100
committerThomas Haller <thaller@redhat.com>2020-12-23 10:48:18 +0100
commit3a2b4ffd0ab344736c9c3674b816e7102cc7a578 (patch)
treee6b3889a2013ae2ab6093f3862eb06956daf6122
parentca8162cb41ee4591f8f36e9b12bb3e60997787a7 (diff)
downloadNetworkManager-3a2b4ffd0ab344736c9c3674b816e7102cc7a578.tar.gz
core/tests: skip test for nm_wildcard_match_check() on non-glibc
It seems musl's fnmatch() does not support ranges and fails the test. Skip it. Seen on musl-1.1.24-r10.
-rw-r--r--src/tests/test-core.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/tests/test-core.c b/src/tests/test-core.c
index 39c5ad46d2..b2b6612c3c 100644
--- a/src/tests/test-core.c
+++ b/src/tests/test-core.c
@@ -980,10 +980,11 @@ test_connection_match_ip6_routes(void)
g_assert(matched == copy);
}
-#define do_test_wildcard_match(str, result, ...) \
- g_assert( \
- nm_wildcard_match_check(str, (const char *const[]){__VA_ARGS__}, NM_NARG(__VA_ARGS__)) \
- == result);
+#define do_test_wildcard_match_eval(str, ...) \
+ nm_wildcard_match_check(str, (const char *const[]){__VA_ARGS__}, NM_NARG(__VA_ARGS__))
+
+#define do_test_wildcard_match(str, result, ...) \
+ g_assert(do_test_wildcard_match_eval(str, __VA_ARGS__) == result)
static void
test_wildcard_match(void)
@@ -1056,7 +1057,14 @@ test_wildcard_match(void)
do_test_wildcard_match("name3", TRUE, "name[123]");
do_test_wildcard_match("name4", FALSE, "name[123]");
- do_test_wildcard_match("[a]", TRUE, "\\[a\\]");
+ if (do_test_wildcard_match_eval("[a]", "\\[a\\]") != TRUE) {
+#if defined(__GLIBC__)
+ do_test_wildcard_match("[a]", TRUE, "\\[a\\]");
+ g_assert_not_reached();
+#endif
+ /* It seems musl's fnmatch() does not like such ranges. */
+ g_test_skip("libc does not support ranges with fnmatch()!!");
+ }
do_test_wildcard_match("aa", FALSE, "!a*");
do_test_wildcard_match("aa", FALSE, "&!a*");