From bf4de6c4f81320ed6144ba8f40b3271c1d60c6b6 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Tue, 16 Jun 2020 13:21:00 +0100
Subject: [PATCH] tests: Assert that ld.so gets overwritten

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

diff --git a/tests/containers.py b/tests/containers.py
index affa1af12..49bb3ecba 100755
--- a/tests/containers.py
+++ b/tests/containers.py
@@ -791,6 +791,28 @@ class TestContainers(BaseTest):
                 target = os.readlink(link)
                 self.assertEqual(target, '/run/host/usr/bin/localedef')
 
+            for ldso, scout_impl in (
+                (
+                    '/lib/ld-linux.so.2',
+                    '/lib/i386-linux-gnu/ld-2.15.so',
+                ),
+                (
+                    '/lib64/ld-linux-x86-64.so.2',
+                    '/lib/x86_64-linux-gnu/ld-2.15.so',
+                ),
+            ):
+                try:
+                    host_path = os.path.realpath(ldso)
+                except OSError:
+                    pass
+                else:
+                    link = os.path.join(tree, './' + ldso)
+                    target = os.readlink(link)
+                    self.assertEqual(target, '/run/host' + host_path)
+                    link = os.path.join(tree, './' + scout_impl)
+                    target = os.readlink(link)
+                    self.assertEqual(target, '/run/host' + host_path)
+
     def test_scout_sysroot(self) -> None:
         scout = os.path.join(self.containers_dir, 'scout_sysroot')
 
-- 
GitLab