mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-08 22:45:43 +00:00
68 lines
3.3 KiB
Diff
68 lines
3.3 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 | 39 +++++++++++++++++++------------------
|
||
|
1 file changed, 20 insertions(+), 19 deletions(-)
|
||
|
|
||
|
diff --git a/unittests/linuxliketests.py b/unittests/linuxliketests.py
|
||
|
index f66dc9769a8f..c8dc0195bc72 100644
|
||
|
--- a/unittests/linuxliketests.py
|
||
|
+++ b/unittests/linuxliketests.py
|
||
|
@@ -1413,25 +1413,26 @@ 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)
|
||
|
- 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'))
|
||
|
+ # We can't distribute broken symlinks in the source tree because it
|
||
|
+ # breaks the creation of zipapps. Create the symlink dynamically and run
|
||
|
+ # the test by hand. Do this in a tmpdir in order to not tread on
|
||
|
+ # parallel tests' toes.
|
||
|
+ with tempfile.TemporaryDirectory() as tmpdir:
|
||
|
+ orig_testdir = os.path.join(self.common_test_dir, testdir)
|
||
|
+ tmp_testdir = os.path.join(tmpdir, testdir.split(os.path.sep)[-1])
|
||
|
+ shutil.copytree(orig_testdir, tmp_testdir)
|
||
|
+ src = '../nonexistent.txt'
|
||
|
+ dst = 'invalid-symlink.txt'
|
||
|
+ subdir = os.path.join(tmp_testdir, subdir_path)
|
||
|
+ os.symlink(src, os.path.join(subdir, dst))
|
||
|
+ self.init(tmp_testdir)
|
||
|
+ self.build()
|
||
|
+ self.install()
|
||
|
+ install_path = subdir_path.split(os.path.sep)[-1]
|
||
|
+ link = os.path.join(self.installdir, 'usr', 'share', install_path, dst)
|
||
|
+ 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'))
|