aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2017-03-24 19:57:05 +0000
committerJussi Pakkanen <jpakkane@gmail.com>2017-03-29 21:24:06 +0300
commit8cc89e468d4d8cfcafe7afd8884d9884d2aac751 (patch)
tree0679be7bc46de0ea4e4ac4e84697b671869e5b1b /test cases
parent9929e0efacd5601c548bb727ff13d19ee96477c6 (diff)
downloadmeson-8cc89e468d4d8cfcafe7afd8884d9884d2aac751.zip
meson-8cc89e468d4d8cfcafe7afd8884d9884d2aac751.tar.gz
meson-8cc89e468d4d8cfcafe7afd8884d9884d2aac751.tar.bz2
configure_file: make input arg optional if command is used
Fixes #1476
Diffstat (limited to 'test cases')
-rwxr-xr-xtest cases/common/16 configure file/generator-without-input-file.py14
-rw-r--r--test cases/common/16 configure file/installed_files.txt1
-rw-r--r--test cases/common/16 configure file/meson.build10
3 files changed, 25 insertions, 0 deletions
diff --git a/test cases/common/16 configure file/generator-without-input-file.py b/test cases/common/16 configure file/generator-without-input-file.py
new file mode 100755
index 0000000..2ee059e
--- /dev/null
+++ b/test cases/common/16 configure file/generator-without-input-file.py
@@ -0,0 +1,14 @@
+#!/usr/bin/env python3
+
+import sys, os
+from pathlib import Path
+
+if len(sys.argv) != 2:
+ print("Wrong amount of parameters.")
+
+build_dir = Path(os.environ['MESON_BUILD_ROOT'])
+subdir = Path(os.environ['MESON_SUBDIR'])
+outputf = Path(sys.argv[1])
+
+with outputf.open('w') as ofile:
+ ofile.write("#define ZERO_RESULT 0\n")
diff --git a/test cases/common/16 configure file/installed_files.txt b/test cases/common/16 configure file/installed_files.txt
index d9fee12..542516e 100644
--- a/test cases/common/16 configure file/installed_files.txt
+++ b/test cases/common/16 configure file/installed_files.txt
@@ -1,3 +1,4 @@
usr/share/appdir/config2.h
+usr/share/appdir/config2b.h
usr/share/appdireh/config2-1.h
usr/share/appdirok/config2-2.h
diff --git a/test cases/common/16 configure file/meson.build b/test cases/common/16 configure file/meson.build
index bff041b..8271ca3 100644
--- a/test cases/common/16 configure file/meson.build
+++ b/test cases/common/16 configure file/meson.build
@@ -36,6 +36,16 @@ configure_file(input : 'dummy.dat',
install_dir : 'share/appdir')
run_command(check_file, join_paths(meson.current_build_dir(), 'config2.h'))
+# Same again as before, but an input file should not be required in
+# this case where we use a command/script to generate the output file.
+genscript2b = '@0@/generator-without-input-file.py'.format(meson.current_source_dir())
+ofile2b = '@0@/config2b.h'.format(meson.current_build_dir())
+configure_file(
+ output : 'config2b.h',
+ command : [genprog, genscript2b, ofile2b],
+ install_dir : 'share/appdir')
+run_command(check_file, join_paths(meson.current_build_dir(), 'config2b.h'))
+
found_script = find_program('generator.py')
# More configure_file tests in here
subdir('subdir')