From 7604a0f0816488568baad83d24daf57dad18afcd Mon Sep 17 00:00:00 2001
From: Ludovico de Nittis <ludovico.denittis@collabora.com>
Date: Thu, 21 Jan 2021 15:57:35 +0100
Subject: [PATCH] utils: Find prefix if called from statically-linked
 installed-test

Without this knowledge, `_srt_find_myself()` will fail to return the
right prefix for statically-linked installed tests.

Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
---
 steam-runtime-tools/utils.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/steam-runtime-tools/utils.c b/steam-runtime-tools/utils.c
index 8aa493543..e25a39a8b 100644
--- a/steam-runtime-tools/utils.c
+++ b/steam-runtime-tools/utils.c
@@ -156,6 +156,8 @@ _srt_check_not_setuid (void)
   MULTIARCH_LIBDIR "/steam-runtime-tools-" _SRT_API_MAJOR
 #define PKGLIBEXECDIR \
   "/libexec/steam-runtime-tools-" _SRT_API_MAJOR
+#define INSTALLED_TESTS_PKGLIBEXECDIR \
+  "/libexec/installed-tests/steam-runtime-tools-" _SRT_API_MAJOR
 
 /**
  * _srt_process_timeout_wait_status:
@@ -263,6 +265,8 @@ _srt_find_myself (const char **helpers_path_out,
     dir[strlen (dir) - strlen (MULTIARCH_LIBDIR)] = '\0';
   else if (g_str_has_suffix (dir, PKGLIBEXECDIR))
     dir[strlen (dir) - strlen (PKGLIBEXECDIR)] = '\0';
+  else if (g_str_has_suffix (dir, INSTALLED_TESTS_PKGLIBEXECDIR))
+    dir[strlen (dir) - strlen (INSTALLED_TESTS_PKGLIBEXECDIR)] = '\0';
   else if (g_str_has_suffix (dir, "/libexec"))
     dir[strlen (dir) - strlen ("/libexec")] = '\0';
   else if (g_str_has_suffix (dir, "/lib64"))
-- 
GitLab