diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2016-11-12 12:19:28 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-12 12:19:28 -0500 |
commit | 28b70ba4e583cba7c9043a42ab8696547fc0dcbc (patch) | |
tree | 974bb0722caf07d9ca04930fc0f15887c4b6b162 /run_unittests.py | |
parent | 1d9c40c9c311e2f015104dcfa568a9eaf82a1e76 (diff) | |
parent | cedfa575f6144b9eb3ed9f777074c7b95ad52231 (diff) | |
download | meson-28b70ba4e583cba7c9043a42ab8696547fc0dcbc.zip meson-28b70ba4e583cba7c9043a42ab8696547fc0dcbc.tar.gz meson-28b70ba4e583cba7c9043a42ab8696547fc0dcbc.tar.bz2 |
Merge pull request #1010 from centricular/qt5-broken-moc-detection
Overhaul Qt4/5 detection with pkg-config/qmake and improve moc/uic/rcc detection
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/run_unittests.py b/run_unittests.py index 8df0001..44e190e 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -19,7 +19,7 @@ import re, json import tempfile import mesonbuild.environment from mesonbuild.environment import detect_ninja -from mesonbuild.dependencies import PkgConfigDependency +from mesonbuild.dependencies import PkgConfigDependency, Qt5Dependency def get_soname(fname): # HACK, fix to not use shell. @@ -59,6 +59,7 @@ class LinuxlikeTests(unittest.TestCase): self.ninja_command = [detect_ninja(), '-C', self.builddir] self.common_test_dir = os.path.join(src_root, 'test cases/common') self.vala_test_dir = os.path.join(src_root, 'test cases/vala') + self.framework_test_dir = os.path.join(src_root, 'test cases/frameworks') self.output = b'' self.orig_env = os.environ.copy() @@ -67,22 +68,29 @@ class LinuxlikeTests(unittest.TestCase): os.environ = self.orig_env super().tearDown() + def _run(self, command): + self.output += subprocess.check_output(command, env=os.environ.copy()) + def init(self, srcdir): - self.output += subprocess.check_output(self.meson_command + [srcdir, self.builddir]) + self._run(self.meson_command + [srcdir, self.builddir]) def build(self): - self.output += subprocess.check_output(self.ninja_command) + self._run(self.ninja_command) def run_target(self, target): self.output += subprocess.check_output(self.ninja_command + [target]) def setconf(self, arg): - self.output += subprocess.check_output(self.mconf_command + [arg, self.builddir]) + self._run(self.mconf_command + [arg, self.builddir]) def get_compdb(self): with open(os.path.join(self.builddir, 'compile_commands.json')) as ifile: return json.load(ifile) + def get_meson_log(self): + with open(os.path.join(self.builddir, 'meson-logs', 'meson-log.txt')) as f: + return f.readlines() + def introspect(self, arg): out = subprocess.check_output(self.mintro_command + [arg, self.builddir]) return json.loads(out.decode('utf-8')) @@ -181,5 +189,19 @@ class LinuxlikeTests(unittest.TestCase): self.init(testdir) self.run_target('check_exists') + def test_qt5dependency_qmake_detection(self): + # Can't be sure that `qmake` is Qt5, so just try qmake-qt5. + if not shutil.which('qmake-qt5'): + raise unittest.SkipTest('qt5 not found') + # Disable pkg-config codepath and force searching with qmake/qmake-qt5 + os.environ['PKG_CONFIG_LIBDIR'] = self.builddir + os.environ['PKG_CONFIG_PATH'] = self.builddir + testdir = os.path.join(self.framework_test_dir, '4 qt') + self.init(testdir) + # Confirm that the dependency was found with qmake + msg = 'Qt5 native `qmake-qt5` dependency found: YES\n' + mesonlog = self.get_meson_log() + self.assertTrue(msg in mesonlog) + if __name__ == '__main__': unittest.main() |