From 1fd7f9f61f1cde0c5fbdfd33b81d5a1939ed78ff Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Tue, 21 Jan 2025 16:13:32 +0000
Subject: [PATCH] container-runtime: Don't fail testing if libgbm.so.1 is
 incomplete

We currently use Debian 10 and Steam Runtime 2 to smoke-test runtimes,
but those have an older version of libgbm.so.1 than the one that will
"naturally" be assumed by `steamwebhelper` when compiled on
Steam Runtime 3 'sniper'.

We unconditionally take libgbm.so.1 from the host system because it must
be kept in lockstep with the rest of Mesa, so any time we are checking
the ABI of libgbm.so.1 in detail, we will need to be prepared to ignore
certain missing symbols. In practice, `steamwebhelper` does not use this
specific symbol, so it's OK.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 .../tests/depot/pressure-vessel.py            | 51 ++++++++++++-------
 1 file changed, 33 insertions(+), 18 deletions(-)

diff --git a/subprojects/container-runtime/tests/depot/pressure-vessel.py b/subprojects/container-runtime/tests/depot/pressure-vessel.py
index ade0e8868..6d5342077 100755
--- a/subprojects/container-runtime/tests/depot/pressure-vessel.py
+++ b/subprojects/container-runtime/tests/depot/pressure-vessel.py
@@ -560,19 +560,7 @@ class TestPressureVessel(unittest.TestCase):
 
             self.assertIn(multiarch, parsed['architectures'])
             arch_info = parsed['architectures'][multiarch]
-
-            with self.catch(
-                'per-architecture information',
-                diagnostic=arch_info,
-                arch=arch,
-            ):
-                self.assertTrue(arch_info['can-run'])
-                self.assertEqual([], arch_info['library-issues-summary'])
-                # Graphics driver support depends on the host system, so we
-                # don't assert that everything is fine, only that we have
-                # the information.
-                self.assertIn('graphics-details', arch_info)
-                self.assertIn('glx/gl', arch_info['graphics-details'])
+            library_issues = set()
 
             for soname, details in arch_info['library-details'].items():
                 with self.catch(
@@ -582,15 +570,42 @@ class TestPressureVessel(unittest.TestCase):
                     soname=soname,
                 ):
                     self.assertIn('path', details)
-                    self.assertEqual(
-                        [],
-                        details.get('missing-symbols', []),
-                    )
+                    missing_symbols = details.get('missing-symbols', [])
+                    issues = details.get('issues', [])
+
+                    if soname == 'libgbm.so.1':
+                        # We still test on Steam Runtime 2 and Debian 10,
+                        # which have a sufficiently old Mesa version that
+                        # they do not have all the symbols we expect to find
+                        # in libgbm.so.1.
+                        library_issues |= set(issues)
+                        issues = list(set(issues) - set(['missing-symbols']))
+                        missing_symbols = list(
+                            set(missing_symbols) - set(['gbm_format_get_name'])
+                        )
+
+                    self.assertEqual([], missing_symbols)
                     self.assertEqual(
                         [],
                         details.get('misversioned-symbols', []),
                     )
-                    self.assertEqual([], details.get('issues', []))
+                    self.assertEqual([], issues)
+
+            with self.catch(
+                'per-architecture information',
+                diagnostic=arch_info,
+                arch=arch,
+            ):
+                self.assertTrue(arch_info['can-run'])
+                self.assertEqual(
+                    library_issues,
+                    set(arch_info['library-issues-summary']),
+                )
+                # Graphics driver support depends on the host system, so we
+                # don't assert that everything is fine, only that we have
+                # the information.
+                self.assertIn('graphics-details', arch_info)
+                self.assertIn('glx/gl', arch_info['graphics-details'])
 
         # Locale support depends on the host system, so we don't assert
         # that everything is fine, only that we have the information.
-- 
GitLab