summaryrefslogtreecommitdiffstats
path: root/test cases/linuxlike/7 library versions
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
commit7b6e527f440cd7e6f8be2b07cee320ee6ca18786 (patch)
tree4a2738d69fa2814659fdadddf5826282e73d81f4 /test cases/linuxlike/7 library versions
parentInitial commit. (diff)
downloadmeson-upstream.tar.xz
meson-upstream.zip
Adding upstream version 1.0.1.upstream/1.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--test cases/linuxlike/7 library versions/exe.orig.c8
-rw-r--r--test cases/linuxlike/7 library versions/lib.c3
-rw-r--r--test cases/linuxlike/7 library versions/meson.build55
-rw-r--r--test cases/linuxlike/7 library versions/test.json14
4 files changed, 80 insertions, 0 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 0000000..1e8e90e
--- /dev/null
+++ b/test cases/linuxlike/7 library versions/exe.orig.c
@@ -0,0 +1,8 @@
+int myFunc (void);
+
+int main(void)
+{
+ if (myFunc() == 55)
+ return 0;
+ return 1;
+}
diff --git a/test cases/linuxlike/7 library versions/lib.c b/test cases/linuxlike/7 library versions/lib.c
new file mode 100644
index 0000000..bd251d7
--- /dev/null
+++ b/test cases/linuxlike/7 library versions/lib.c
@@ -0,0 +1,3 @@
+int myFunc(void) {
+ return 55;
+}
diff --git a/test cases/linuxlike/7 library versions/meson.build b/test cases/linuxlike/7 library versions/meson.build
new file mode 100644
index 0000000..5160947
--- /dev/null
+++ b/test cases/linuxlike/7 library versions/meson.build
@@ -0,0 +1,55 @@
+project('library versions', 'c')
+
+if host_machine.system() == 'cygwin'
+ error('MESON_SKIP_TEST linuxlike soversions not supported on Cygwin.')
+endif
+
+some = shared_library('some', 'lib.c',
+ version : '1.2.3',
+ soversion : '0',
+ install : true)
+
+noversion = shared_library('noversion', 'lib.c',
+ install : true)
+
+onlyversion = shared_library('onlyversion', 'lib.c',
+ version : '1.4.5',
+ install : true)
+
+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@'])
+
+# Need to add this manually because Meson can't add it automatically because
+# it doesn't know that we are linking to libraries in the build directory.
+rpath_dir = 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'],
+ build_rpath : rpath_dir))
+
+test('manually linked 2', executable('manuallink2', out,
+ link_args : ['-L.', '-lnoversion'],
+ build_rpath : rpath_dir))
+
+test('manually linked 3', executable('manuallink3', out,
+ link_args : ['-L.', '-lonlyversion'],
+ build_rpath : rpath_dir))
+
+test('manually linked 4', executable('manuallink4', out,
+ link_args : ['-L.', '-lonlysoversion'],
+ build_rpath : rpath_dir))
+
+shared_module('module', 'lib.c', install : true)
diff --git a/test cases/linuxlike/7 library versions/test.json b/test cases/linuxlike/7 library versions/test.json
new file mode 100644
index 0000000..0da9277
--- /dev/null
+++ b/test cases/linuxlike/7 library versions/test.json
@@ -0,0 +1,14 @@
+{
+ "installed": [
+ {"type": "file", "file": "usr/lib/libsome.so"},
+ {"type": "file", "file": "usr/lib/libsome.so.0"},
+ {"type": "file", "file": "usr/lib/libsome.so.1.2.3"},
+ {"type": "file", "file": "usr/lib/libnoversion.so"},
+ {"type": "file", "file": "usr/lib/libonlyversion.so"},
+ {"type": "file", "file": "usr/lib/libonlyversion.so.1"},
+ {"type": "file", "file": "usr/lib/libonlyversion.so.1.4.5"},
+ {"type": "file", "file": "usr/lib/libonlysoversion.so"},
+ {"type": "file", "file": "usr/lib/libonlysoversion.so.5"},
+ {"type": "file", "file": "usr/lib/libmodule.so"}
+ ]
+}