From e23c987ad2f0898bc8658ab6447d4a103d1362f0 Mon Sep 17 00:00:00 2001 From: Matthias Klumpp Date: Sat, 15 Apr 2017 19:25:16 +0200 Subject: [PATCH] d: Add testcase for linking multiple versioned shared libraries --- test cases/d/7 multilib/app.d | 9 +++++++++ test cases/d/7 multilib/installed_files.txt | 7 +++++++ test cases/d/7 multilib/meson.build | 21 +++++++++++++++++++++ test cases/d/7 multilib/say1.d | 9 +++++++++ test cases/d/7 multilib/say2.d | 9 +++++++++ 5 files changed, 55 insertions(+) create mode 100644 test cases/d/7 multilib/app.d create mode 100644 test cases/d/7 multilib/installed_files.txt create mode 100644 test cases/d/7 multilib/meson.build create mode 100644 test cases/d/7 multilib/say1.d create mode 100644 test cases/d/7 multilib/say2.d diff --git a/test cases/d/7 multilib/app.d b/test cases/d/7 multilib/app.d new file mode 100644 index 000000000..892596ad9 --- /dev/null +++ b/test cases/d/7 multilib/app.d @@ -0,0 +1,9 @@ + +import say1; +import say2; + +void main () +{ + assert (sayHello1 ("Dave") == 4); + assert (sayHello2 ("HAL 9000") == 8); +} diff --git a/test cases/d/7 multilib/installed_files.txt b/test cases/d/7 multilib/installed_files.txt new file mode 100644 index 000000000..fc6be1675 --- /dev/null +++ b/test cases/d/7 multilib/installed_files.txt @@ -0,0 +1,7 @@ +usr/bin/app_d?exe +usr/lib/libsay1.so +usr/lib/libsay1.so.0 +usr/lib/libsay1.so.1.2.3 +usr/lib/libsay2.so +usr/lib/libsay2.so.1 +usr/lib/libsay2.so.1.2.4 diff --git a/test cases/d/7 multilib/meson.build b/test cases/d/7 multilib/meson.build new file mode 100644 index 000000000..6ebe1ca15 --- /dev/null +++ b/test cases/d/7 multilib/meson.build @@ -0,0 +1,21 @@ +project('D Multiple Versioned Shared Libraries', 'd') + +if meson.get_compiler('d').get_id() == 'gcc' + error('MESON_SKIP_TEST: GDC can not build shared libraries (2016)') +endif + +ldyn1 = shared_library('say1', + 'say1.d', + install: true, + version : '1.2.3', + soversion : '0' +) +ldyn2 = shared_library('say2', + 'say2.d', + install: true, + version : '1.2.4', + soversion : '1' +) + +ed = executable('app_d', 'app.d', link_with: [ldyn1, ldyn2], install: true) +test('multilink_test', ed) diff --git a/test cases/d/7 multilib/say1.d b/test cases/d/7 multilib/say1.d new file mode 100644 index 000000000..07127d316 --- /dev/null +++ b/test cases/d/7 multilib/say1.d @@ -0,0 +1,9 @@ + +import std.stdio; +import std.string : format; + +int sayHello1 (string str) +{ + writeln ("Hello %s from library 1.".format (str)); + return 4; +} diff --git a/test cases/d/7 multilib/say2.d b/test cases/d/7 multilib/say2.d new file mode 100644 index 000000000..f77d0d232 --- /dev/null +++ b/test cases/d/7 multilib/say2.d @@ -0,0 +1,9 @@ + +import std.stdio; +import std.string : format; + +int sayHello2 (string str) +{ + writeln ("Hello %s from library 2.".format (str)); + return 8; +}