From 17219b8f39f7cd33472c94214010b603322bd0fa Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sun, 31 Mar 2024 17:27:04 +0200 Subject: [PATCH] test: use newer ASSERT_MEM_EQ macro (#4346) Should hopefully make it easier to debug CI flakiness because currently the test sometimes fails without a clear indication why. Refs: https://github.com/libuv/libuv/issues/4106 --- test/test-fs-event.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/test-fs-event.c b/test/test-fs-event.c index 0ef51180..8008cff4 100644 --- a/test/test-fs-event.c +++ b/test/test-fs-event.c @@ -197,12 +197,13 @@ static void fs_event_cb_dir_multi_file(uv_fs_event_t* handle, ASSERT_PTR_EQ(handle, &fs_event); ASSERT_OK(status); ASSERT(events == UV_CHANGE || events == UV_RENAME); - #if defined(__APPLE__) || defined(_WIN32) || defined(__linux__) - ASSERT_OK(strncmp(filename, file_prefix, sizeof(file_prefix) - 1)); - #else - ASSERT_NE(filename == NULL || - strncmp(filename, file_prefix, sizeof(file_prefix) - 1) == 0, 0); - #endif +#if defined(__APPLE__) || defined(_WIN32) || defined(__linux__) + ASSERT_NOT_NULL(filename); + ASSERT_MEM_EQ(filename, file_prefix, sizeof(file_prefix) - 1); +#else + if (filename != NULL) + ASSERT_MEM_EQ(filename, file_prefix, sizeof(file_prefix) - 1); +#endif if (fs_event_created + fs_event_removed == fs_event_file_count) { /* Once we've processed all create events, delete all files */