From 68eda515cb710bb4e0bacd22f7be59f2d98a2d1a Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 22 May 2023 13:03:43 +0200 Subject: [PATCH] platform/tests: check errno on failure to umount() in test_netns_bind_to_path() The umount() call failed in a test. Rework the assertion, so we might see the errno of the problem. (cherry picked from commit 1a0fa8539737c784f17a5639e67a87a8636aa23b) (cherry picked from commit c66ae9341558e2e6cfa6a0beda3e0b0b0faf5af6) (cherry picked from commit edf23f434e36a32a93eee4e6c497336ff1b2c694) (cherry picked from commit 01134c6fe89035e8c24d8ebbe0b09a7040b38ee7) (cherry picked from commit 526f701bcc1588ea14fcf6d5ac87db4cbe8370dc) --- src/core/platform/tests/test-link.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/core/platform/tests/test-link.c b/src/core/platform/tests/test-link.c index 24e3fd999d..408762f68e 100644 --- a/src/core/platform/tests/test-link.c +++ b/src/core/platform/tests/test-link.c @@ -3207,9 +3207,11 @@ test_netns_bind_to_path(gpointer fixture, gconstpointer test_data) gs_unref_object NMPlatform *platform_1 = NULL; gs_unref_object NMPlatform *platform_2 = NULL; nm_auto_pop_netns NMPNetns *netns_pop = NULL; - NMPlatform * platforms[3]; - NMPNetns * netns; + NMPlatform *platforms[3]; + NMPNetns *netns; + int errsv; int i; + int r; if (_test_netns_check_skip()) return; @@ -3252,7 +3254,12 @@ test_netns_bind_to_path(gpointer fixture, gconstpointer test_data) !=, 0); - g_assert_cmpint(umount(P_VAR_RUN), ==, 0); + r = umount(P_VAR_RUN); + if (r != 0) { + errsv = errno; + g_assert_cmpint(errsv, ==, 0); + g_assert_cmpint(r, ==, 0); + } } /*****************************************************************************/