aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorFilipe Brandenburger <filbranden@google.com>2018-04-25 00:15:26 -0700
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2018-06-02 04:50:32 +0000
commit04c39ad56226815f06c7464dc757b20a89e4442b (patch)
tree79d619bce905d29b8fe575d26e848a64f114d4e9 /run_unittests.py
parent862e1dd838fc2c81af9b77c6e20d5043172b9538 (diff)
downloadmeson-04c39ad56226815f06c7464dc757b20a89e4442b.zip
meson-04c39ad56226815f06c7464dc757b20a89e4442b.tar.gz
meson-04c39ad56226815f06c7464dc757b20a89e4442b.tar.bz2
Add extended unit test for 'install_mode'
This new unit test will use the targets in '198 install_mode' and confirm that every file and directory gets the expected mode, ensuring that the setting is properly applied at install time.
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py
index 061e40e..b599a5f 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -2787,6 +2787,39 @@ class LinuxlikeTests(BasePlatformTests):
# The chown failed nonfatally if we're not root
self.assertEqual(0, statf.st_uid)
+ def test_installed_modes_extended(self):
+ '''
+ Test that files are installed with correct permissions using install_mode.
+ '''
+ testdir = os.path.join(self.common_test_dir, '201 install_mode')
+ self.init(testdir)
+ self.build()
+ self.install()
+
+ for fsobj, want_mode in [
+ ('bin', 'drwxr-x---'),
+ ('bin/runscript.sh', '-rwxr-sr-x'),
+ ('bin/trivialprog', '-rwxr-sr-x'),
+ ('include', 'drwxr-x---'),
+ ('include/config.h', '-rw-rwSr--'),
+ ('include/rootdir.h', '-r--r--r-T'),
+ ('lib', 'drwxr-x---'),
+ ('lib/libstat.a', '-rw---Sr--'),
+ ('share', 'drwxr-x---'),
+ ('share/man', 'drwxr-x---'),
+ ('share/man/man1', 'drwxr-x---'),
+ ('share/man/man1/foo.1.gz', '-r--r--r-T'),
+ ('share/sub1', 'drwxr-x---'),
+ ('share/sub1/second.dat', '-rwxr-x--t'),
+ ('subdir', 'drwxr-x---'),
+ ('subdir/data.dat', '-rw-rwSr--'),
+ ]:
+ f = os.path.join(self.installdir, 'usr', *fsobj.split('/'))
+ found_mode = stat.filemode(os.stat(f).st_mode)
+ self.assertEqual(want_mode, found_mode,
+ msg=('Expected file %s to have mode %s but found %s instead.' %
+ (fsobj, want_mode, found_mode)))
+
def test_install_umask(self):
'''
Test that files are installed with correct permissions using default