aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-06-10 13:04:00 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2017-06-10 18:55:50 +0530
commit9308a6d923ecdfabb40d88e1590226172ea95e43 (patch)
tree26ffa6a115fcacb1ee0741c6d946f8a43d6abbbb
parentc1e9c757ebbe7a26b126ee8cb2106f6f8dffa322 (diff)
downloadmeson-9308a6d923ecdfabb40d88e1590226172ea95e43.zip
meson-9308a6d923ecdfabb40d88e1590226172ea95e43.tar.gz
meson-9308a6d923ecdfabb40d88e1590226172ea95e43.tar.bz2
tests: Add Boost unit tests and project tests on Windows
Boost tests are disabled on Windows for now because the detection is actually completely broken. Once that's fixed (after the release) we can enable it again.
-rw-r--r--.appveyor.yml2
-rw-r--r--mesonbuild/dependencies/misc.py7
-rwxr-xr-xrun_project_tests.py13
-rwxr-xr-xrun_unittests.py13
4 files changed, 29 insertions, 6 deletions
diff --git a/.appveyor.yml b/.appveyor.yml
index 1e20a37..6551445 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -55,6 +55,8 @@ skip_commits:
install:
- cmd: set "ORIG_PATH=%PATH%"
+ # Boost 1.56.0: https://www.appveyor.com/docs/build-environment/#boost
+ #- cmd: set "BOOST_ROOT=C:\Libraries\boost"
# Use the x86 python only when building for x86 for the cpython tests.
# For all other archs (including, say, arm), use the x64 python.
- ps: (new-object net.webclient).DownloadFile('https://www.dropbox.com/s/bbzvepq85hv47x1/ninja.exe?dl=1', 'C:\projects\meson\ninja.exe')
diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py
index 1356ec8..c24acf0 100644
--- a/mesonbuild/dependencies/misc.py
+++ b/mesonbuild/dependencies/misc.py
@@ -126,8 +126,8 @@ class BoostDependency(ExternalDependency):
def get_requested(self, kwargs):
candidates = kwargs.get('modules', [])
- if isinstance(candidates, str):
- return [candidates]
+ if not isinstance(candidates, list):
+ candidates = [candidates]
for c in candidates:
if not isinstance(c, str):
raise DependencyException('Boost module argument is not a string.')
@@ -136,7 +136,8 @@ class BoostDependency(ExternalDependency):
def validate_requested(self):
for m in self.requested_modules:
if m not in self.src_modules:
- raise DependencyException('Requested Boost module "%s" not found.' % m)
+ msg = 'Requested Boost module {!r} not found'
+ raise DependencyException(msg.format(m))
def detect_version(self):
try:
diff --git a/run_project_tests.py b/run_project_tests.py
index 71d6c0c..66d7eb0 100755
--- a/run_project_tests.py
+++ b/run_project_tests.py
@@ -371,7 +371,7 @@ def _run_test(testdir, test_build_dir, install_dir, extra_args, compiler, backen
return TestResult(validate_install(testdir, install_dir, compiler), BuildStep.validate, stdo, stde, mesonlog, gen_time, build_time, test_time)
def gather_tests(testdir):
- tests = [t.replace('\\', '/').split('/', 2)[2] for t in glob(os.path.join(testdir, '*'))]
+ tests = [t.replace('\\', '/').split('/', 2)[2] for t in glob(testdir + '/*')]
testlist = [(int(t.split()[0]), t) for t in tests]
testlist.sort()
tests = [os.path.join(testdir, t[1]) for t in testlist]
@@ -425,7 +425,6 @@ def detect_tests_to_run():
('platform-windows', 'windows', not mesonlib.is_windows() and not mesonlib.is_cygwin()),
('platform-linux', 'linuxlike', mesonlib.is_osx() or mesonlib.is_windows()),
- ('framework', 'frameworks', mesonlib.is_osx() or mesonlib.is_windows() or mesonlib.is_cygwin()),
('java', 'java', backend is not Backend.ninja or mesonlib.is_osx() or not have_java()),
('C#', 'csharp', backend is not Backend.ninja or not shutil.which('mcs')),
('vala', 'vala', backend is not Backend.ninja or not shutil.which('valac')),
@@ -436,7 +435,15 @@ def detect_tests_to_run():
('swift', 'swift', backend not in (Backend.ninja, Backend.xcode) or not shutil.which('swiftc')),
('python3', 'python3', backend is not Backend.ninja),
]
- return [(name, gather_tests('test cases/' + subdir), skip) for name, subdir, skip in all_tests]
+ gathered_tests = [(name, gather_tests('test cases/' + subdir), skip) for name, subdir, skip in all_tests]
+ if mesonlib.is_windows():
+ # TODO: Set BOOST_ROOT in .appveyor.yml
+ gathered_tests += [('framework', ['test cases/frameworks/1 boost'], 'BOOST_ROOT' not in os.environ)]
+ elif mesonlib.is_osx() or mesonlib.is_cygwin():
+ gathered_tests += [('framework', gather_tests('test cases/frameworks'), True)]
+ else:
+ gathered_tests += [('framework', gather_tests('test cases/frameworks'), False)]
+ return gathered_tests
def run_tests(all_tests, log_name_base, extra_args):
global stop, executor, futures
diff --git a/run_unittests.py b/run_unittests.py
index bcb55a2..dbfd638 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -1316,6 +1316,19 @@ class FailureTests(BasePlatformTests):
self.assertMesonRaises("dependency('llvm', modules : 'fail')",
"(required.*fail|{})".format(self.dnf))
+ def test_boost_notfound_dependency(self):
+ # Can be run even if Boost is found or not
+ self.assertMesonRaises("dependency('boost', modules : 1)",
+ "module.*not a string")
+ self.assertMesonRaises("dependency('boost', modules : 'fail')",
+ "(fail.*not found|{})".format(self.dnf))
+
+ def test_boost_BOOST_ROOT_dependency(self):
+ # Test BOOST_ROOT; can be run even if Boost is found or not
+ os.environ['BOOST_ROOT'] = 'relative/path'
+ self.assertMesonRaises("dependency('boost')",
+ "(BOOST_ROOT.*absolute|{})".format(self.dnf))
+
class WindowsTests(BasePlatformTests):
'''