summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Hilliard <james.hilliard1@gmail.com>2019-08-14 11:26:30 -0600
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2019-08-23 12:23:43 +0000
commit315ab997b49bba92c958a88f5eebe7aa232739f8 (patch)
tree3e404b9f2fe56bb3f6ac3ec7639262910e90851e
parentab5bb8bcba7651628571c795b54401574fdaa9b2 (diff)
downloadmeson-315ab997b49bba92c958a88f5eebe7aa232739f8.tar.gz
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.build19
-rw-r--r--test cases/common/2 cpp/meson.build12
-rw-r--r--test cases/common/52 custom target/meson.build34
-rw-r--r--test cases/common/54 run target/meson.build8
-rw-r--r--test cases/common/9 header install/meson.build1
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 b06ceea7f..efddfaca3 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 23c8e72ea..de8b98e54 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 824ab48ca..9c7443c1b 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 93a4ad0f2..0aab69439 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 7dfbddbf4..891cb596b 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())