Skip to content

Commit

Permalink
tests: Fix unit tests with high parallelism
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
heftig authored and dcbaker committed Mar 15, 2024
1 parent 6db1d2b commit 05bbe45
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions unittests/linuxliketests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1411,25 +1411,22 @@ def install_subdir_invalid_symlinks(self, testdir, subdir_path):
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'))
Expand Down

0 comments on commit 05bbe45

Please sign in to comment.