summaryrefslogtreecommitdiff
path: root/.github/scripts/tests/test_armhf_sysroot_symlinks.py
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2026-09-26 23:24:28 +0200
committerChristoph Berg <myon@debian.org>2026-09-26 23:24:28 +0200
commit69344560ea394c06ca94acac46a2e4c3e8b7b229 (patch)
treeebc98370a697a9bbd6b973a14fa5113c475c6db7 /.github/scripts/tests/test_armhf_sysroot_symlinks.py
parent3e9d10a67671d0bd5c7b8c3ca8088f1818322eff (diff)
parent059831534c7e884f0a607ed86b582fd00d821731 (diff)
Update upstream source from tag 'upstream/3.2.0_rc1+dfsg'
Update to upstream version '3.2.0~rc1+dfsg' with Debian dir dbff457fd2c3616d5c77b863c7bfb2186ed86047
Diffstat (limited to '.github/scripts/tests/test_armhf_sysroot_symlinks.py')
-rw-r--r--.github/scripts/tests/test_armhf_sysroot_symlinks.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/.github/scripts/tests/test_armhf_sysroot_symlinks.py b/.github/scripts/tests/test_armhf_sysroot_symlinks.py
new file mode 100644
index 00000000..991971f6
--- /dev/null
+++ b/.github/scripts/tests/test_armhf_sysroot_symlinks.py
@@ -0,0 +1,42 @@
+import os
+import pathlib
+import subprocess
+import tempfile
+import unittest
+
+
+ROOT = pathlib.Path(__file__).resolve().parents[3]
+NORMALIZER = ROOT / ".github/scripts/normalize-armhf-sysroot-symlinks.sh"
+
+
+class ArmhfSysrootSymlinkTests(unittest.TestCase):
+ def test_absolute_links_are_rebased_inside_sysroot(self):
+ with tempfile.TemporaryDirectory() as temporary:
+ sysroot = pathlib.Path(temporary)
+ target = sysroot / "lib/arm-linux-gnueabihf/libm.so.6"
+ target.parent.mkdir(parents=True)
+ target.write_text("fixture\n", encoding="utf-8")
+ link = sysroot / "usr/lib/arm-linux-gnueabihf/libm.so"
+ link.parent.mkdir(parents=True)
+ link.symlink_to("/lib/arm-linux-gnueabihf/libm.so.6")
+
+ subprocess.run(["bash", str(NORMALIZER), str(sysroot)], check=True)
+
+ self.assertFalse(os.readlink(link).startswith("/"))
+ self.assertEqual(link.resolve(), target)
+
+ def test_relative_links_remain_unchanged(self):
+ with tempfile.TemporaryDirectory() as temporary:
+ sysroot = pathlib.Path(temporary)
+ directory = sysroot / "usr/lib"
+ directory.mkdir(parents=True)
+ link = directory / "libfixture.so"
+ link.symlink_to("libfixture.so.1")
+
+ subprocess.run(["bash", str(NORMALIZER), str(sysroot)], check=True)
+
+ self.assertEqual(os.readlink(link), "libfixture.so.1")
+
+
+if __name__ == "__main__":
+ unittest.main()