Add unittest of prefix dependent default directories
Also, make BasePlatformTests.tearDown() tolerate wipe() already having been called, rather than AllPlatformTests.test_prefix_dependent_defaults() having to avoid wipe() on the final iteration.
This commit is contained in:
parent
24549dbed5
commit
3e0069f65e
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# Copyright 2016-2017 The Meson development team
|
# Copyright 2016-2017 The Meson development team
|
||||||
|
|
||||||
|
@ -490,7 +491,10 @@ class BasePlatformTests(unittest.TestCase):
|
||||||
print(f.read())
|
print(f.read())
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
windows_proof_rmtree(self.builddir)
|
try:
|
||||||
|
windows_proof_rmtree(self.builddir)
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
os.environ = self.orig_env
|
os.environ = self.orig_env
|
||||||
super().tearDown()
|
super().tearDown()
|
||||||
|
|
||||||
|
@ -739,6 +743,49 @@ class AllPlatformTests(BasePlatformTests):
|
||||||
self.init(testdir)
|
self.init(testdir)
|
||||||
self.assertRaises(subprocess.CalledProcessError, self.setconf, '-Dlibdir=/opt', False)
|
self.assertRaises(subprocess.CalledProcessError, self.setconf, '-Dlibdir=/opt', False)
|
||||||
|
|
||||||
|
def test_prefix_dependent_defaults(self):
|
||||||
|
'''
|
||||||
|
Tests that configured directory paths are set to prefix dependent
|
||||||
|
defaults.
|
||||||
|
'''
|
||||||
|
testdir = os.path.join(self.common_test_dir, '1 trivial')
|
||||||
|
expected = {
|
||||||
|
'/opt': {'prefix': '/opt',
|
||||||
|
'bindir': 'bin', 'datadir': 'share', 'includedir': 'include',
|
||||||
|
'infodir': 'share/info',
|
||||||
|
'libexecdir': 'libexec', 'localedir': 'share/locale',
|
||||||
|
'localstatedir': 'var', 'mandir': 'share/man',
|
||||||
|
'sbindir': 'sbin', 'sharedstatedir': 'com',
|
||||||
|
'sysconfdir': 'etc'},
|
||||||
|
'/usr': {'prefix': '/usr',
|
||||||
|
'bindir': 'bin', 'datadir': 'share', 'includedir': 'include',
|
||||||
|
'infodir': 'share/info',
|
||||||
|
'libexecdir': 'libexec', 'localedir': 'share/locale',
|
||||||
|
'localstatedir': '/var', 'mandir': 'share/man',
|
||||||
|
'sbindir': 'sbin', 'sharedstatedir': '/var/lib',
|
||||||
|
'sysconfdir': '/etc'},
|
||||||
|
'/usr/local': {'prefix': '/usr/local',
|
||||||
|
'bindir': 'bin', 'datadir': 'share',
|
||||||
|
'includedir': 'include', 'infodir': 'share/info',
|
||||||
|
'libexecdir': 'libexec',
|
||||||
|
'localedir': 'share/locale',
|
||||||
|
'localstatedir': '/var/local', 'mandir': 'share/man',
|
||||||
|
'sbindir': 'sbin', 'sharedstatedir': '/var/local/lib',
|
||||||
|
'sysconfdir': 'etc'},
|
||||||
|
# N.B. We don't check 'libdir' as it's platform dependent, see
|
||||||
|
# default_libdir():
|
||||||
|
}
|
||||||
|
for prefix in expected:
|
||||||
|
args = ['--prefix', prefix]
|
||||||
|
self.init(testdir, args, default_args=False)
|
||||||
|
opts = self.introspect('--buildoptions')
|
||||||
|
for opt in opts:
|
||||||
|
name = opt['name']
|
||||||
|
value = opt['value']
|
||||||
|
if name in expected[prefix]:
|
||||||
|
self.assertEqual(value, expected[prefix][name])
|
||||||
|
self.wipe()
|
||||||
|
|
||||||
def test_static_library_overwrite(self):
|
def test_static_library_overwrite(self):
|
||||||
'''
|
'''
|
||||||
Tests that static libraries are never appended to, always overwritten.
|
Tests that static libraries are never appended to, always overwritten.
|
||||||
|
|
Loading…
Reference in New Issue