From 38716f0fcb03c73ae1279036913e5b0ac41528a6 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Fri, 9 Jun 2017 12:59:34 +0530 Subject: [PATCH] tests: Improve llvm dependency test coverage --- mesonbuild/dependencies/dev.py | 2 ++ run_unittests.py | 4 ++++ test cases/frameworks/15 llvm/meson.build | 7 +++++++ 3 files changed, 13 insertions(+) diff --git a/mesonbuild/dependencies/dev.py b/mesonbuild/dependencies/dev.py index 8d6437963..d7a718172 100644 --- a/mesonbuild/dependencies/dev.py +++ b/mesonbuild/dependencies/dev.py @@ -202,6 +202,8 @@ class LLVMDependency(ExternalDependency): out = out.strip() if p.returncode != 0: continue + # FIXME: As soon as some llvm-config is found, version checks + # in further dependnecy() calls will be ignored if version_req: if version_compare(out, version_req, strict=True): if cls.__best_found and version_compare(out, '<={}'.format(cls.__best_found), strict=True): diff --git a/run_unittests.py b/run_unittests.py index b03534de8..96aefc589 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -1256,6 +1256,10 @@ class FailureTests(BasePlatformTests): for contents, match in a: self.assertMesonRaises(contents, match) + def test_llvm_dependency(self): + self.assertMesonRaises("dependency('llvm', modules : 'fail')", + "(required.*fail|{})".format(self.dnf)) + class WindowsTests(BasePlatformTests): ''' diff --git a/test cases/frameworks/15 llvm/meson.build b/test cases/frameworks/15 llvm/meson.build index 582ff3740..af7f8c63d 100644 --- a/test cases/frameworks/15 llvm/meson.build +++ b/test cases/frameworks/15 llvm/meson.build @@ -7,4 +7,11 @@ llvm_dep = dependency( required : true, ) +d = dependency('llvm', modules : 'not-found', required : false) +assert(d.found() == false, 'not-found llvm module found') + +# XXX: Version checks are broken, see FIXME in LLVMDependency +#d = dependency('llvm', version : '<0.1', required : false) +#assert(d.found() == false, 'ancient llvm module found') + executable('sum', 'sum.c', dependencies : llvm_dep)