aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-07-03 22:27:44 +0530
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2018-07-04 00:25:01 +0000
commit602e58d398c1126b792b4d725d481c67a519f9c1 (patch)
tree243f3c0c77617348c9c9a4889d1a013fdb7919de /run_unittests.py
parent2ac6f6be3295db8bd13e1d7e158bd1a2f06a0cc0 (diff)
downloadmeson-602e58d398c1126b792b4d725d481c67a519f9c1.zip
meson-602e58d398c1126b792b4d725d481c67a519f9c1.tar.gz
meson-602e58d398c1126b792b4d725d481c67a519f9c1.tar.bz2
configure_file: Don't optimize away substitutions
It's possible that the configuration data object has components added conditionally, and that sometimes an empty configuration data object is passed on purpose. Instead, we do the substitution and also warn if no tokens were found that could've been substituted. Closes https://github.com/mesonbuild/meson/issues/3826
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/run_unittests.py b/run_unittests.py
index b6ad20d..fe98058 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -1864,7 +1864,7 @@ int main(int argc, char **argv) {
r'meson.build:6: WARNING: a warning of some sort',
r'sub' + os.path.sep + r'meson.build:4: WARNING: subdir warning',
r'meson.build:7: WARNING: Module unstable-simd has no backwards or forwards compatibility and might not exist in future releases.',
- r"meson.build:11: WARNING: The variable(s) 'MISSING' in the input file conf.in are not present in the given configuration data.",
+ r"meson.build:11: WARNING: The variable(s) 'MISSING' in the input file 'conf.in' are not present in the given configuration data.",
r'meson.build:1: WARNING: Passed invalid keyword argument "invalid".',
]:
self.assertRegex(out, re.escape(expected))
@@ -2286,6 +2286,17 @@ recommended as it is not supported on some platforms''')
self.assertRegex(out, "WARNING: Project specifies a minimum meson_version '>=0.45'")
self.assertRegex(out, " * 0.47.0: {'dict'}")
+ def test_configure_file_warnings(self):
+ testdir = os.path.join(self.common_test_dir, "16 configure file")
+ out = self.init(testdir)
+ self.assertRegex(out, "WARNING:.*'empty'.*config.h.in.*not present.*")
+ self.assertRegex(out, "WARNING:.*'FOO_BAR'.*nosubst-nocopy2.txt.in.*not present.*")
+ self.assertRegex(out, "WARNING:.*'empty'.*config.h.in.*not present.*")
+ self.assertRegex(out, "WARNING:.*empty configuration_data.*test.py.in")
+ # No warnings about empty configuration data objects passed to files with substitutions
+ self.assertNotRegex(out, "WARNING:.*empty configuration_data.*nosubst-nocopy1.txt.in")
+ self.assertNotRegex(out, "WARNING:.*empty configuration_data.*nosubst-nocopy2.txt.in")
+
class FailureTests(BasePlatformTests):
'''