Add tests for warnings in configure_file()
Add tests to run_unittests.py to assert warnings are printed and not printed where appropriate.
This commit is contained in:
parent
2f494d2ccf
commit
dffa7f3564
|
@ -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:.*'FOO_BAR'.*nosubst-nocopy2.txt.in.*not present.*")
|
||||||
self.assertRegex(out, "WARNING:.*'empty'.*config.h.in.*not present.*")
|
self.assertRegex(out, "WARNING:.*'empty'.*config.h.in.*not present.*")
|
||||||
self.assertRegex(out, "WARNING:.*empty configuration_data.*test.py.in")
|
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
|
# 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-nocopy1.txt.in")
|
||||||
self.assertNotRegex(out, "WARNING:.*empty configuration_data.*nosubst-nocopy2.txt.in")
|
self.assertNotRegex(out, "WARNING:.*empty configuration_data.*nosubst-nocopy2.txt.in")
|
||||||
|
|
|
@ -193,15 +193,15 @@ configure_file(
|
||||||
configuration : configuration_data()
|
configuration : configuration_data()
|
||||||
)
|
)
|
||||||
|
|
||||||
# Test that passing an empty configuration_data() object to a file with
|
# test that passing an empty configuration_data() object to a file with
|
||||||
# @FOO@ substitutions does not print the warning.
|
# @foo@ substitutions does not print the warning.
|
||||||
configure_file(
|
configure_file(
|
||||||
input: 'nosubst-nocopy2.txt.in',
|
input: 'nosubst-nocopy2.txt.in',
|
||||||
output: 'nosubst-nocopy2.txt',
|
output: 'nosubst-nocopy2.txt',
|
||||||
configuration : configuration_data()
|
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
|
# an empty configuration_data() object to a file that leads to no substitutions
|
||||||
# prints a warning (see unit tests)
|
# prints a warning (see unit tests)
|
||||||
test_file = configure_file(
|
test_file = configure_file(
|
||||||
|
@ -210,6 +210,25 @@ test_file = configure_file(
|
||||||
configuration: configuration_data()
|
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)
|
test('configure-file', test_file)
|
||||||
|
|
||||||
cdata = configuration_data()
|
cdata = configuration_data()
|
||||||
|
|
|
@ -17,3 +17,22 @@ configure_file(input : '../dummy.dat',
|
||||||
output : 'config2-3.h',
|
output : 'config2-3.h',
|
||||||
command : [found_script, '@INPUT@', '@OUTPUT@'])
|
command : [found_script, '@INPUT@', '@OUTPUT@'])
|
||||||
run_command(check_file, join_paths(meson.current_build_dir(), 'config2-3.h'))
|
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
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in New Issue