summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-10-07 09:08:57 +0200
committerThomas Haller <thaller@redhat.com>2020-10-07 09:10:09 +0200
commit6cf7c6739f670bb8ae2e1b8cbc56c789a0b0ae0d (patch)
treee16a508c87f2f2266fb22f8a3c471eb4660dd408
parent3576f541003106fb4ba7b41138a57f8e4a6e7d18 (diff)
downloadNetworkManager-6cf7c6739f670bb8ae2e1b8cbc56c789a0b0ae0d.tar.gz
platform/tests: skip test_platform_ip_address_pretty_sort_cmp() on non-amd64 archs
The test only works on amd64, because it relies on the memory layout of the structures. https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/546
-rw-r--r--src/platform/tests/test-platform-general.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/platform/tests/test-platform-general.c b/src/platform/tests/test-platform-general.c
index ee1e247753..703c886e31 100644
--- a/src/platform/tests/test-platform-general.c
+++ b/src/platform/tests/test-platform-general.c
@@ -555,6 +555,20 @@ test_platform_ip_address_pretty_sort_cmp(gconstpointer test_data)
gs_free guint64 *rand_map = NULL;
gsize i, j;
+#if !defined(__amd64__)
+ /* The test generates a random array of NMPlatformIPXAddress (by crudely randomizing the memory,
+ * not the structures themself) and then compares the sorted result with the expected output.
+ * The sole purpose is to ensure that the sorting order stays stable.
+ *
+ * This only works on an architecture for which the test was made, otherwise
+ * the expected data does not match (due to different layout of the structures
+ * in memory).
+ *
+ * That's fine. Skip the test. */
+ g_test_skip("skip test on non-amd64 architecture");
+ return;
+#endif
+
/*
* First we create a list of addresses filled with (stable) random bytes.
* We tweak some fields explicitly (stable randomly), so that we cover all