summaryrefslogtreecommitdiff
path: root/test cases/linuxlike
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-03-04 12:32:42 +0530
committerJussi Pakkanen <jpakkane@gmail.com>2017-03-04 09:12:51 -0500
commit9ccbe72509d58cda02d2630925dc8a92e8e5b4f9 (patch)
tree11b9c362ba3fdd8ccb2bead6b3a98f8eed336749 /test cases/linuxlike
parenta24651f33a925c5860a58c3fb8e7b5ec2efbccbd (diff)
downloadmeson-9ccbe72509d58cda02d2630925dc8a92e8e5b4f9.tar.gz
Add manual-linking tests to Linux and Windows
In this test, we try to manually link against the generated library to create an executable and then run it to verify that it works. Also test for all possible library versioning in the versioning tests on Windows. Even though they yield the same dll naming, we should still test it.
Diffstat (limited to 'test cases/linuxlike')
-rw-r--r--test cases/linuxlike/7 library versions/exe.orig.c5
-rw-r--r--test cases/linuxlike/7 library versions/meson.build33
2 files changed, 34 insertions, 4 deletions
diff --git a/test cases/linuxlike/7 library versions/exe.orig.c b/test cases/linuxlike/7 library versions/exe.orig.c
new file mode 100644
index 000000000..1599ebd76
--- /dev/null
+++ b/test cases/linuxlike/7 library versions/exe.orig.c
@@ -0,0 +1,5 @@
+int
+main (int argc, char *argv[])
+{
+ return 0;
+}
diff --git a/test cases/linuxlike/7 library versions/meson.build b/test cases/linuxlike/7 library versions/meson.build
index 504aa4e22..c02bbeda2 100644
--- a/test cases/linuxlike/7 library versions/meson.build
+++ b/test cases/linuxlike/7 library versions/meson.build
@@ -1,18 +1,43 @@
project('library versions', 'c')
-shared_library('some', 'lib.c',
+some = shared_library('some', 'lib.c',
version : '1.2.3',
soversion : '0',
install : true)
-shared_library('noversion', 'lib.c',
+noversion = shared_library('noversion', 'lib.c',
install : true)
-shared_library('onlyversion', 'lib.c',
+onlyversion = shared_library('onlyversion', 'lib.c',
version : '1.4.5',
install : true)
-shared_library('onlysoversion', 'lib.c',
+onlysoversion = shared_library('onlysoversion', 'lib.c',
# Also test that int soversion is acceptable
soversion : 5,
install : true)
+
+# Hack to make the executables below depend on the shared libraries above
+# without actually adding them as `link_with` dependencies since we want to try
+# linking to them with -lfoo linker arguments.
+out = custom_target('library-dependency-hack',
+ input : 'exe.orig.c',
+ output : 'exe.c',
+ depends : [some, noversion, onlyversion, onlysoversion],
+ command : ['cp', '@INPUT@', '@OUTPUT@'])
+
+rpath_arg = '-Wl,-rpath,' + meson.current_build_dir()
+
+# Manually test if the linker can find the above libraries
+# i.e., whether they were generated with the right naming scheme
+test('manually linked 1', executable('manuallink1', out,
+ link_args : ['-L.', '-lsome', rpath_arg]))
+
+test('manually linked 2', executable('manuallink2', out,
+ link_args : ['-L.', '-lnoversion', rpath_arg]))
+
+test('manually linked 3', executable('manuallink3', out,
+ link_args : ['-L.', '-lonlyversion', rpath_arg]))
+
+test('manually linked 4', executable('manuallink4', out,
+ link_args : ['-L.', '-lonlysoversion', rpath_arg]))