aboutsummaryrefslogtreecommitdiff
path: root/test cases/common
diff options
context:
space:
mode:
Diffstat (limited to 'test cases/common')
-rw-r--r--test cases/common/102 subproject subdir/meson.build29
-rw-r--r--test cases/common/102 subproject subdir/subprojects/sub_implicit.wrap6
-rw-r--r--test cases/common/102 subproject subdir/subprojects/sub_implicit/meson.build11
-rw-r--r--test cases/common/104 postconf with args/meson.build7
-rw-r--r--test cases/common/109 generatorcustom/meson.build4
-rwxr-xr-xtest cases/common/125 object only target/obj_generator.py2
-rw-r--r--test cases/common/145 special characters/arg-char-test.c10
-rw-r--r--test cases/common/145 special characters/arg-string-test.c12
-rw-r--r--test cases/common/145 special characters/arg-unquoted-test.c17
-rw-r--r--test cases/common/145 special characters/meson.build38
-rw-r--r--test cases/common/157 wrap file should not failed/meson.build8
-rw-r--r--test cases/common/157 wrap file should not failed/src/meson.build4
-rw-r--r--test cases/common/157 wrap file should not failed/src/test.c9
-rw-r--r--test cases/common/157 wrap file should not failed/subprojects/.gitignore2
-rw-r--r--test cases/common/157 wrap file should not failed/subprojects/bar.wrap8
-rw-r--r--test cases/common/157 wrap file should not failed/subprojects/foo-1.0/foo.c3
-rw-r--r--test cases/common/157 wrap file should not failed/subprojects/foo-1.0/meson.build2
-rw-r--r--test cases/common/157 wrap file should not failed/subprojects/foo.wrap4
-rw-r--r--test cases/common/157 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xzbin232 -> 244 bytes
-rw-r--r--test cases/common/157 wrap file should not failed/subprojects/packagecache/foo-1.0.tar.xzbin180 -> 196 bytes
-rw-r--r--test cases/common/157 wrap file should not failed/subprojects/packagefiles/bar-1.0-patch.tar.xzbin0 -> 244 bytes
-rw-r--r--test cases/common/157 wrap file should not failed/subprojects/packagefiles/bar-1.0.tar.xzbin0 -> 200 bytes
-rw-r--r--test cases/common/157 wrap file should not failed/subprojects/packagefiles/foo-1.0/meson.build2
-rw-r--r--test cases/common/157 wrap file should not failed/subprojects/patchdir.wrap9
-rw-r--r--test cases/common/163 disabler/meson.build28
-rw-r--r--test cases/common/187 find override/meson.build3
-rw-r--r--test cases/common/187 find override/subprojects/sub.wrap5
-rw-r--r--test cases/common/187 find override/subprojects/sub/meson.build4
-rw-r--r--test cases/common/201 override with exe/meson.build8
-rw-r--r--test cases/common/201 override with exe/subprojects/sub/meson.build2
-rw-r--r--test cases/common/222 source set realistic example/meson.build6
-rw-r--r--test cases/common/226 include_type dependency/main.cpp8
-rw-r--r--test cases/common/226 include_type dependency/meson.build10
-rw-r--r--test cases/common/226 include_type dependency/pch/test.hpp1
-rw-r--r--test cases/common/230 persubproject options/meson.build4
-rw-r--r--test cases/common/230 persubproject options/subprojects/sub1/foo.c3
-rw-r--r--test cases/common/230 persubproject options/subprojects/sub1/meson.build4
-rw-r--r--test cases/common/232 link language/c_linkage.cpp5
-rw-r--r--test cases/common/232 link language/c_linkage.h10
-rw-r--r--test cases/common/232 link language/lib.cpp5
-rw-r--r--test cases/common/232 link language/main.c5
-rw-r--r--test cases/common/232 link language/meson.build18
-rw-r--r--test cases/common/233 link depends indexed custom target/foo.c15
-rw-r--r--test cases/common/233 link depends indexed custom target/make_file.py8
-rw-r--r--test cases/common/233 link depends indexed custom target/meson.build19
-rwxr-xr-xtest cases/common/234 very long commmand line/codegen.py6
-rw-r--r--test cases/common/234 very long commmand line/main.c5
-rw-r--r--test cases/common/234 very long commmand line/meson.build44
-rwxr-xr-xtest cases/common/234 very long commmand line/seq.py6
-rw-r--r--test cases/common/36 tryrun/meson.build2
-rw-r--r--test cases/common/38 string operations/meson.build15
-rw-r--r--test cases/common/43 options/meson_options.txt6
-rw-r--r--test cases/common/47 pkgconfig-gen/dependencies/main.c4
-rw-r--r--test cases/common/47 pkgconfig-gen/meson.build39
-rw-r--r--test cases/common/47 pkgconfig-gen/simple5.c6
-rw-r--r--test cases/common/47 pkgconfig-gen/test.json6
-rwxr-xr-xtest cases/common/56 install script/customtarget.py19
-rw-r--r--test cases/common/56 install script/meson.build26
-rw-r--r--test cases/common/56 install script/myinstall.py29
-rw-r--r--test cases/common/56 install script/src/a file.txt0
-rw-r--r--test cases/common/56 install script/src/exe.c24
-rw-r--r--test cases/common/56 install script/src/meson.build4
-rw-r--r--test cases/common/56 install script/src/myinstall.py4
-rw-r--r--test cases/common/56 install script/test.json10
-rwxr-xr-xtest cases/common/56 install script/wrap.py6
-rw-r--r--test cases/common/93 selfbuilt custom/meson.build2
66 files changed, 590 insertions, 31 deletions
diff --git a/test cases/common/102 subproject subdir/meson.build b/test cases/common/102 subproject subdir/meson.build
index 8299a37..a891ca9 100644
--- a/test cases/common/102 subproject subdir/meson.build
+++ b/test cases/common/102 subproject subdir/meson.build
@@ -25,3 +25,32 @@ dependency('sub-novar', fallback : 'sub_novar')
# Verify a subproject can force a dependency to be not-found
d = dependency('sub-notfound', fallback : 'sub_novar', required : false)
assert(not d.found(), 'Dependency should be not-found')
+
+# Verify that implicit fallback works because subprojects/sub_implicit directory exists
+d = dependency('sub_implicit')
+assert(d.found(), 'Should implicitly fallback')
+
+# Verify that implicit fallback works because sub_implicit.wrap has
+# `dependency_names=sub_implicit_provide1` and the subproject overrides sub_implicit_provide1.
+d = dependency('sub_implicit_provide1')
+assert(d.found(), 'Should implicitly fallback')
+
+# Verify that implicit fallback works because sub_implicit.wrap has
+# `sub_implicit_provide2=sub_implicit_provide2_dep` and does not override
+# sub_implicit_provide2.
+d = dependency('sub_implicit_provide2')
+assert(d.found(), 'Should implicitly fallback')
+
+# sub_implicit.wrap provides glib-2.0 and we already configured that subproject,
+# so we must not return the system dependency here. Using glib-2.0 here because
+# some CI runners have it installed.
+d = dependency('glib-2.0', required : false)
+assert(d.found())
+assert(d.type_name() == 'internal')
+
+# sub_implicit.wrap provides gobject-2.0 and we already configured that subproject,
+# so we must not return the system dependency here. But since the subproject did
+# not override that dependency and its not required, not-found should be returned.
+# Using gobject-2.0 here because some CI runners have it installed.
+d = dependency('gobject-2.0', required : false)
+assert(not d.found())
diff --git a/test cases/common/102 subproject subdir/subprojects/sub_implicit.wrap b/test cases/common/102 subproject subdir/subprojects/sub_implicit.wrap
new file mode 100644
index 0000000..a809c43
--- /dev/null
+++ b/test cases/common/102 subproject subdir/subprojects/sub_implicit.wrap
@@ -0,0 +1,6 @@
+[wrap-file]
+
+[provide]
+glib-2.0 = glib_dep
+dependency_names = sub_implicit_provide1, gobject-2.0
+sub_implicit_provide2 = sub_implicit_provide2_dep
diff --git a/test cases/common/102 subproject subdir/subprojects/sub_implicit/meson.build b/test cases/common/102 subproject subdir/subprojects/sub_implicit/meson.build
new file mode 100644
index 0000000..24609ae
--- /dev/null
+++ b/test cases/common/102 subproject subdir/subprojects/sub_implicit/meson.build
@@ -0,0 +1,11 @@
+project('sub_implicit', 'c', version : '1.0')
+
+dep = declare_dependency()
+meson.override_dependency('sub_implicit', dep)
+meson.override_dependency('sub_implicit_provide1', dep)
+
+# This one is not overriden but the wrap file tells the variable name to use.
+sub_implicit_provide2_dep = dep
+
+# This one is not overriden but the wrap file tells the variable name to use.
+glib_dep = dep
diff --git a/test cases/common/104 postconf with args/meson.build b/test cases/common/104 postconf with args/meson.build
index 8510c5b..a34502c 100644
--- a/test cases/common/104 postconf with args/meson.build
+++ b/test cases/common/104 postconf with args/meson.build
@@ -1,5 +1,10 @@
project('postconf script', 'c')
-meson.add_postconf_script('postconf.py', '5', '33')
+conf = configure_file(
+ configuration : configuration_data(),
+ output : 'out'
+)
+
+meson.add_postconf_script(find_program('postconf.py'), '5', '33', conf)
test('post', executable('prog', 'prog.c'))
diff --git a/test cases/common/109 generatorcustom/meson.build b/test cases/common/109 generatorcustom/meson.build
index 17d27e5..b3f50bb 100644
--- a/test cases/common/109 generatorcustom/meson.build
+++ b/test cases/common/109 generatorcustom/meson.build
@@ -14,5 +14,7 @@ allinone = custom_target('alltogether',
output : 'alltogether.h',
command : [catter, '@INPUT@', '@OUTPUT@'])
-executable('proggie', 'main.c', allinone)
+proggie = executable('proggie', 'main.c', allinone)
+
+test('proggie', proggie)
diff --git a/test cases/common/125 object only target/obj_generator.py b/test cases/common/125 object only target/obj_generator.py
index a33872a..afdbc09 100755
--- a/test cases/common/125 object only target/obj_generator.py
+++ b/test cases/common/125 object only target/obj_generator.py
@@ -13,6 +13,8 @@ if __name__ == '__main__':
ofile = sys.argv[3]
if compiler.endswith('cl'):
cmd = [compiler, '/nologo', '/MDd', '/Fo' + ofile, '/c', ifile]
+ elif sys.platform == 'sunos5':
+ cmd = [compiler, '-fpic', '-c', ifile, '-o', ofile]
else:
cmd = [compiler, '-c', ifile, '-o', ofile]
sys.exit(subprocess.call(cmd))
diff --git a/test cases/common/145 special characters/arg-char-test.c b/test cases/common/145 special characters/arg-char-test.c
new file mode 100644
index 0000000..04e02f8
--- /dev/null
+++ b/test cases/common/145 special characters/arg-char-test.c
@@ -0,0 +1,10 @@
+#include <assert.h>
+#include <stdio.h>
+
+int main(int argc, char **argv) {
+ char c = CHAR;
+ assert(argc == 2);
+ if (c != argv[1][0])
+ fprintf(stderr, "Expected %x, got %x\n", (unsigned int) c, (unsigned int) argv[1][0]);
+ assert(c == argv[1][0]);
+}
diff --git a/test cases/common/145 special characters/arg-string-test.c b/test cases/common/145 special characters/arg-string-test.c
new file mode 100644
index 0000000..199fd79
--- /dev/null
+++ b/test cases/common/145 special characters/arg-string-test.c
@@ -0,0 +1,12 @@
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+
+int main(int argc, char **argv) {
+ const char *s = CHAR;
+ assert(argc == 2);
+ assert(strlen(s) == 1);
+ if (s[0] != argv[1][0])
+ fprintf(stderr, "Expected %x, got %x\n", (unsigned int) s[0], (unsigned int) argv[1][0]);
+ assert(s[0] == argv[1][0]);
+}
diff --git a/test cases/common/145 special characters/arg-unquoted-test.c b/test cases/common/145 special characters/arg-unquoted-test.c
new file mode 100644
index 0000000..7f679ca
--- /dev/null
+++ b/test cases/common/145 special characters/arg-unquoted-test.c
@@ -0,0 +1,17 @@
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+
+#define Q(x) #x
+#define QUOTE(x) Q(x)
+
+int main(int argc, char **argv) {
+ const char *s = QUOTE(CHAR);
+ assert(argc == 2);
+ assert(strlen(s) == 1);
+ if (s[0] != argv[1][0])
+ fprintf(stderr, "Expected %x, got %x\n", (unsigned int) s[0], (unsigned int) argv[1][0]);
+ assert(s[0] == argv[1][0]);
+ // There is no way to convert a macro argument into a character constant.
+ // Otherwise we'd test that as well
+}
diff --git a/test cases/common/145 special characters/meson.build b/test cases/common/145 special characters/meson.build
index ecba650..579601e 100644
--- a/test cases/common/145 special characters/meson.build
+++ b/test cases/common/145 special characters/meson.build
@@ -35,3 +35,41 @@ gen2 = custom_target('gen2',
output : 'result2',
install : true,
install_dir : get_option('datadir'))
+
+# Test that we can pass these special characters in compiler arguments
+#
+# (this part of the test is crafted so we don't try to use these special
+# characters in filenames or target names)
+#
+# TODO: similar tests needed for languages other than C
+# TODO: add similar test for quote, doublequote, and hash, carefully
+# Re hash, see
+# https://docs.microsoft.com/en-us/cpp/build/reference/d-preprocessor-definitions
+
+special = [
+ ['amp', '&'],
+ ['at', '@'],
+ ['backslash', '\\'],
+ ['dollar', '$'],
+ ['gt', '>'],
+ ['lt', '<'],
+ ['slash', '/'],
+]
+
+cc = meson.get_compiler('c')
+
+foreach s : special
+ args = '-DCHAR="@0@"'.format(s[1])
+ e = executable('arg-string-' + s[0], 'arg-string-test.c', c_args: args)
+ test('arg-string-' + s[0], e, args: s[1])
+
+ args = '-DCHAR=@0@'.format(s[1])
+ e = executable('arg-unquoted-' + s[0], 'arg-unquoted-test.c', c_args: args)
+ test('arg-unquoted-' + s[0], e, args: s[1])
+endforeach
+
+foreach s : special
+ args = '-DCHAR=\'@0@\''.format(s[1])
+ e = executable('arg-char-' + s[0], 'arg-char-test.c', c_args: args)
+ test('arg-char-' + s[0], e, args: s[1])
+endforeach
diff --git a/test cases/common/157 wrap file should not failed/meson.build b/test cases/common/157 wrap file should not failed/meson.build
index f4ec2a8..48d1068 100644
--- a/test cases/common/157 wrap file should not failed/meson.build
+++ b/test cases/common/157 wrap file should not failed/meson.build
@@ -3,8 +3,14 @@ project('mainproj', 'c',
)
subproject('zlib')
-subproject('foo')
+foo = subproject('foo')
+bar = subproject('bar')
+
+libfoo = foo.get_variable('libfoo')
+libbar = bar.get_variable('libbar')
executable('grabprog', files('src/subprojects/prog.c'))
executable('grabprog2', files('src/subprojects/foo/prog2.c'))
subdir('src')
+
+subproject('patchdir')
diff --git a/test cases/common/157 wrap file should not failed/src/meson.build b/test cases/common/157 wrap file should not failed/src/meson.build
index 69f666d..0c82165 100644
--- a/test cases/common/157 wrap file should not failed/src/meson.build
+++ b/test cases/common/157 wrap file should not failed/src/meson.build
@@ -1,2 +1,6 @@
executable('grabprog3', files('subprojects/prog.c'))
executable('grabprog4', files('subprojects/foo/prog2.c'))
+
+texe = executable('testexe', files('test.c'), link_with: [libfoo, libbar])
+
+test('t1', texe)
diff --git a/test cases/common/157 wrap file should not failed/src/test.c b/test cases/common/157 wrap file should not failed/src/test.c
new file mode 100644
index 0000000..34cf991
--- /dev/null
+++ b/test cases/common/157 wrap file should not failed/src/test.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+
+int bar_dummy_func(void);
+int dummy_func(void);
+
+int main(void) {
+ printf("Hello world %d\n", bar_dummy_func() + dummy_func());
+ return 0;
+}
diff --git a/test cases/common/157 wrap file should not failed/subprojects/.gitignore b/test cases/common/157 wrap file should not failed/subprojects/.gitignore
new file mode 100644
index 0000000..5550e2e
--- /dev/null
+++ b/test cases/common/157 wrap file should not failed/subprojects/.gitignore
@@ -0,0 +1,2 @@
+/foo-1.0
+/bar-1.0
diff --git a/test cases/common/157 wrap file should not failed/subprojects/bar.wrap b/test cases/common/157 wrap file should not failed/subprojects/bar.wrap
new file mode 100644
index 0000000..4e8f7e3
--- /dev/null
+++ b/test cases/common/157 wrap file should not failed/subprojects/bar.wrap
@@ -0,0 +1,8 @@
+[wrap-file]
+directory = bar-1.0
+lead_directory_missing = true
+
+source_filename = bar-1.0.tar.xz
+source_hash = f0f61948530dc0d33e3028cd71a9f8ee869f6b3665960d8f41d715cf4aed6467
+
+patch_filename = bar-1.0-patch.tar.xz
diff --git a/test cases/common/157 wrap file should not failed/subprojects/foo-1.0/foo.c b/test cases/common/157 wrap file should not failed/subprojects/foo-1.0/foo.c
deleted file mode 100644
index 267b43a..0000000
--- a/test cases/common/157 wrap file should not failed/subprojects/foo-1.0/foo.c
+++ /dev/null
@@ -1,3 +0,0 @@
-int dummy_func(void) {
- return 42;
-}
diff --git a/test cases/common/157 wrap file should not failed/subprojects/foo-1.0/meson.build b/test cases/common/157 wrap file should not failed/subprojects/foo-1.0/meson.build
deleted file mode 100644
index 318e81d..0000000
--- a/test cases/common/157 wrap file should not failed/subprojects/foo-1.0/meson.build
+++ /dev/null
@@ -1,2 +0,0 @@
-project('shared lib', 'c')
-libfoo = shared_library('foo', 'foo.c')
diff --git a/test cases/common/157 wrap file should not failed/subprojects/foo.wrap b/test cases/common/157 wrap file should not failed/subprojects/foo.wrap
index 90d6d40..c67c5e5 100644
--- a/test cases/common/157 wrap file should not failed/subprojects/foo.wrap
+++ b/test cases/common/157 wrap file should not failed/subprojects/foo.wrap
@@ -3,9 +3,9 @@ directory = foo-1.0
source_url = http://something.invalid
source_filename = foo-1.0.tar.xz
-source_hash = ae5fc03185654f76b459db16ca25809703f8821aeb39a433902244bb479c4b79
+source_hash = 9ed8f67d75e43d3be161efb6eddf30dd01995a958ca83951ea64234bac8908c1
lead_directory_missing = true
patch_url = https://something.invalid/patch
patch_filename = foo-1.0-patch.tar.xz
-patch_hash = 8f2e286a4b190228d4e0c25ddc91195449cfb5e5c52006355838964b244037da
+patch_hash = d0ddc5e60fdb27d808552f5ac8d0bb603ea2cba306538b4427b985535b26c9c5
diff --git a/test cases/common/157 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xz b/test cases/common/157 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xz
index 26d2927..e26b8e0 100644
--- a/test cases/common/157 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xz
+++ b/test cases/common/157 wrap file should not failed/subprojects/packagecache/foo-1.0-patch.tar.xz
Binary files differ
diff --git a/test cases/common/157 wrap file should not failed/subprojects/packagecache/foo-1.0.tar.xz b/test cases/common/157 wrap file should not failed/subprojects/packagecache/foo-1.0.tar.xz
index 2647ef9..37eb6cc 100644
--- a/test cases/common/157 wrap file should not failed/subprojects/packagecache/foo-1.0.tar.xz
+++ b/test cases/common/157 wrap file should not failed/subprojects/packagecache/foo-1.0.tar.xz
Binary files differ
diff --git a/test cases/common/157 wrap file should not failed/subprojects/packagefiles/bar-1.0-patch.tar.xz b/test cases/common/157 wrap file should not failed/subprojects/packagefiles/bar-1.0-patch.tar.xz
new file mode 100644
index 0000000..f257a19
--- /dev/null
+++ b/test cases/common/157 wrap file should not failed/subprojects/packagefiles/bar-1.0-patch.tar.xz
Binary files differ
diff --git a/test cases/common/157 wrap file should not failed/subprojects/packagefiles/bar-1.0.tar.xz b/test cases/common/157 wrap file should not failed/subprojects/packagefiles/bar-1.0.tar.xz
new file mode 100644
index 0000000..d90a9e8
--- /dev/null
+++ b/test cases/common/157 wrap file should not failed/subprojects/packagefiles/bar-1.0.tar.xz
Binary files differ
diff --git a/test cases/common/157 wrap file should not failed/subprojects/packagefiles/foo-1.0/meson.build b/test cases/common/157 wrap file should not failed/subprojects/packagefiles/foo-1.0/meson.build
new file mode 100644
index 0000000..dbaf91f
--- /dev/null
+++ b/test cases/common/157 wrap file should not failed/subprojects/packagefiles/foo-1.0/meson.build
@@ -0,0 +1,2 @@
+project('static lib patchdir', 'c')
+libfoo = static_library('foo', 'foo.c')
diff --git a/test cases/common/157 wrap file should not failed/subprojects/patchdir.wrap b/test cases/common/157 wrap file should not failed/subprojects/patchdir.wrap
new file mode 100644
index 0000000..1a2134c
--- /dev/null
+++ b/test cases/common/157 wrap file should not failed/subprojects/patchdir.wrap
@@ -0,0 +1,9 @@
+[wrap-file]
+directory = foo-1.0-patchdir
+
+source_url = http://something.invalid
+source_filename = foo-1.0.tar.xz
+source_hash = 9ed8f67d75e43d3be161efb6eddf30dd01995a958ca83951ea64234bac8908c1
+lead_directory_missing = true
+
+patch_directory = foo-1.0
diff --git a/test cases/common/163 disabler/meson.build b/test cases/common/163 disabler/meson.build
index 5554f14..d132e2b 100644
--- a/test cases/common/163 disabler/meson.build
+++ b/test cases/common/163 disabler/meson.build
@@ -9,6 +9,7 @@ d2 = dependency(d)
d3 = (d == d2)
d4 = d + 0
d5 = d2 or true
+set_variable('d6', disabler())
has_not_changed = false
if is_disabler(d)
@@ -23,12 +24,14 @@ assert(is_disabler(d2), 'Function laundered disabler was not identified correctl
assert(is_disabler(d3), 'Disabler comparison should yield disabler.')
assert(is_disabler(d4), 'Disabler addition should yield disabler.')
assert(is_disabler(d5), 'Disabler logic op should yield disabler.')
+assert(is_disabler(d6), 'set_variable with a disabler should set variable to disabler.')
assert(d, 'Disabler did not cause this to be skipped.')
assert(d2, 'Function laundered disabler did not cause this to be skipped.')
assert(d3, 'Disabler comparison should yield disabler and thus this would not be called.')
assert(d4, 'Disabler addition should yield disabler and thus this would not be called.')
assert(d5, 'Disabler logic op should yield disabler and thus this would not be called.')
+assert(d6, 'set_variable with a disabler did not cause this to be skipped.')
number = 0
@@ -80,6 +83,31 @@ else
endif
assert(has_not_changed, 'App has changed.')
+assert(not is_disabler(is_variable('d6')), 'is_variable should not return a disabler')
+assert(is_variable('d6'), 'is_variable for a disabler should return true')
+
+if_is_not_disabled = false
+if is_variable('d6')
+ if_is_not_disabled = true
+else
+ if_is_not_disabled = true
+endif
+assert(if_is_not_disabled, 'Disabler in is_variable should not skip blocks')
+
+get_d = get_variable('d6')
+assert(is_disabler(get_d), 'get_variable should yield a disabler')
+
+get_fallback_d = get_variable('nonexistant', disabler())
+assert(is_disabler(get_fallback_d), 'get_variable fallback should yield a disabler')
+
+var_true = true
+get_no_fallback_d = get_variable('var_true', disabler())
+assert(not is_disabler(get_no_fallback_d), 'get_variable should not fallback to disabler')
+assert(get_no_fallback_d, 'get_variable should yield true')
+
+assert(is_disabler(get_variable(disabler())), 'get_variable should yield a disabler')
+assert(is_disabler(get_variable(disabler(), var_true)), 'get_variable should yield a disabler')
+
if_is_disabled = true
if disabler()
if_is_disabled = false
diff --git a/test cases/common/187 find override/meson.build b/test cases/common/187 find override/meson.build
index 3b8af80..b277459 100644
--- a/test cases/common/187 find override/meson.build
+++ b/test cases/common/187 find override/meson.build
@@ -10,3 +10,6 @@ if not gencodegen.found()
endif
subdir('otherdir')
+
+tool = find_program('sometool')
+assert(tool.found())
diff --git a/test cases/common/187 find override/subprojects/sub.wrap b/test cases/common/187 find override/subprojects/sub.wrap
new file mode 100644
index 0000000..17aa332
--- /dev/null
+++ b/test cases/common/187 find override/subprojects/sub.wrap
@@ -0,0 +1,5 @@
+[wrap-file]
+directory = sub
+
+[provide]
+program_names = sometool
diff --git a/test cases/common/187 find override/subprojects/sub/meson.build b/test cases/common/187 find override/subprojects/sub/meson.build
new file mode 100644
index 0000000..640f270
--- /dev/null
+++ b/test cases/common/187 find override/subprojects/sub/meson.build
@@ -0,0 +1,4 @@
+project('tools')
+
+exe = find_program('gencodegen')
+meson.override_find_program('sometool', exe)
diff --git a/test cases/common/201 override with exe/meson.build b/test cases/common/201 override with exe/meson.build
index 81f6c02..62d2f32 100644
--- a/test cases/common/201 override with exe/meson.build
+++ b/test cases/common/201 override with exe/meson.build
@@ -1,6 +1,10 @@
project('myexe', 'c')
sub = subproject('sub')
-prog = find_program('foobar')
+
+prog = find_program('foobar', version : '>= 2.0', required : false)
+assert(not prog.found())
+
+prog = find_program('foobar', version : '>= 1.0')
custom1 = custom_target('custom1',
build_by_default : true,
input : [],
@@ -11,5 +15,7 @@ gen = generator(prog,
arguments : ['@OUTPUT@'])
custom2 = gen.process('main2.input')
+message(prog.full_path())
+
executable('e1', custom1)
executable('e2', custom2)
diff --git a/test cases/common/201 override with exe/subprojects/sub/meson.build b/test cases/common/201 override with exe/subprojects/sub/meson.build
index 1f186da..f0343b2 100644
--- a/test cases/common/201 override with exe/subprojects/sub/meson.build
+++ b/test cases/common/201 override with exe/subprojects/sub/meson.build
@@ -1,3 +1,3 @@
-project('sub', 'c')
+project('sub', 'c', version : '1.0')
foobar = executable('foobar', 'foobar.c', native : true)
meson.override_find_program('foobar', foobar)
diff --git a/test cases/common/222 source set realistic example/meson.build b/test cases/common/222 source set realistic example/meson.build
index 5b0e495..d986b99 100644
--- a/test cases/common/222 source set realistic example/meson.build
+++ b/test cases/common/222 source set realistic example/meson.build
@@ -1,4 +1,4 @@
-# a sort-of realistic example that combines the sourceset and kconfig
+# a sort-of realistic example that combines the sourceset and keyval
# modules, inspired by QEMU's build system
project('sourceset-example', 'cpp', default_options: ['cpp_std=c++11'])
@@ -9,7 +9,7 @@ if cppid == 'pgi'
endif
ss = import('sourceset')
-kconfig = import('unstable-kconfig')
+keyval = import('keyval')
zlib = declare_dependency(compile_args: '-DZLIB=1')
another = declare_dependency(compile_args: '-DANOTHER=1')
@@ -39,7 +39,7 @@ targets = [ 'arm', 'aarch64', 'x86' ]
target_dirs = { 'arm' : 'arm', 'aarch64' : 'arm', 'x86': 'x86' }
foreach x : targets
- config = kconfig.load('config' / x)
+ config = keyval.load('config' / x)
target_specific = specific.apply(config, strict: false)
target_common = common.apply(config, strict: false)
target_deps = target_specific.dependencies() + target_common.dependencies()
diff --git a/test cases/common/226 include_type dependency/main.cpp b/test cases/common/226 include_type dependency/main.cpp
new file mode 100644
index 0000000..bf8c4a4
--- /dev/null
+++ b/test cases/common/226 include_type dependency/main.cpp
@@ -0,0 +1,8 @@
+#include <iostream>
+#include <boost/graph/filtered_graph.hpp>
+
+using namespace std;
+
+int main(void) {
+ return 0;
+}
diff --git a/test cases/common/226 include_type dependency/meson.build b/test cases/common/226 include_type dependency/meson.build
index fafceaf..d17e920 100644
--- a/test cases/common/226 include_type dependency/meson.build
+++ b/test cases/common/226 include_type dependency/meson.build
@@ -4,10 +4,16 @@ project(
)
dep = dependency('zlib', method: 'pkg-config', required : false)
+boost_dep = dependency('boost', modules: ['graph'], include_type : 'system', required: false)
+
if not dep.found()
error('MESON_SKIP_TEST zlib was not found')
endif
+if not boost_dep.found()
+ error('MESON_SKIP_TEST boost was not found')
+endif
+
assert(dep.include_type() == 'preserve', 'include_type must default to "preserve"')
dep_sys = dep.as_system()
@@ -26,3 +32,7 @@ assert(sp_dep.include_type() == 'preserve', 'default is preserve')
sp_dep_sys = sp_dep.as_system('system')
assert(sp_dep_sys.include_type() == 'system', 'changing include_type works')
assert(sp_dep.include_type() == 'preserve', 'as_system must not mutate the original object')
+
+# Check that PCH works with `include_type : 'system'` See https://github.com/mesonbuild/meson/issues/7167
+main_exe = executable('main_exe', 'main.cpp', cpp_pch: 'pch/test.hpp', dependencies: boost_dep)
+test('main_test', main_exe)
diff --git a/test cases/common/226 include_type dependency/pch/test.hpp b/test cases/common/226 include_type dependency/pch/test.hpp
new file mode 100644
index 0000000..0d40fe1
--- /dev/null
+++ b/test cases/common/226 include_type dependency/pch/test.hpp
@@ -0,0 +1 @@
+#include <boost/graph/filtered_graph.hpp>
diff --git a/test cases/common/230 persubproject options/meson.build b/test cases/common/230 persubproject options/meson.build
index 20dff90..f76a70c 100644
--- a/test cases/common/230 persubproject options/meson.build
+++ b/test cases/common/230 persubproject options/meson.build
@@ -1,9 +1,11 @@
project('persubproject options', 'c',
default_options : ['default_library=both',
- 'werror=true'])
+ 'werror=true',
+ 'warning_level=3'])
assert(get_option('default_library') == 'both', 'Parent default_library should be "both"')
assert(get_option('werror'))
+assert(get_option('warning_level') == '3')
# Check it build both by calling a method only both_libraries target implement
lib = library('lib1', 'foo.c')
diff --git a/test cases/common/230 persubproject options/subprojects/sub1/foo.c b/test cases/common/230 persubproject options/subprojects/sub1/foo.c
index 63e4de6..82ad2c2 100644
--- a/test cases/common/230 persubproject options/subprojects/sub1/foo.c
+++ b/test cases/common/230 persubproject options/subprojects/sub1/foo.c
@@ -1,5 +1,8 @@
int foo(void);
int foo(void) {
+ /* This is built with -Werror, it would error if warning_level=3 was inherited
+ * from main project and not overridden by this subproject's default_options. */
+ int x;
return 0;
}
diff --git a/test cases/common/230 persubproject options/subprojects/sub1/meson.build b/test cases/common/230 persubproject options/subprojects/sub1/meson.build
index 7afc934..4e4bc1b 100644
--- a/test cases/common/230 persubproject options/subprojects/sub1/meson.build
+++ b/test cases/common/230 persubproject options/subprojects/sub1/meson.build
@@ -1,6 +1,8 @@
-project('sub1', 'c')
+project('sub1', 'c',
+ default_options : ['warning_level=0'])
assert(get_option('default_library') == 'both', 'Should inherit parent project default_library')
+assert(get_option('warning_level') == '0')
# Check it build both by calling a method only both_libraries target implement
lib = library('lib1', 'foo.c')
diff --git a/test cases/common/232 link language/c_linkage.cpp b/test cases/common/232 link language/c_linkage.cpp
new file mode 100644
index 0000000..dc006b9
--- /dev/null
+++ b/test cases/common/232 link language/c_linkage.cpp
@@ -0,0 +1,5 @@
+extern "C" {
+ int makeInt(void) {
+ return 0;
+ }
+}
diff --git a/test cases/common/232 link language/c_linkage.h b/test cases/common/232 link language/c_linkage.h
new file mode 100644
index 0000000..1609f47
--- /dev/null
+++ b/test cases/common/232 link language/c_linkage.h
@@ -0,0 +1,10 @@
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int makeInt(void);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/test cases/common/232 link language/lib.cpp b/test cases/common/232 link language/lib.cpp
new file mode 100644
index 0000000..ab43828
--- /dev/null
+++ b/test cases/common/232 link language/lib.cpp
@@ -0,0 +1,5 @@
+extern "C" {
+ int makeInt(void) {
+ return 1;
+ }
+}
diff --git a/test cases/common/232 link language/main.c b/test cases/common/232 link language/main.c
new file mode 100644
index 0000000..5a167e7
--- /dev/null
+++ b/test cases/common/232 link language/main.c
@@ -0,0 +1,5 @@
+#include "c_linkage.h"
+
+int main(void) {
+ return makeInt();
+}
diff --git a/test cases/common/232 link language/meson.build b/test cases/common/232 link language/meson.build
new file mode 100644
index 0000000..f9af6cd
--- /dev/null
+++ b/test cases/common/232 link language/meson.build
@@ -0,0 +1,18 @@
+project(
+ 'link_language',
+ ['c', 'cpp'],
+)
+
+exe = executable(
+ 'main',
+ ['main.c', 'c_linkage.cpp'],
+ link_language : 'c',
+)
+
+lib = library(
+ 'mylib',
+ ['lib.cpp'],
+ link_language : 'c',
+)
+
+test('main', exe)
diff --git a/test cases/common/233 link depends indexed custom target/foo.c b/test cases/common/233 link depends indexed custom target/foo.c
new file mode 100644
index 0000000..58c86a6
--- /dev/null
+++ b/test cases/common/233 link depends indexed custom target/foo.c
@@ -0,0 +1,15 @@
+#include <stdio.h>
+
+int main(void) {
+ const char *fn = DEPFILE;
+ FILE *f = fopen(fn, "r");
+ if (!f) {
+ printf("could not open %s", fn);
+ return 1;
+ }
+ else {
+ printf("successfully opened %s", fn);
+ }
+
+ return 0;
+}
diff --git a/test cases/common/233 link depends indexed custom target/make_file.py b/test cases/common/233 link depends indexed custom target/make_file.py
new file mode 100644
index 0000000..6a43b7d
--- /dev/null
+++ b/test cases/common/233 link depends indexed custom target/make_file.py
@@ -0,0 +1,8 @@
+#!/usr/bin/env python3
+import sys
+
+with open(sys.argv[1], 'w') as f:
+ print('# this file does nothing', file=f)
+
+with open(sys.argv[2], 'w') as f:
+ print('# this file does nothing', file=f)
diff --git a/test cases/common/233 link depends indexed custom target/meson.build b/test cases/common/233 link depends indexed custom target/meson.build
new file mode 100644
index 0000000..5c066e9
--- /dev/null
+++ b/test cases/common/233 link depends indexed custom target/meson.build
@@ -0,0 +1,19 @@
+project('link_depends_indexed_custom_target', 'c')
+
+if meson.backend().startswith('vs')
+ # FIXME: Broken on the VS backends
+ error('MESON_SKIP_TEST see https://github.com/mesonbuild/meson/issues/1799')
+endif
+
+cmd = find_program('make_file.py')
+
+dep_files = custom_target('gen_dep',
+ command: [cmd, '@OUTPUT@'],
+ output: ['dep_file1', 'dep_file2'])
+
+exe = executable('foo', 'foo.c',
+ link_depends: dep_files[1],
+ c_args: ['-DDEPFILE="' + dep_files[0].full_path()+ '"'])
+
+# check that dep_file1 exists, which means that link_depends target ran
+test('runtest', exe)
diff --git a/test cases/common/234 very long commmand line/codegen.py b/test cases/common/234 very long commmand line/codegen.py
new file mode 100755
index 0000000..4de78ce
--- /dev/null
+++ b/test cases/common/234 very long commmand line/codegen.py
@@ -0,0 +1,6 @@
+#!/usr/bin/env python3
+
+import sys
+
+with open(sys.argv[2], 'w') as f:
+ print('int func{n}(void) {{ return {n}; }}'.format(n=sys.argv[1]), file=f)
diff --git a/test cases/common/234 very long commmand line/main.c b/test cases/common/234 very long commmand line/main.c
new file mode 100644
index 0000000..dbb64a8
--- /dev/null
+++ b/test cases/common/234 very long commmand line/main.c
@@ -0,0 +1,5 @@
+int main(int argc, char **argv) {
+ (void) argc;
+ (void) argv;
+ return 0;
+}
diff --git a/test cases/common/234 very long commmand line/meson.build b/test cases/common/234 very long commmand line/meson.build
new file mode 100644
index 0000000..fe47b5e
--- /dev/null
+++ b/test cases/common/234 very long commmand line/meson.build
@@ -0,0 +1,44 @@
+project('very long command lines', 'c')
+
+# Get the current system's commandline length limit.
+if build_machine.system() == 'windows'
+ # Various limits on windows:
+ # cmd.exe: 8kb
+ # CreateProcess: 32kb
+ limit = 32767
+elif build_machine.system() == 'cygwin'
+ # cygwin-to-win32: see above
+ # cygwin-to-cygwin: no limit?
+ # Cygwin is slow, so only test it lightly here.
+ limit = 8192
+else
+ # ninja passes whole line as a single argument, for which
+ # the limit is 128k as of Linux 2.6.23. See MAX_ARG_STRLEN.
+ # BSD seems similar, see https://www.in-ulm.de/~mascheck/various/argmax
+ limit = 131072
+endif
+# Now exceed that limit, but not so far that the test takes too long.
+name = 'ALongFilenameMuchLongerThanIsNormallySeenAndReallyHardToReadThroughToTheEndAMooseOnceBitMySisterSheNowWorksAtLLamaFreshFarmsThisHasToBeSoLongThatWeExceed128KBWithoutCompilingTooManyFiles'
+namelen = 187
+nfiles = 50 + limit / namelen
+message('Expected link commandline length is approximately ' + '@0@'.format((nfiles * (namelen+28))))
+
+seq = run_command('seq.py', '1', '@0@'.format(nfiles)).stdout().strip().split('\n')
+
+sources = []
+codegen = find_program('codegen.py')
+
+foreach i : seq
+ sources += custom_target('codegen' + i,
+ command: [codegen, i, '@OUTPUT@'],
+ output: name + i + '.c')
+endforeach
+
+shared_library('sharedlib', sources)
+static_library('staticlib', sources)
+executable('app', 'main.c', sources)
+
+# Also test short commandlines to make sure that doesn't regress
+shared_library('sharedlib0', sources[0])
+static_library('staticlib0', sources[0])
+executable('app0', 'main.c', sources[0])
diff --git a/test cases/common/234 very long commmand line/seq.py b/test cases/common/234 very long commmand line/seq.py
new file mode 100755
index 0000000..637bf57
--- /dev/null
+++ b/test cases/common/234 very long commmand line/seq.py
@@ -0,0 +1,6 @@
+#!/usr/bin/env python3
+
+import sys
+
+for i in range(int(sys.argv[1]), int(sys.argv[2])):
+ print(i)
diff --git a/test cases/common/36 tryrun/meson.build b/test cases/common/36 tryrun/meson.build
index 261adf2..5580974 100644
--- a/test cases/common/36 tryrun/meson.build
+++ b/test cases/common/36 tryrun/meson.build
@@ -2,7 +2,7 @@ project('tryrun', 'c', 'cpp')
# Complex to exercise all code paths.
if meson.is_cross_build()
- if meson.has_exe_wrapper()
+ if meson.can_run_host_binaries()
compilers = [meson.get_compiler('c', native : false), meson.get_compiler('cpp', native : false)]
else
compilers = [meson.get_compiler('c', native : true), meson.get_compiler('cpp', native : true)]
diff --git a/test cases/common/38 string operations/meson.build b/test cases/common/38 string operations/meson.build
index 6596142..8a06a82 100644
--- a/test cases/common/38 string operations/meson.build
+++ b/test cases/common/38 string operations/meson.build
@@ -101,3 +101,18 @@ assert('\\\\n' == bs_bs_n, 'Four backslash broken before n')
assert('\\\\\n' == bs_bs_nl, 'Five backslash broken before n')
assert('\\\\' == bs_bs, 'Double-backslash broken')
assert('\\' == bs, 'Backslash broken')
+
+mysubstring='foobarbaz'
+assert(mysubstring.substring() == 'foobarbaz', 'substring is broken')
+assert(mysubstring.substring(0) == 'foobarbaz', 'substring is broken')
+assert(mysubstring.substring(1) == 'oobarbaz', 'substring is broken')
+assert(mysubstring.substring(-5) == 'arbaz', 'substring is broken')
+assert(mysubstring.substring(1, 4) == 'oob', 'substring is broken')
+assert(mysubstring.substring(1,-5) == 'oob', 'substring is broken')
+assert(mysubstring.substring(1, 0) == '', 'substring is broken')
+assert(mysubstring.substring(0, 100) == 'foobarbaz', 'substring is broken')
+assert(mysubstring.substring(-1, -5) == '', 'substring is broken')
+assert(mysubstring.substring(10, -25) == '', 'substring is broken')
+assert(mysubstring.substring(-4, 2) == '', 'substring is broken')
+assert(mysubstring.substring(10, 9) == '', 'substring is broken')
+assert(mysubstring.substring(8, 10) == 'z', 'substring is broken')
diff --git a/test cases/common/43 options/meson_options.txt b/test cases/common/43 options/meson_options.txt
index c5986ba..db649de 100644
--- a/test cases/common/43 options/meson_options.txt
+++ b/test cases/common/43 options/meson_options.txt
@@ -1,7 +1,7 @@
-option('testoption', type : 'string', value : 'optval', description : 'An option to do something')
+option('testoption', type : 'string', value : 'optval', description : 'An option ' + 'to do something')
option('other_one', type : 'boolean', value : not (not (not (not false))))
-option('combo_opt', type : 'combo', choices : ['one', 'two', 'combo'], value : 'combo')
+option('combo_opt', type : 'co' + 'mbo', choices : ['one', 'two', 'combo'], value : 'combo')
option('array_opt', type : 'array', choices : ['one', 'two', 'three'], value : ['one', 'two'])
option('free_array_opt', type : 'array')
option('integer_opt', type : 'integer', min : 0, max : -(-5), value : 3)
-option('neg_int_opt', type : 'integer', min : -5, max : 5, value : -3)
+option('neg' + '_' + 'int' + '_' + 'opt', type : 'integer', min : -5, max : 5, value : -3)
diff --git a/test cases/common/47 pkgconfig-gen/dependencies/main.c b/test cases/common/47 pkgconfig-gen/dependencies/main.c
index 61708d3..397d40c 100644
--- a/test cases/common/47 pkgconfig-gen/dependencies/main.c
+++ b/test cases/common/47 pkgconfig-gen/dependencies/main.c
@@ -1,5 +1,9 @@
#include <simple.h>
+#ifndef LIBFOO
+#error LIBFOO should be defined in pkgconfig cflags
+#endif
+
int main(int argc, char *argv[])
{
return simple_function() == 42 ? 0 : 1;
diff --git a/test cases/common/47 pkgconfig-gen/meson.build b/test cases/common/47 pkgconfig-gen/meson.build
index c251b9f..8c16cd5 100644
--- a/test cases/common/47 pkgconfig-gen/meson.build
+++ b/test cases/common/47 pkgconfig-gen/meson.build
@@ -1,5 +1,12 @@
project('pkgconfig-gen', 'c')
+# Some CI runners does not have zlib, just skip them as we need some common
+# external dependency.
+cc = meson.get_compiler('c')
+if not cc.find_library('z', required: false).found()
+ error('MESON_SKIP_TEST: zlib missing')
+endif
+
# First check we have pkg-config >= 0.29
pkgconfig = find_program('pkg-config', required: false)
if not pkgconfig.found()
@@ -43,7 +50,8 @@ pkgg.generate(
name : 'libfoo',
version : libver,
description : 'A foo library.',
- variables : ['foo=bar', 'datadir=${prefix}/data']
+ variables : ['foo=bar', 'datadir=${prefix}/data'],
+ extra_cflags : ['-DLIBFOO'],
)
pkgg.generate(
@@ -58,3 +66,32 @@ pkgg.generate(
version : libver,
dataonly: true
)
+
+# Regression test for 2 cases:
+# - link_whole from InternalDependency used to be ignored, but we should still
+# recurse to add libraries they link to. In this case it must add `-lsimple1`
+# in generated pc file.
+# - dependencies from InternalDependency used to be ignored. In this it must add
+# `-lz` in generated pc file.
+simple1 = shared_library('simple1', 'simple.c')
+stat1 = static_library('stat1', 'simple.c', link_with: simple1)
+dep = declare_dependency(link_whole: stat1, dependencies: cc.find_library('z'))
+simple2 = library('simple2', 'simple.c')
+pkgg.generate(simple2, libraries: dep)
+
+# Regression test: as_system() does a deepcopy() of the InternalDependency object
+# which caused `-lsimple3` to be duplicated because generator used to compare
+# Target instances instead of their id.
+simple3 = shared_library('simple3', 'simple.c')
+dep1 = declare_dependency(link_with: simple3)
+dep2 = dep1.as_system()
+pkgg.generate(libraries: [dep1, dep2],
+ name: 'simple3',
+ description: 'desc')
+
+# Regression test: stat2 is both link_with and link_whole, it should not appear
+# in generated pc file.
+stat2 = static_library('stat2', 'simple.c', install: true)
+simple4 = library('simple4', 'simple.c', link_with: stat2)
+simple5 = library('simple5', 'simple5.c', link_with: simple4, link_whole: stat2)
+pkgg.generate(simple5)
diff --git a/test cases/common/47 pkgconfig-gen/simple5.c b/test cases/common/47 pkgconfig-gen/simple5.c
new file mode 100644
index 0000000..9f924bd
--- /dev/null
+++ b/test cases/common/47 pkgconfig-gen/simple5.c
@@ -0,0 +1,6 @@
+int simple5(void);
+
+int simple5(void)
+{
+ return 0;
+}
diff --git a/test cases/common/47 pkgconfig-gen/test.json b/test cases/common/47 pkgconfig-gen/test.json
index 1c6a452..702e7fe 100644
--- a/test cases/common/47 pkgconfig-gen/test.json
+++ b/test cases/common/47 pkgconfig-gen/test.json
@@ -1,9 +1,13 @@
{
"installed": [
{"type": "file", "file": "usr/include/simple.h"},
+ {"type": "file", "file": "usr/lib/libstat2.a"},
{"type": "file", "file": "usr/lib/pkgconfig/simple.pc"},
{"type": "file", "file": "usr/lib/pkgconfig/libfoo.pc"},
{"type": "file", "file": "usr/lib/pkgconfig/libhello.pc"},
- {"type": "file", "file": "usr/lib/pkgconfig/libhello_nolib.pc"}
+ {"type": "file", "file": "usr/lib/pkgconfig/libhello_nolib.pc"},
+ {"type": "file", "file": "usr/lib/pkgconfig/simple2.pc"},
+ {"type": "file", "file": "usr/lib/pkgconfig/simple3.pc"},
+ {"type": "file", "file": "usr/lib/pkgconfig/simple5.pc"}
]
}
diff --git a/test cases/common/56 install script/customtarget.py b/test cases/common/56 install script/customtarget.py
new file mode 100755
index 0000000..e28373a
--- /dev/null
+++ b/test cases/common/56 install script/customtarget.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+
+import argparse
+import os
+
+
+def main() -> None:
+ parser = argparse.ArgumentParser()
+ parser.add_argument('dirname')
+ args = parser.parse_args()
+
+ with open(os.path.join(args.dirname, '1.txt'), 'w') as f:
+ f.write('')
+ with open(os.path.join(args.dirname, '2.txt'), 'w') as f:
+ f.write('')
+
+
+if __name__ == "__main__":
+ main()
diff --git a/test cases/common/56 install script/meson.build b/test cases/common/56 install script/meson.build
index 6351518..e80e666 100644
--- a/test cases/common/56 install script/meson.build
+++ b/test cases/common/56 install script/meson.build
@@ -5,3 +5,29 @@ meson.add_install_script('myinstall.py', 'diiba/daaba', 'file.dat')
meson.add_install_script('myinstall.py', 'this/should', 'also-work.dat')
subdir('src')
+
+meson.add_install_script('myinstall.py', 'dir', afile, '--mode=copy')
+
+data = configuration_data()
+data.set10('foo', true)
+conf = configure_file(
+ configuration : data,
+ output : 'conf.txt'
+)
+
+meson.add_install_script('myinstall.py', 'dir', conf, '--mode=copy')
+
+t = custom_target(
+ 'ct',
+ command : [find_program('customtarget.py'), '@OUTDIR@'],
+ output : ['1.txt', '2.txt'],
+)
+
+meson.add_install_script('myinstall.py', 'customtarget', t, '--mode=copy')
+meson.add_install_script('myinstall.py', 'customtargetindex', t[0], '--mode=copy')
+
+meson.add_install_script(exe, 'generated.txt')
+wrap = find_program('wrap.py')
+# Yes, these are getting silly
+meson.add_install_script(wrap, exe, 'wrapped.txt')
+meson.add_install_script(wrap, wrap, exe, 'wrapped2.txt')
diff --git a/test cases/common/56 install script/myinstall.py b/test cases/common/56 install script/myinstall.py
index 812561e..a573342 100644
--- a/test cases/common/56 install script/myinstall.py
+++ b/test cases/common/56 install script/myinstall.py
@@ -1,12 +1,31 @@
#!/usr/bin/env python3
+import argparse
import os
-import sys
+import shutil
prefix = os.environ['MESON_INSTALL_DESTDIR_PREFIX']
-dirname = os.path.join(prefix, sys.argv[1])
-os.makedirs(dirname)
-with open(os.path.join(dirname, sys.argv[2]), 'w') as f:
- f.write('')
+def main() -> None:
+ parser = argparse.ArgumentParser()
+ parser.add_argument('dirname')
+ parser.add_argument('files', nargs='+')
+ parser.add_argument('--mode', action='store', default='create', choices=['create', 'copy'])
+ args = parser.parse_args()
+
+ dirname = os.path.join(prefix, args.dirname)
+ if not os.path.exists(dirname):
+ os.makedirs(dirname)
+
+ if args.mode == 'create':
+ for name in args.files:
+ with open(os.path.join(dirname, name), 'w') as f:
+ f.write('')
+ else:
+ for name in args.files:
+ shutil.copy(name, dirname)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/test cases/common/56 install script/src/a file.txt b/test cases/common/56 install script/src/a file.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test cases/common/56 install script/src/a file.txt
diff --git a/test cases/common/56 install script/src/exe.c b/test cases/common/56 install script/src/exe.c
new file mode 100644
index 0000000..b573b91
--- /dev/null
+++ b/test cases/common/56 install script/src/exe.c
@@ -0,0 +1,24 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int main(int argc, char * argv[]) {
+ if (argc != 2) {
+ fprintf(stderr, "Takes exactly 2 arguments\n");
+ return 1;
+ }
+
+ char * dirname = getenv("MESON_INSTALL_DESTDIR_PREFIX");
+ char * fullname = malloc(strlen(dirname) + 1 + strlen(argv[1]) + 1);
+ strcpy(fullname, dirname);
+ strcat(fullname, "/");
+ strcat(fullname, argv[1]);
+
+ FILE * fp = fopen(fullname, "w");
+ fputs("Some text\n", fp);
+ fclose(fp);
+
+ free(fullname);
+
+ return 0;
+}
diff --git a/test cases/common/56 install script/src/meson.build b/test cases/common/56 install script/src/meson.build
index b23574a..1db424f 100644
--- a/test cases/common/56 install script/src/meson.build
+++ b/test cases/common/56 install script/src/meson.build
@@ -1 +1,5 @@
meson.add_install_script('myinstall.py', 'this/does', 'something-different.dat')
+
+afile = files('a file.txt')
+
+exe = executable('exe', 'exe.c', install : false, native : true)
diff --git a/test cases/common/56 install script/src/myinstall.py b/test cases/common/56 install script/src/myinstall.py
index 3b7ce37..3a9d89b 100644
--- a/test cases/common/56 install script/src/myinstall.py
+++ b/test cases/common/56 install script/src/myinstall.py
@@ -7,6 +7,8 @@ prefix = os.environ['MESON_INSTALL_DESTDIR_PREFIX']
dirname = os.path.join(prefix, sys.argv[1])
-os.makedirs(dirname)
+if not os.path.exists(dirname):
+ os.makedirs(dirname)
+
with open(os.path.join(dirname, sys.argv[2] + '.in'), 'w') as f:
f.write('')
diff --git a/test cases/common/56 install script/test.json b/test cases/common/56 install script/test.json
index d17625f..b2a5971 100644
--- a/test cases/common/56 install script/test.json
+++ b/test cases/common/56 install script/test.json
@@ -4,6 +4,14 @@
{"type": "pdb", "file": "usr/bin/prog"},
{"type": "file", "file": "usr/diiba/daaba/file.dat"},
{"type": "file", "file": "usr/this/should/also-work.dat"},
- {"type": "file", "file": "usr/this/does/something-different.dat.in"}
+ {"type": "file", "file": "usr/this/does/something-different.dat.in"},
+ {"type": "file", "file": "usr/dir/a file.txt"},
+ {"type": "file", "file": "usr/dir/conf.txt"},
+ {"type": "file", "file": "usr/customtarget/1.txt"},
+ {"type": "file", "file": "usr/customtarget/2.txt"},
+ {"type": "file", "file": "usr/customtargetindex/1.txt"},
+ {"type": "file", "file": "usr/generated.txt"},
+ {"type": "file", "file": "usr/wrapped.txt"},
+ {"type": "file", "file": "usr/wrapped2.txt"}
]
}
diff --git a/test cases/common/56 install script/wrap.py b/test cases/common/56 install script/wrap.py
new file mode 100755
index 0000000..87508e0
--- /dev/null
+++ b/test cases/common/56 install script/wrap.py
@@ -0,0 +1,6 @@
+#!/usr/bin/env python3
+
+import subprocess
+import sys
+
+subprocess.run(sys.argv[1:])
diff --git a/test cases/common/93 selfbuilt custom/meson.build b/test cases/common/93 selfbuilt custom/meson.build
index 3cc3906..b536352 100644
--- a/test cases/common/93 selfbuilt custom/meson.build
+++ b/test cases/common/93 selfbuilt custom/meson.build
@@ -26,7 +26,7 @@ ctlib = custom_target('ctlib',
build_by_default : true,
)
-if meson.is_cross_build() and meson.has_exe_wrapper()
+if meson.is_cross_build() and meson.can_run_host_binaries()
checkarg_host = executable('checkarg_host', 'checkarg.cpp')
ctlib_host = custom_target(