From 0605ce04ab2459381c7d73b30ba434015704a7e1 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Mon, 15 Jun 2020 15:12:28 +0100
Subject: [PATCH] containers test: Assert that scout gets host libc-related
 files

For gconv we only make the assertion for a Debian host for now,
because non-Debian hosts put their gconv libraries in different places.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 tests/containers.py | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/tests/containers.py b/tests/containers.py
index 45fd64ad2..1bed1c313 100755
--- a/tests/containers.py
+++ b/tests/containers.py
@@ -595,7 +595,7 @@ class TestContainers(BaseTest):
                         link = os.path.join(libdir, 'dri', k)
                         target = os.readlink(link)
                         self.assertEqual(target[:10], '/run/host/')
-                        target = target[10:]
+                        target = target[9:]     # includes the / after host/
 
                         # Again, take the realpath() on non-Debian-derived
                         # hosts, but be more strict on Debian.
@@ -605,6 +605,33 @@ class TestContainers(BaseTest):
 
                         self.assertIn(target, vs)
 
+                if is_scout:
+                    if self.host_is_debian_derived:
+                        link = os.path.join(
+                            tree, 'usr', 'lib', multiarch, 'gconv',
+                        )
+                        target = os.readlink(link)
+                        self.assertEqual(
+                            target,
+                            '/run/host/usr/lib/{}/gconv'.format(multiarch),
+                        )
+
+        if is_scout:
+            if os.path.isdir('/usr/lib/locale'):
+                link = os.path.join(tree, 'usr', 'lib', 'locale')
+                target = os.readlink(link)
+                self.assertEqual(target, '/run/host/usr/lib/locale')
+
+            if os.path.isdir('/usr/share/i18n'):
+                link = os.path.join(tree, 'usr', 'share', 'i18n')
+                target = os.readlink(link)
+                self.assertEqual(target, '/run/host/usr/share/i18n')
+
+            link = os.path.join(tree, 'sbin', 'ldconfig')
+            target = os.readlink(link)
+            # Might not be /sbin/ldconfig, for example on non-Debian hosts
+            self.assertRegex(target, r'^/run/host/')
+
     def test_scout_sysroot(self) -> None:
         scout = os.path.join(self.containers_dir, 'scout_sysroot')
 
-- 
GitLab