aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2020-12-10 13:50:31 -0800
committerDylan Baker <dylan@pnwbakers.com>2021-02-02 12:42:48 -0800
commitbffc94b08f713cc9916009575664b132aee76bcf (patch)
tree416e0f7e8686cb3f5c17093664e0691edec7904f /run_unittests.py
parentf31ffaaf1754e4578127049844c14eba6bdda477 (diff)
downloadmeson-bffc94b08f713cc9916009575664b132aee76bcf.zip
meson-bffc94b08f713cc9916009575664b132aee76bcf.tar.gz
meson-bffc94b08f713cc9916009575664b132aee76bcf.tar.bz2
compilers: Add support for using multiple threads with lto
Both Clang and GCC support using multiple threads for preforming link time optimizaions, and they can now be configured using the `-Db_lto_threads` option. Fixes #7820
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py
index 2a14f78..aff94c4 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -2843,6 +2843,27 @@ class AllPlatformTests(BasePlatformTests):
self.build()
self.run_tests()
+ @skip_if_not_base_option('b_lto_threads')
+ def test_lto_threads(self):
+ testdir = os.path.join(self.common_test_dir, '6 linkshared')
+
+ env = get_fake_env(testdir, self.builddir, self.prefix)
+ cc = env.detect_c_compiler(MachineChoice.HOST)
+ if cc.get_id() == 'clang' and is_windows():
+ raise unittest.SkipTest('LTO not (yet) supported by windows clang')
+
+ self.init(testdir, extra_args=['-Db_lto=true', '-Db_lto_threads=8'])
+ self.build()
+ self.run_tests()
+
+ expected = set(cc.get_lto_compile_args(threads=8))
+ targets = self.introspect('--targets')
+ # This assumes all of the targets support lto
+ for t in targets:
+ for s in t['target_sources']:
+ for e in expected:
+ self.assertIn(e, s['parameters'])
+
def test_dist_git(self):
if not shutil.which('git'):
raise unittest.SkipTest('Git not found')