diff options
author | James Hilliard <james.hilliard1@gmail.com> | 2019-08-14 11:26:30 -0600 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2019-08-23 12:23:43 +0000 |
commit | 315ab997b49bba92c958a88f5eebe7aa232739f8 (patch) | |
tree | 3e404b9f2fe56bb3f6ac3ec7639262910e90851e | |
parent | ab5bb8bcba7651628571c795b54401574fdaa9b2 (diff) | |
download | meson-315ab997b49bba92c958a88f5eebe7aa232739f8.zip meson-315ab997b49bba92c958a88f5eebe7aa232739f8.tar.gz meson-315ab997b49bba92c958a88f5eebe7aa232739f8.tar.bz2 |
Add tests for sources that are disablers.
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
-rw-r--r-- | test cases/common/156 index customtarget/meson.build | 19 | ||||
-rw-r--r-- | test cases/common/2 cpp/meson.build | 12 | ||||
-rw-r--r-- | test cases/common/52 custom target/meson.build | 34 | ||||
-rw-r--r-- | test cases/common/54 run target/meson.build | 8 | ||||
-rw-r--r-- | test cases/common/9 header install/meson.build | 1 |
5 files changed, 74 insertions, 0 deletions
diff --git a/test cases/common/156 index customtarget/meson.build b/test cases/common/156 index customtarget/meson.build index b06ceea..efddfac 100644 --- a/test cases/common/156 index customtarget/meson.build +++ b/test cases/common/156 index customtarget/meson.build @@ -59,3 +59,22 @@ custom_target( ) subdir('subdir') + +gen = disabler() + +assert(is_disabler(gen), 'Generator is not a disabler.') + +lib = static_library( + 'libfoo', + ['lib.c', gen[1]], +) + +assert(is_disabler(lib), 'Static library is not a disabler.') + +if lib.found() + lib_disabled = false +else + lib_disabled = true +endif + +assert(lib_disabled, 'Static library was not disabled.') diff --git a/test cases/common/2 cpp/meson.build b/test cases/common/2 cpp/meson.build index 23c8e72..de8b98e 100644 --- a/test cases/common/2 cpp/meson.build +++ b/test cases/common/2 cpp/meson.build @@ -20,3 +20,15 @@ endif assert(has_not_changed, 'Executable has changed.') assert(not is_disabler(exe), 'Executable is a disabler.') + +exe = executable('trivialprog', 'trivial.cc', extra_files : disabler()) + +assert(is_disabler(exe), 'Executable is not a disabler.') + +if exe.found() + exe_disabled = false +else + exe_disabled = true +endif + +assert(exe_disabled, 'Executable was not disabled.') diff --git a/test cases/common/52 custom target/meson.build b/test cases/common/52 custom target/meson.build index 824ab48..9c7443c 100644 --- a/test cases/common/52 custom target/meson.build +++ b/test cases/common/52 custom target/meson.build @@ -29,4 +29,38 @@ assert(has_not_changed, 'Custom target has changed.') assert(not is_disabler(mytarget), 'Custom target is a disabler.') +mytarget_disabler = custom_target('bindat', +output : 'data.dat', +input : 'data_source.txt', +command : [disabler(), comp, '--input=@INPUT@', '--output=@OUTPUT@', useless], +install : true, +install_dir : 'subdir' +) + +if mytarget_disabler.found() + mytarget_disabled = false +else + mytarget_disabled = true +endif + +assert(mytarget_disabled, 'Disabled custom target should not be found.') + +mytarget_disabler = custom_target('bindat', +output : 'data.dat', +input : disabler(), +command : [python, comp, '--input=@INPUT@', '--output=@OUTPUT@', useless], +install : true, +install_dir : 'subdir' +) + +assert(is_disabler(mytarget_disabler), 'Disabled custom target is not a disabler.') + +if mytarget_disabler.found() + mytarget_disabled = false +else + mytarget_disabled = true +endif + +assert(mytarget_disabled, 'Disabled custom target should not be found.') + subdir('depfile') diff --git a/test cases/common/54 run target/meson.build b/test cases/common/54 run target/meson.build index 93a4ad0..0aab694 100644 --- a/test cases/common/54 run target/meson.build +++ b/test cases/common/54 run target/meson.build @@ -41,6 +41,14 @@ run_target('py3hi', run_target('check_exists', command : [find_program('check_exists.py'), files('helloprinter.c')]) +run_target('check_exists', + command : [find_program('check_exists.py'), files('helloprinter.c')], + depends : disabler(), +) + +run_target('check_exists', + command : [disabler(), files('helloprinter.c')]) + # What if the output of a custom_target is the command to # execute. Obviously this will not work as hex is not an # executable but test that the output is generated correctly. diff --git a/test cases/common/9 header install/meson.build b/test cases/common/9 header install/meson.build index 7dfbddb..891cb59 100644 --- a/test cases/common/9 header install/meson.build +++ b/test cases/common/9 header install/meson.build @@ -8,4 +8,5 @@ subdir('sub') h1 = install_headers('rootdir.h') h2 = install_headers(as_array, subdir : 'subdir') h3 = install_headers(subheader) +h4 = install_headers(disabler()) |