unittests: test_install_subdir_symlinks_with_default_umask

Add test to verify the installation of broken symlinks when a default_umask
is set.

Reusing the same code of other test, thus sharing the actual test code
in a single function.
pull/4030/head
Marco Trevisan (Treviño) 6 years ago
parent b400cbe058
commit 9f87d5d955
  1. 22
      run_unittests.py
  2. 1
      test cases/common/199 install_mode/installed_files.txt
  3. 3
      test cases/common/199 install_mode/meson.build
  4. 0
      test cases/common/199 install_mode/sub2/stub

@ -3779,32 +3779,42 @@ endian = 'little'
# Ensure that the otool output does not contain self.installdir
self.assertNotRegex(out, self.installdir + '.*dylib ')
def test_install_subdir_symlinks(self):
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, '66 install subdir')
subdir = os.path.join(testdir, 'sub/sub1')
testdir = os.path.join(self.common_test_dir, testdir)
subdir = os.path.join(testdir, subdir_path)
curdir = os.getcwd()
os.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, 'test.txt')
os.symlink(src, 'invalid-symlink.txt')
try:
self.init(testdir)
self.build()
self.install()
link = os.path.join(self.installdir, 'usr', 'share', 'sub1', 'test.txt')
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, 'test.txt'))
os.remove(os.path.join(subdir, 'invalid-symlink.txt'))
os.chdir(curdir)
def test_install_subdir_symlinks(self):
self.install_subdir_invalid_symlinks('66 install subdir', os.path.join('sub', 'sub1'))
def test_install_subdir_symlinks_with_default_umask(self):
self.install_subdir_invalid_symlinks('199 install_mode', 'sub2')
def test_install_subdir_symlinks_with_default_umask_and_mode(self):
self.install_subdir_invalid_symlinks('199 install_mode', 'sub1')
class LinuxCrossArmTests(BasePlatformTests):
'''

@ -5,4 +5,5 @@ usr/include/rootdir.h
usr/libtest/libstat.a
usr/share/man/man1/foo.1.gz
usr/share/sub1/second.dat
usr/share/sub2/stub
usr/subdir/data.dat

@ -11,6 +11,9 @@ install_subdir('sub1',
install_dir : 'share',
install_mode : ['rwxr-x--t', 'root'])
install_subdir('sub2',
install_dir : 'share')
# test install_mode in configure_file
conf = configuration_data()
conf.set('var', 'mystring')

Loading…
Cancel
Save