diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2018-08-20 00:45:52 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2018-08-20 01:20:50 +0530 |
commit | 818cc694713570cfdd9144e36a6997516801a67b (patch) | |
tree | 2eb365f1c2a4d0c7231aa4bacdde39f7c3d00f99 | |
parent | e8932adb1468d085b45b93779bad1ee01b06adc0 (diff) | |
download | meson-nirbheek/fix-dependency-exception.tar.gz |
Fix various small test failures on macOSnirbheek/fix-dependency-exception
These weren't caught by the CI because we have pkg-config on it, and
these were testing non-pkg-config codepaths. The unity build on macOS
now doesn't have pkg-config to ensure that the codepath is tested.
-rw-r--r-- | .travis.yml | 4 | ||||
-rw-r--r-- | mesonbuild/dependencies/base.py | 2 | ||||
-rwxr-xr-x | run_unittests.py | 11 |
3 files changed, 14 insertions, 3 deletions
diff --git a/.travis.yml b/.travis.yml index 197c803b2..dd5cebb5b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,7 +41,9 @@ matrix: before_install: - python ./skip_ci.py --base-branch-env=TRAVIS_BRANCH --is-pull-env=TRAVIS_PULL_REQUEST - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install qt pkg-config; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install qt; fi + # # Run one macOS build without pkg-config available, and the other (unity=on) with pkg-config + - if [[ "$TRAVIS_OS_NAME" == "osx" && "$MESON_ARGS" =~ .*unity=on.* ]]; then brew install pkg-config; fi # Use a Ninja with QuLogic's patch: https://github.com/ninja-build/ninja/issues/1219 - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then mkdir -p $HOME/tools; curl -L http://nirbheek.in/files/binaries/ninja/macos/ninja -o $HOME/tools/ninja; chmod +x $HOME/tools/ninja; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker pull jpakkane/mesonci:bionic; fi diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py index c4f963000..20ba06ccd 100644 --- a/mesonbuild/dependencies/base.py +++ b/mesonbuild/dependencies/base.py @@ -1191,7 +1191,7 @@ class ExternalLibrary(ExternalDependency): class ExtraFrameworkDependency(ExternalDependency): def __init__(self, name, required, path, env, lang, kwargs): super().__init__('extraframeworks', env, lang, kwargs) - self.name = None + self.name = name self.required = required self.detect(name, path) if self.found(): diff --git a/run_unittests.py b/run_unittests.py index 54a1363a9..2e29af7dc 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -658,6 +658,9 @@ class InternalTests(unittest.TestCase): # Test ends PkgConfigDependency._call_pkgbin = old_call PkgConfigDependency.check_pkgconfig = old_check + # Reset dependency class to ensure that in-process configure doesn't mess up + PkgConfigDependency.pkgbin_cache = {} + PkgConfigDependency.class_pkgbin = None @unittest.skipIf(is_tarball(), 'Skipping because this is a tarball release') @@ -2596,6 +2599,7 @@ class FailureTests(BasePlatformTests): and slows down testing. ''' dnf = "[Dd]ependency.*not found" + nopkg = '[Pp]kg-config not found' def setUp(self): super().setUp() @@ -2677,7 +2681,11 @@ class FailureTests(BasePlatformTests): if shutil.which('sdl2-config'): raise unittest.SkipTest('sdl2-config found') self.assertMesonRaises("dependency('sdl2', method : 'sdlconfig')", self.dnf) - self.assertMesonRaises("dependency('sdl2', method : 'pkg-config')", self.dnf) + if shutil.which('pkg-config'): + errmsg = self.dnf + else: + errmsg = self.nopkg + self.assertMesonRaises("dependency('sdl2', method : 'pkg-config')", errmsg) def test_gnustep_notfound_dependency(self): # Want to test failure, so skip if available @@ -3463,6 +3471,7 @@ class LinuxlikeTests(BasePlatformTests): for v in installed.values(): self.assertTrue('prog' in v or 'foo' in v) + @skipIfNoPkgconfig def test_order_of_l_arguments(self): testdir = os.path.join(self.unit_test_dir, '8 -L -l order') os.environ['PKG_CONFIG_PATH'] = testdir |