PKGBUILDs/extra/meson/0003-tests-Fix-unit-tests-with-high-parallelism.patch
2024-03-14 04:02:45 +00:00

56 lines
2.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
Date: Tue, 5 Mar 2024 19:33:33 +0100
Subject: [PATCH] tests: Fix unit tests with high parallelism
On Arch's shiny new 48-core/96-thread build server, the
`test_install_log_content` test fails because of an unexpected
`invalid-symlink.txt` file. Apparently the test runs in parallel with
`test_install_subdir_symlinks`, which modifies the `59 install subdir`
source directory.
To fix this, make `install_subdir_invalid_symlinks` copy the entire test
into a tmpdir before modifying it.
---
unittests/linuxliketests.py | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/unittests/linuxliketests.py b/unittests/linuxliketests.py
index f66dc9769a8f..ce4d36fe024c 100644
--- a/unittests/linuxliketests.py
+++ b/unittests/linuxliketests.py
@@ -1413,25 +1413,22 @@ class LinuxlikeTests(BasePlatformTests):
Test that installation of broken symlinks works fine.
https://github.com/mesonbuild/meson/issues/3914
'''
- testdir = os.path.join(self.common_test_dir, testdir)
+ testdir = self.copy_srcdir(os.path.join(self.common_test_dir, testdir))
subdir = os.path.join(testdir, subdir_path)
with chdir(subdir):
# Can't distribute broken symlinks in the source tree because it breaks
# the creation of zipapps. Create it dynamically and run the test by
# hand.
src = '../../nonexistent.txt'
os.symlink(src, 'invalid-symlink.txt')
- try:
- self.init(testdir)
- self.build()
- self.install()
- install_path = subdir_path.split(os.path.sep)[-1]
- link = os.path.join(self.installdir, 'usr', 'share', install_path, 'invalid-symlink.txt')
- self.assertTrue(os.path.islink(link), msg=link)
- self.assertEqual(src, os.readlink(link))
- self.assertFalse(os.path.isfile(link), msg=link)
- finally:
- os.remove(os.path.join(subdir, 'invalid-symlink.txt'))
+ self.init(testdir)
+ self.build()
+ self.install()
+ install_path = subdir_path.split(os.path.sep)[-1]
+ link = os.path.join(self.installdir, 'usr', 'share', install_path, 'invalid-symlink.txt')
+ self.assertTrue(os.path.islink(link), msg=link)
+ self.assertEqual(src, os.readlink(link))
+ self.assertFalse(os.path.isfile(link), msg=link)
def test_install_subdir_symlinks(self):
self.install_subdir_invalid_symlinks('59 install subdir', os.path.join('sub', 'sub1'))