aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xrun_unittests.py4
-rw-r--r--test cases/common/16 configure file/meson.build25
-rw-r--r--test cases/common/16 configure file/subdir/meson.build19
3 files changed, 45 insertions, 3 deletions
diff --git a/run_unittests.py b/run_unittests.py
index b3bc271..9a71937 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -2293,6 +2293,10 @@ recommended as it is not supported on some platforms''')
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")
+ # Warnings for configuration files that are overwritten.
+ self.assertRegex(out, "WARNING:.*double_output.txt.*overwrites")
+ self.assertRegex(out, "WARNING:.*subdir/double_output2.txt.*overwrites")
+ self.assertNotRegex(out, "WARNING:.*no_write_conflict.txt.*overwrites")
# 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")
diff --git a/test cases/common/16 configure file/meson.build b/test cases/common/16 configure file/meson.build
index 8c375c1..d7beeb1 100644
--- a/test cases/common/16 configure file/meson.build
+++ b/test cases/common/16 configure file/meson.build
@@ -193,15 +193,15 @@ configure_file(
configuration : configuration_data()
)
-# Test that passing an empty configuration_data() object to a file with
-# @FOO@ substitutions does not print the warning.
+# test that passing an empty configuration_data() object to a file with
+# @foo@ substitutions does not print the warning.
configure_file(
input: 'nosubst-nocopy2.txt.in',
output: 'nosubst-nocopy2.txt',
configuration : configuration_data()
)
-# Test that passing a configured file object to test() works, and that passing
+# test that passing a configured file object to test() works, and that passing
# an empty configuration_data() object to a file that leads to no substitutions
# prints a warning (see unit tests)
test_file = configure_file(
@@ -210,6 +210,25 @@ test_file = configure_file(
configuration: configuration_data()
)
+# Test that overwriting an existing file creates a warning.
+configure_file(
+ input: 'test.py.in',
+ output: 'double_output.txt',
+ configuration: conf
+)
+configure_file(
+ input: 'test.py.in',
+ output: 'double_output.txt',
+ configuration: conf
+)
+
+# Test that the same file name in a different subdir will not create a warning
+configure_file(
+ input: 'test.py.in',
+ output: 'no_write_conflict.txt',
+ configuration: conf
+)
+
test('configure-file', test_file)
cdata = configuration_data()
diff --git a/test cases/common/16 configure file/subdir/meson.build b/test cases/common/16 configure file/subdir/meson.build
index d802c1d..146b7b6 100644
--- a/test cases/common/16 configure file/subdir/meson.build
+++ b/test cases/common/16 configure file/subdir/meson.build
@@ -17,3 +17,22 @@ configure_file(input : '../dummy.dat',
output : 'config2-3.h',
command : [found_script, '@INPUT@', '@OUTPUT@'])
run_command(check_file, join_paths(meson.current_build_dir(), 'config2-3.h'))
+
+# Test that overwriting an existing file creates a warning.
+configure_file(
+ input: '../test.py.in',
+ output: 'double_output2.txt',
+ configuration: conf
+)
+configure_file(
+ input: '../test.py.in',
+ output: 'double_output2.txt',
+ configuration: conf
+)
+
+# Test that the same file name in a different subdir will not create a warning
+configure_file(
+ input: '../test.py.in',
+ output: 'no_write_conflict.txt',
+ configuration: conf
+)