From b8b608a2a137aa44f4b9d69926a1488e4c5b9cb5 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Mon, 9 Dec 2013 01:30:06 +0200 Subject: [PATCH] Added simple test case for subproject. Now to make it pass... --- test cases/common/49 subproject/meson.build | 9 +++++++++ .../49 subproject/sublib/include/subdefs.h | 6 ++++++ .../common/49 subproject/sublib/meson.build | 6 ++++++ .../common/49 subproject/sublib/simpletest.c | 5 +++++ test cases/common/49 subproject/sublib/sublib.c | 5 +++++ test cases/common/49 subproject/user.c | 16 ++++++++++++++++ 6 files changed, 47 insertions(+) create mode 100644 test cases/common/49 subproject/meson.build create mode 100644 test cases/common/49 subproject/sublib/include/subdefs.h create mode 100644 test cases/common/49 subproject/sublib/meson.build create mode 100644 test cases/common/49 subproject/sublib/simpletest.c create mode 100644 test cases/common/49 subproject/sublib/sublib.c create mode 100644 test cases/common/49 subproject/user.c diff --git a/test cases/common/49 subproject/meson.build b/test cases/common/49 subproject/meson.build new file mode 100644 index 000000000..fcb2c2dab --- /dev/null +++ b/test cases/common/49 subproject/meson.build @@ -0,0 +1,9 @@ +project('subproj user', 'c') + +sub = subproject('sublib') + +inc = sub.get_variable('i') +lib = sub.get_variable('l') + +e = executable('user.c', include_dirs : inc, link_with : lib) +test('subdirtest', e) diff --git a/test cases/common/49 subproject/sublib/include/subdefs.h b/test cases/common/49 subproject/sublib/include/subdefs.h new file mode 100644 index 000000000..9261c7833 --- /dev/null +++ b/test cases/common/49 subproject/sublib/include/subdefs.h @@ -0,0 +1,6 @@ +#ifndef SUBDEFS_H_ +#define SUBDEFS_H_ + +int subfunc(); + +#endif diff --git a/test cases/common/49 subproject/sublib/meson.build b/test cases/common/49 subproject/sublib/meson.build new file mode 100644 index 000000000..9ff3111c0 --- /dev/null +++ b/test cases/common/49 subproject/sublib/meson.build @@ -0,0 +1,6 @@ +project('subproject', 'c') + +i = include_directories('include') +l = shared_library('sublib', 'sublib.c', include_dirs : i, install : true) +t = executable('simpletest', 'simpletest.c', include_dirs : i, link_with : l) +test('plain', t) diff --git a/test cases/common/49 subproject/sublib/simpletest.c b/test cases/common/49 subproject/sublib/simpletest.c new file mode 100644 index 000000000..3801a40e9 --- /dev/null +++ b/test cases/common/49 subproject/sublib/simpletest.c @@ -0,0 +1,5 @@ +#include + +int main(int argc, char **argv) { + return subfunc() == 42 ? 0 : 1; +} diff --git a/test cases/common/49 subproject/sublib/sublib.c b/test cases/common/49 subproject/sublib/sublib.c new file mode 100644 index 000000000..7045c616f --- /dev/null +++ b/test cases/common/49 subproject/sublib/sublib.c @@ -0,0 +1,5 @@ +#include + +int subfunc() { + return 42; +} diff --git a/test cases/common/49 subproject/user.c b/test cases/common/49 subproject/user.c new file mode 100644 index 000000000..cfde532d8 --- /dev/null +++ b/test cases/common/49 subproject/user.c @@ -0,0 +1,16 @@ +#include +#include + + +int main(int argc, char **argv) { + int res; + printf("Calling into sublib now.\n"); + res = subfunc(); + if(res == 42) { + printf("Everything is fine.\n"); + return 0; + } else { + printf("Something went wrong.\n"); + return 1; + } +}