From d33604f369acae03924e18efc5b913a8cd3dc063 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Fri, 31 Jan 2025 14:45:17 +0000
Subject: [PATCH] pv-wrap: Use a more realistic multiarch tuple for unit tests

All of our supported architectures define _SRT_MULTIARCH from the build
system, and pressure-vessel can't be compiled for other architectures
without defining _SRT_MULTIARCH, so we don't need to override this
to a mock string; we can leave it set to the real multiarch tuple of the
architecture.

This avoids setting up inconsistencies between this code path, and other
parts of pressure-vessel that do not force a mock architecture.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 pressure-vessel/wrap-setup.c       | 1 -
 tests/pressure-vessel/wrap-setup.c | 6 ++----
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/pressure-vessel/wrap-setup.c b/pressure-vessel/wrap-setup.c
index 31bf7b83c..fbaef9c99 100644
--- a/pressure-vessel/wrap-setup.c
+++ b/pressure-vessel/wrap-setup.c
@@ -748,7 +748,6 @@ append_preload_per_architecture (GPtrArray *argv,
           /* As a mock ${PLATFORM}, use the first one listed. */
           platform = pv_multiarch_details[i].platforms[0];
 #else
-          multiarch_tuple = "mock-multiarch-tuple";
           platform = "mock";
 #endif
           /* As a mock ${LIB}, behave like Debian or the fdo SDK. */
diff --git a/tests/pressure-vessel/wrap-setup.c b/tests/pressure-vessel/wrap-setup.c
index 885cea99b..a550e05ae 100644
--- a/tests/pressure-vessel/wrap-setup.c
+++ b/tests/pressure-vessel/wrap-setup.c
@@ -43,8 +43,6 @@
 #include "wrap-setup.h"
 #include "utils.h"
 
-#define MOCK_ABI "mock-multiarch-tuple"
-
 /* These match the first entry in PvMultiArchdetails.platforms,
  * which is the easiest realistic thing for a mock implementation of
  * srt_system_info_check_library() to use. */
@@ -56,7 +54,7 @@
  * a mock implementation of srt_system_info_check_library() to use. */
 #define MOCK_LIB_32 "lib/" SRT_ABI_I386
 #define MOCK_LIB_64 "lib/" SRT_ABI_X86_64
-#define MOCK_LIB_GENERIC "lib/" MOCK_ABI
+#define MOCK_LIB_GENERIC "lib/" _SRT_MULTIARCH
 
 #if defined(__i386__) || defined(__x86_64__)
   /* On x86, we treat x86_64 as the primary architecture.
@@ -71,7 +69,7 @@
   /* On non-x86, the mock implementation of srt_system_info_check_library()
    * uses these expansions for ${PLATFORM} and ${LIB} instead of the
    * real ones. */
-# define PRIMARY_ABI MOCK_ABI
+# define PRIMARY_ABI _SRT_MULTIARCH
 # define PRIMARY_PLATFORM MOCK_PLATFORM_GENERIC
 # define PRIMARY_LIB MOCK_LIB_GENERIC
 #endif
-- 
GitLab