diff options
author | Marvin Scholz <epirat07@gmail.com> | 2022-03-30 18:45:02 +0200 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2022-11-22 22:53:07 -0500 |
commit | 7cbc15b8121aa3cae4c91fce0db4eafee78bf55f (patch) | |
tree | 40e855e715e2428e6fe7b7e66b119ed790621025 /unittests | |
parent | 49cd97c43487551a6b8bac4c5560bb2053270009 (diff) | |
download | meson-7cbc15b8121aa3cae4c91fce0db4eafee78bf55f.zip meson-7cbc15b8121aa3cae4c91fce0db4eafee78bf55f.tar.gz meson-7cbc15b8121aa3cae4c91fce0db4eafee78bf55f.tar.bz2 |
unittests: add and use get_meson_log_raw function
This is like get_meson_log but returns the whole contents
not split into individual lines.
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/baseplatformtests.py | 4 | ||||
-rw-r--r-- | unittests/linuxliketests.py | 14 | ||||
-rw-r--r-- | unittests/platformagnostictests.py | 5 |
3 files changed, 13 insertions, 10 deletions
diff --git a/unittests/baseplatformtests.py b/unittests/baseplatformtests.py index 02dc923..d83ef3f 100644 --- a/unittests/baseplatformtests.py +++ b/unittests/baseplatformtests.py @@ -322,6 +322,10 @@ class BasePlatformTests(TestCase): each['command'] = compiler + ' ' + f.read() return contents + def get_meson_log_raw(self): + with self._open_meson_log() as f: + return f.read() + def get_meson_log(self): with self._open_meson_log() as f: return f.readlines() diff --git a/unittests/linuxliketests.py b/unittests/linuxliketests.py index 25b392f..1e530b0 100644 --- a/unittests/linuxliketests.py +++ b/unittests/linuxliketests.py @@ -345,12 +345,12 @@ class LinuxlikeTests(BasePlatformTests): testdir = os.path.join(self.framework_test_dir, '4 qt') self.init(testdir, extra_args=['-Dmethod=pkg-config']) # Confirm that the dependency was found with pkg-config - mesonlog = self.get_meson_log() + mesonlog = self.get_meson_log_raw() if qt4 == 0: - self.assertRegex('\n'.join(mesonlog), + self.assertRegex(mesonlog, r'Run-time dependency qt4 \(modules: Core\) found: YES 4.* \(pkg-config\)') if qt5 == 0: - self.assertRegex('\n'.join(mesonlog), + self.assertRegex(mesonlog, r'Run-time dependency qt5 \(modules: Core\) found: YES 5.* \(pkg-config\)') @skip_if_not_base_option('b_sanitize') @@ -380,8 +380,8 @@ class LinuxlikeTests(BasePlatformTests): testdir = os.path.join(self.framework_test_dir, '4 qt') self.init(testdir, extra_args=['-Dmethod=qmake']) # Confirm that the dependency was found with qmake - mesonlog = self.get_meson_log() - self.assertRegex('\n'.join(mesonlog), + mesonlog = self.get_meson_log_raw() + self.assertRegex(mesonlog, r'Run-time dependency qt5 \(modules: Core\) found: YES .* \(qmake\)\n') def test_qt6dependency_qmake_detection(self): @@ -400,8 +400,8 @@ class LinuxlikeTests(BasePlatformTests): testdir = os.path.join(self.framework_test_dir, '4 qt') self.init(testdir, extra_args=['-Dmethod=qmake']) # Confirm that the dependency was found with qmake - mesonlog = self.get_meson_log() - self.assertRegex('\n'.join(mesonlog), + mesonlog = self.get_meson_log_raw() + self.assertRegex(mesonlog, r'Run-time dependency qt6 \(modules: Core\) found: YES .* \(qmake\)\n') def glob_sofiles_without_privdir(self, g): diff --git a/unittests/platformagnostictests.py b/unittests/platformagnostictests.py index 845d4e5..39965c6 100644 --- a/unittests/platformagnostictests.py +++ b/unittests/platformagnostictests.py @@ -83,9 +83,8 @@ class PlatformAgnosticTests(BasePlatformTests): self.assertNotIn(log_msg, output) # Check if message is written to the meson log - mesonlog = os.path.join(self.builddir, 'meson-logs/meson-log.txt') - with open(mesonlog, mode='r', encoding='utf-8') as file: - self.assertIn(log_msg, file.read()) + mesonlog = self.get_meson_log_raw() + self.assertIn(log_msg, mesonlog) def test_new_subproject_reconfigure(self): testdir = os.path.join(self.unit_test_dir, '107 new subproject on reconfigure') |