aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/markdown/Builtin-options.md2
-rw-r--r--mesonbuild/backend/backends.py30
-rw-r--r--mesonbuild/backend/ninjabackend.py2
-rw-r--r--mesonbuild/mtest.py10
-rwxr-xr-xrun_unittests.py59
-rw-r--r--test cases/common/109 generatorcustom/meson.build4
6 files changed, 88 insertions, 19 deletions
diff --git a/docs/markdown/Builtin-options.md b/docs/markdown/Builtin-options.md
index 6234ecf..de801ab 100644
--- a/docs/markdown/Builtin-options.md
+++ b/docs/markdown/Builtin-options.md
@@ -17,7 +17,7 @@ by setting them inside `default_options` of `project()` in your `meson.build`.
For legacy reasons `--warnlevel` is the cli argument for the `warning_level` option.
-They can also be edited after setup using `meson configure`.
+They can also be edited after setup using `meson configure -Doption=value`.
Installation options are all relative to the prefix, except:
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index effd222..c84bb75 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -14,6 +14,7 @@
from collections import OrderedDict
from functools import lru_cache
+from pathlib import Path
import enum
import json
import os
@@ -455,10 +456,35 @@ class Backend:
args.extend(self.environment.coredata.get_external_link_args(target.for_machine, lang))
except Exception:
pass
+ # Match rpath formats:
+ # -Wl,-rpath=
+ # -Wl,-rpath,
+ rpath_regex = re.compile(r'-Wl,-rpath[=,]([^,]+)')
+ # Match solaris style compat runpath formats:
+ # -Wl,-R
+ # -Wl,-R,
+ runpath_regex = re.compile(r'-Wl,-R[,]?([^,]+)')
+ # Match symbols formats:
+ # -Wl,--just-symbols=
+ # -Wl,--just-symbols,
+ symbols_regex = re.compile(r'-Wl,--just-symbols[=,]([^,]+)')
for arg in args:
- if arg.startswith('-Wl,-rpath='):
- for dir in arg.replace('-Wl,-rpath=','').split(':'):
+ rpath_match = rpath_regex.match(arg)
+ if rpath_match:
+ for dir in rpath_match.group(1).split(':'):
dirs.add(dir)
+ runpath_match = runpath_regex.match(arg)
+ if runpath_match:
+ for dir in runpath_match.group(1).split(':'):
+ # The symbols arg is an rpath if the path is a directory
+ if Path(dir).is_dir():
+ dirs.add(dir)
+ symbols_match = symbols_regex.match(arg)
+ if symbols_match:
+ for dir in symbols_match.group(1).split(':'):
+ # Prevent usage of --just-symbols to specify rpath
+ if Path(dir).is_dir():
+ raise MesonException('Invalid arg for --just-symbols, {} is a directory.'.format(dir))
return dirs
def rpaths_for_bundled_shared_libraries(self, target, exclude_system=True):
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 3b4a4bd..32fb8db 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -972,6 +972,8 @@ int dummy;
targets = self.build.get_targets().values()
use_llvm_cov = False
for target in targets:
+ if not hasattr(target, 'compilers'):
+ continue
for compiler in target.compilers.values():
if compiler.get_id() == 'clang' and not compiler.info.is_darwin():
use_llvm_cov = True
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py
index 4aafe62..0d81692 100644
--- a/mesonbuild/mtest.py
+++ b/mesonbuild/mtest.py
@@ -794,6 +794,7 @@ class TestHarness:
def __init__(self, options: argparse.Namespace):
self.options = options
self.collected_logs = [] # type: T.List[str]
+ self.collected_failures = [] # type: T.List[str]
self.fail_count = 0
self.expectedfail_count = 0
self.unexpectedpass_count = 0
@@ -908,6 +909,7 @@ class TestHarness:
if not self.options.quiet or result.res not in ok_statuses:
if result.res not in ok_statuses and mlog.colorize_console:
if result.res in bad_statuses:
+ self.collected_failures.append(result_str)
decorator = mlog.red
elif result.res is TestResult.SKIP:
decorator = mlog.yellow
@@ -928,7 +930,11 @@ class TestHarness:
self.junit.log(name, result)
def print_summary(self) -> None:
- msg = textwrap.dedent('''
+ # Prepend a list of failures
+ msg = '' if len(self.collected_failures) < 1 else "\nSummary of Failures:\n\n"
+ msg += '\n'.join(self.collected_failures)
+ msg += textwrap.dedent('''
+
Ok: {:<4}
Expected Fail: {:<4}
Fail: {:<4}
@@ -1128,8 +1134,8 @@ class TestHarness:
break
self.drain_futures(futures)
- self.print_summary()
self.print_collected_logs()
+ self.print_summary()
if self.logfilename:
print('Full log written to {}'.format(self.logfilename))
diff --git a/run_unittests.py b/run_unittests.py
index fac0f50..73131c7 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -1272,7 +1272,6 @@ class InternalTests(unittest.TestCase):
self.assertFalse(errors)
-
@unittest.skipIf(is_tarball(), 'Skipping because this is a tarball release')
class DataTests(unittest.TestCase):
@@ -4905,6 +4904,25 @@ recommended as it is not supported on some platforms''')
self.run_tests()
self.run_target('coverage')
+ def test_coverage_complex(self):
+ if mesonbuild.environment.detect_msys2_arch():
+ raise unittest.SkipTest('Skipped due to problems with coverage on MSYS2')
+ gcovr_exe, gcovr_new_rootdir = mesonbuild.environment.detect_gcovr()
+ if not gcovr_exe:
+ raise unittest.SkipTest('gcovr not found, or too old')
+ testdir = os.path.join(self.common_test_dir, '109 generatorcustom')
+ env = get_fake_env(testdir, self.builddir, self.prefix)
+ cc = env.detect_c_compiler(MachineChoice.HOST)
+ if cc.get_id() == 'clang':
+ if not mesonbuild.environment.detect_llvm_cov():
+ raise unittest.SkipTest('llvm-cov not found')
+ if cc.get_id() == 'msvc':
+ raise unittest.SkipTest('Test only applies to non-MSVC compilers')
+ self.init(testdir, extra_args=['-Db_coverage=true'])
+ self.build()
+ self.run_tests()
+ self.run_target('coverage')
+
def test_coverage_html(self):
if mesonbuild.environment.detect_msys2_arch():
raise unittest.SkipTest('Skipped due to problems with coverage on MSYS2')
@@ -6455,19 +6473,34 @@ class LinuxlikeTests(BasePlatformTests):
self.init(yonder_dir)
self.build()
self.install(use_destdir=False)
- self.new_builddir()
- # Build an app that uses that installed library.
- # Supply the rpath to the installed library via LDFLAGS
- # (as systems like buildroot and guix are wont to do)
- # and verify install preserves that rpath.
- env = {'LDFLAGS': '-Wl,-rpath=' + yonder_libdir,
- 'PKG_CONFIG_PATH': os.path.join(yonder_libdir, 'pkgconfig')}
- self.init(testdir, override_envvars=env)
- self.build()
- self.install(use_destdir=False)
- got_rpath = get_rpath(os.path.join(yonder_prefix, 'bin/rpathified'))
- self.assertEqual(got_rpath, yonder_libdir)
+ # Since rpath has multiple valid formats we need to
+ # test that they are all properly used.
+ rpath_formats = [
+ ('-Wl,-rpath=', False),
+ ('-Wl,-rpath,', False),
+ ('-Wl,--just-symbols=', True),
+ ('-Wl,--just-symbols,', True),
+ ('-Wl,-R', False),
+ ('-Wl,-R,', False)
+ ]
+ for rpath_format, exception in rpath_formats:
+ # Build an app that uses that installed library.
+ # Supply the rpath to the installed library via LDFLAGS
+ # (as systems like buildroot and guix are wont to do)
+ # and verify install preserves that rpath.
+ self.new_builddir()
+ env = {'LDFLAGS': rpath_format + yonder_libdir,
+ 'PKG_CONFIG_PATH': os.path.join(yonder_libdir, 'pkgconfig')}
+ if exception:
+ with self.assertRaises(subprocess.CalledProcessError):
+ self.init(testdir, override_envvars=env)
+ break
+ self.init(testdir, override_envvars=env)
+ self.build()
+ self.install(use_destdir=False)
+ got_rpath = get_rpath(os.path.join(yonder_prefix, 'bin/rpathified'))
+ self.assertEqual(got_rpath, yonder_libdir, rpath_format)
@skip_if_not_base_option('b_sanitize')
def test_pch_with_address_sanitizer(self):
diff --git a/test cases/common/109 generatorcustom/meson.build b/test cases/common/109 generatorcustom/meson.build
index 17d27e5..b3f50bb 100644
--- a/test cases/common/109 generatorcustom/meson.build
+++ b/test cases/common/109 generatorcustom/meson.build
@@ -14,5 +14,7 @@ allinone = custom_target('alltogether',
output : 'alltogether.h',
command : [catter, '@INPUT@', '@OUTPUT@'])
-executable('proggie', 'main.c', allinone)
+proggie = executable('proggie', 'main.c', allinone)
+
+test('proggie', proggie)