aboutsummaryrefslogtreecommitdiff
path: root/test cases
diff options
context:
space:
mode:
authorNiklas Claesson <nicke.claesson@gmail.com>2017-12-22 00:47:46 +0100
committerNiklas Claesson <nicke.claesson@gmail.com>2017-12-22 00:59:02 +0100
commitd1d2aa221380d2035de8aa39637e621d7ee9e570 (patch)
tree267a561e5bf4022fa0dc4ccc607404210e29aebc /test cases
parentb437977a608038cf754aba41346efa390411302e (diff)
downloadmeson-d1d2aa221380d2035de8aa39637e621d7ee9e570.zip
meson-d1d2aa221380d2035de8aa39637e621d7ee9e570.tar.gz
meson-d1d2aa221380d2035de8aa39637e621d7ee9e570.tar.bz2
subproject handling: add two tests
Diffstat (limited to 'test cases')
-rw-r--r--test cases/failing/68 subproj different versions/main.c9
-rw-r--r--test cases/failing/68 subproj different versions/meson.build9
-rw-r--r--test cases/failing/68 subproj different versions/subprojects/a/a.c5
-rw-r--r--test cases/failing/68 subproj different versions/subprojects/a/a.h1
-rw-r--r--test cases/failing/68 subproj different versions/subprojects/a/meson.build11
-rw-r--r--test cases/failing/68 subproj different versions/subprojects/b/b.c5
-rw-r--r--test cases/failing/68 subproj different versions/subprojects/b/b.h1
-rw-r--r--test cases/failing/68 subproj different versions/subprojects/b/meson.build11
-rw-r--r--test cases/failing/68 subproj different versions/subprojects/c/c.h3
-rw-r--r--test cases/failing/68 subproj different versions/subprojects/c/meson.build5
-rw-r--r--test cases/linuxlike/12 subprojects in subprojects/main.c9
-rw-r--r--test cases/linuxlike/12 subprojects in subprojects/meson.build9
-rw-r--r--test cases/linuxlike/12 subprojects in subprojects/subprojects/a/a.c5
-rw-r--r--test cases/linuxlike/12 subprojects in subprojects/subprojects/a/a.h1
-rw-r--r--test cases/linuxlike/12 subprojects in subprojects/subprojects/a/meson.build11
-rw-r--r--test cases/linuxlike/12 subprojects in subprojects/subprojects/b/b.c11
-rw-r--r--test cases/linuxlike/12 subprojects in subprojects/subprojects/b/b.h1
-rw-r--r--test cases/linuxlike/12 subprojects in subprojects/subprojects/b/meson.build17
-rw-r--r--test cases/linuxlike/12 subprojects in subprojects/subprojects/c/c.h3
-rw-r--r--test cases/linuxlike/12 subprojects in subprojects/subprojects/c/meson.build5
-rw-r--r--test cases/linuxlike/5 dependency versions/meson.build5
21 files changed, 137 insertions, 0 deletions
diff --git a/test cases/failing/68 subproj different versions/main.c b/test cases/failing/68 subproj different versions/main.c
new file mode 100644
index 0000000..8793c62
--- /dev/null
+++ b/test cases/failing/68 subproj different versions/main.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+#include "a.h"
+#include "b.h"
+
+int main(int argc, char **argv) {
+ int life = a_fun() + b_fun();
+ printf("%d\n", life);
+ return 0;
+}
diff --git a/test cases/failing/68 subproj different versions/meson.build b/test cases/failing/68 subproj different versions/meson.build
new file mode 100644
index 0000000..7690277
--- /dev/null
+++ b/test cases/failing/68 subproj different versions/meson.build
@@ -0,0 +1,9 @@
+project('super', 'c')
+
+# A will use version 1 of C
+a_dep = dependency('a', fallback: ['a', 'a_dep'])
+
+# B will fail becuase it requests version 2 of C
+b_dep = dependency('b', fallback: ['b', 'b_dep'])
+
+main = executable('main', files('main.c'), dependencies: [a_dep, b_dep])
diff --git a/test cases/failing/68 subproj different versions/subprojects/a/a.c b/test cases/failing/68 subproj different versions/subprojects/a/a.c
new file mode 100644
index 0000000..cd41a65
--- /dev/null
+++ b/test cases/failing/68 subproj different versions/subprojects/a/a.c
@@ -0,0 +1,5 @@
+#include "c.h"
+
+int a_fun() {
+ return c_fun();
+}
diff --git a/test cases/failing/68 subproj different versions/subprojects/a/a.h b/test cases/failing/68 subproj different versions/subprojects/a/a.h
new file mode 100644
index 0000000..8f1d49e
--- /dev/null
+++ b/test cases/failing/68 subproj different versions/subprojects/a/a.h
@@ -0,0 +1 @@
+int a_fun();
diff --git a/test cases/failing/68 subproj different versions/subprojects/a/meson.build b/test cases/failing/68 subproj different versions/subprojects/a/meson.build
new file mode 100644
index 0000000..e84182a
--- /dev/null
+++ b/test cases/failing/68 subproj different versions/subprojects/a/meson.build
@@ -0,0 +1,11 @@
+project('a', 'c')
+
+c_dep = dependency('c', version:'1', fallback: ['c', 'c_dep'])
+
+alib = library('a', 'a.c',
+ dependencies: c_dep)
+
+a_dep = declare_dependency(
+ link_with: alib,
+ include_directories: include_directories('.'),
+)
diff --git a/test cases/failing/68 subproj different versions/subprojects/b/b.c b/test cases/failing/68 subproj different versions/subprojects/b/b.c
new file mode 100644
index 0000000..f85f8c3
--- /dev/null
+++ b/test cases/failing/68 subproj different versions/subprojects/b/b.c
@@ -0,0 +1,5 @@
+#include "c.h"
+
+int b_fun(){
+return c_fun();
+}
diff --git a/test cases/failing/68 subproj different versions/subprojects/b/b.h b/test cases/failing/68 subproj different versions/subprojects/b/b.h
new file mode 100644
index 0000000..eced786
--- /dev/null
+++ b/test cases/failing/68 subproj different versions/subprojects/b/b.h
@@ -0,0 +1 @@
+int b_fun();
diff --git a/test cases/failing/68 subproj different versions/subprojects/b/meson.build b/test cases/failing/68 subproj different versions/subprojects/b/meson.build
new file mode 100644
index 0000000..0398340
--- /dev/null
+++ b/test cases/failing/68 subproj different versions/subprojects/b/meson.build
@@ -0,0 +1,11 @@
+project('b', 'c')
+
+c_dep = dependency('c', version:'2', fallback: ['c', 'c_dep'])
+
+blib = library('b', 'b.c',
+ dependencies: c_dep)
+
+b_dep = declare_dependency(
+ link_with: blib,
+ include_directories: include_directories('.'),
+)
diff --git a/test cases/failing/68 subproj different versions/subprojects/c/c.h b/test cases/failing/68 subproj different versions/subprojects/c/c.h
new file mode 100644
index 0000000..2b15f60
--- /dev/null
+++ b/test cases/failing/68 subproj different versions/subprojects/c/c.h
@@ -0,0 +1,3 @@
+static int c_fun(){
+ return 3;
+}
diff --git a/test cases/failing/68 subproj different versions/subprojects/c/meson.build b/test cases/failing/68 subproj different versions/subprojects/c/meson.build
new file mode 100644
index 0000000..7184933
--- /dev/null
+++ b/test cases/failing/68 subproj different versions/subprojects/c/meson.build
@@ -0,0 +1,5 @@
+project('c', 'c', version:'1')
+
+c_dep = declare_dependency(
+ include_directories: include_directories('.')
+)
diff --git a/test cases/linuxlike/12 subprojects in subprojects/main.c b/test cases/linuxlike/12 subprojects in subprojects/main.c
new file mode 100644
index 0000000..8793c62
--- /dev/null
+++ b/test cases/linuxlike/12 subprojects in subprojects/main.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+#include "a.h"
+#include "b.h"
+
+int main(int argc, char **argv) {
+ int life = a_fun() + b_fun();
+ printf("%d\n", life);
+ return 0;
+}
diff --git a/test cases/linuxlike/12 subprojects in subprojects/meson.build b/test cases/linuxlike/12 subprojects in subprojects/meson.build
new file mode 100644
index 0000000..4014149
--- /dev/null
+++ b/test cases/linuxlike/12 subprojects in subprojects/meson.build
@@ -0,0 +1,9 @@
+project('super', 'c')
+
+# A will use version 1 of C
+a_dep = dependency('a', fallback: ['a', 'a_dep'])
+
+# B has an optional dependency on C version 2 and will therefore work
+b_dep = dependency('b', fallback: ['b', 'b_dep'])
+
+main = executable('main', files('main.c'), dependencies: [a_dep, b_dep])
diff --git a/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/a.c b/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/a.c
new file mode 100644
index 0000000..cd41a65
--- /dev/null
+++ b/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/a.c
@@ -0,0 +1,5 @@
+#include "c.h"
+
+int a_fun() {
+ return c_fun();
+}
diff --git a/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/a.h b/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/a.h
new file mode 100644
index 0000000..8f1d49e
--- /dev/null
+++ b/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/a.h
@@ -0,0 +1 @@
+int a_fun();
diff --git a/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/meson.build b/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/meson.build
new file mode 100644
index 0000000..5f579a3
--- /dev/null
+++ b/test cases/linuxlike/12 subprojects in subprojects/subprojects/a/meson.build
@@ -0,0 +1,11 @@
+project('a', 'c', version:'1.0')
+
+c_dep = dependency('c', version:'1', fallback: ['c', 'c_dep'])
+
+alib = library('a', 'a.c',
+ dependencies: c_dep)
+
+a_dep = declare_dependency(
+ link_with: alib,
+ include_directories: include_directories('.'),
+)
diff --git a/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/b.c b/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/b.c
new file mode 100644
index 0000000..4824285
--- /dev/null
+++ b/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/b.c
@@ -0,0 +1,11 @@
+#if defined(WITH_C)
+#include "c.h"
+#endif
+
+int b_fun(){
+#if defined(WITH_C)
+return c_fun();
+#else
+return 0;
+#endif
+}
diff --git a/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/b.h b/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/b.h
new file mode 100644
index 0000000..eced786
--- /dev/null
+++ b/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/b.h
@@ -0,0 +1 @@
+int b_fun();
diff --git a/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/meson.build b/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/meson.build
new file mode 100644
index 0000000..80903f3
--- /dev/null
+++ b/test cases/linuxlike/12 subprojects in subprojects/subprojects/b/meson.build
@@ -0,0 +1,17 @@
+project('b', 'c')
+
+c_dep = dependency('c', version:'2', fallback: ['c', 'c_dep'], required: false)
+
+assert(c_dep.found() == false, 'C project has the wrong version and should not be found')
+
+if c_dep.found()
+ add_global_arguments('-DWITH_C', language: 'c')
+endif
+
+blib = library('b', 'b.c',
+ dependencies: c_dep)
+
+b_dep = declare_dependency(
+ link_with: blib,
+ include_directories: include_directories('.'),
+)
diff --git a/test cases/linuxlike/12 subprojects in subprojects/subprojects/c/c.h b/test cases/linuxlike/12 subprojects in subprojects/subprojects/c/c.h
new file mode 100644
index 0000000..2b15f60
--- /dev/null
+++ b/test cases/linuxlike/12 subprojects in subprojects/subprojects/c/c.h
@@ -0,0 +1,3 @@
+static int c_fun(){
+ return 3;
+}
diff --git a/test cases/linuxlike/12 subprojects in subprojects/subprojects/c/meson.build b/test cases/linuxlike/12 subprojects in subprojects/subprojects/c/meson.build
new file mode 100644
index 0000000..7184933
--- /dev/null
+++ b/test cases/linuxlike/12 subprojects in subprojects/subprojects/c/meson.build
@@ -0,0 +1,5 @@
+project('c', 'c', version:'1')
+
+c_dep = declare_dependency(
+ include_directories: include_directories('.')
+)
diff --git a/test cases/linuxlike/5 dependency versions/meson.build b/test cases/linuxlike/5 dependency versions/meson.build
index d4140b7..5d9eb32 100644
--- a/test cases/linuxlike/5 dependency versions/meson.build
+++ b/test cases/linuxlike/5 dependency versions/meson.build
@@ -41,6 +41,11 @@ assert(somelibver.type_name() == 'internal', 'somelibver should be of type "inte
somelib = dependency('somelib',
version : '== 0.1',
fallback : ['somelib', 'some_dep'])
+# Find an internal dependency again even if required = false
+somelib_reqfalse = dependency('somelib',
+ required: false,
+ fallback : ['somelib', 'some_dep'])
+assert(somelib_reqfalse.found(), 'somelib should have been found')
# Find an internal dependency again with the same name and incompatible version
somelibver = dependency('somelib',
version : '>= 0.3',