-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test cases/linuxlike/14 static dynamic linkage: Adding matrix by static
Not only Solaris doesn't ship static libraries, it's a common practice. See, for example 'test cases/frameworks/1 boost'. Adding possibility to skip the static linkage with the help of SKIP_STATIC_ZLIB env var (like SKIP_STATIC_BOOST). Adding the possibility to test dynamic llinkage (it was only static one). TODO: dynamic test on cygwin
- Loading branch information
Showing
5 changed files
with
53 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 21 additions & 32 deletions
53
test cases/linuxlike/14 static dynamic linkage/meson.build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,25 @@ | ||
project('static dynamic', 'c') | ||
project('zlib linkage', 'c') | ||
|
||
# Solaris does not ship static libraries | ||
if host_machine.system() == 'sunos' | ||
has_static = false | ||
else | ||
has_static = true | ||
endif | ||
s = get_option('static') | ||
|
||
cc = meson.get_compiler('c') | ||
|
||
z_default = cc.find_library('z') | ||
if has_static | ||
z_static = cc.find_library('z', static: true) | ||
endif | ||
z_dynamic = cc.find_library('z', static: false) | ||
|
||
exe_default = executable('main_default', 'main.c', dependencies: [z_default]) | ||
if has_static | ||
exe_static = executable('main_static', 'main.c', dependencies: [z_static]) | ||
endif | ||
exe_dynamic = executable('main_dynamic', 'main.c', dependencies: [z_dynamic]) | ||
|
||
test('test default', exe_default) | ||
if has_static | ||
test('test static', exe_static) | ||
endif | ||
test('test dynamic', exe_dynamic) | ||
|
||
if has_static | ||
test('verify static linking', find_program('verify_static.py'), | ||
args: ['--platform=' + host_machine.system(), exe_static.full_path()]) | ||
endif | ||
test('verify dynamic linking', find_program('verify_static.py'), | ||
args: ['--platform=' + host_machine.system(), exe_dynamic.full_path()], | ||
should_fail: true) | ||
z = cc.find_library('z', static: s) | ||
|
||
exe = executable('main_zlib', 'main.c', dependencies: [z]) | ||
|
||
# first step: the executable should compile and work | ||
test('test zlib', exe) | ||
|
||
# to check the zlib static/dynamic symbols in the resulting binary | ||
find_program('nm') | ||
|
||
# second step: static linkage | ||
test('verify static zlib linking', find_program('verify_static.py'), | ||
args: ['--platform=' + host_machine.system(), '--static', exe.full_path()], | ||
should_fail: not s) | ||
|
||
# third step: dynamic linkage | ||
test('verify dynamic zlib linking', find_program('verify_static.py'), | ||
args: ['--platform=' + host_machine.system(), exe.full_path()], | ||
should_fail: s) |
1 change: 1 addition & 0 deletions
1
test cases/linuxlike/14 static dynamic linkage/meson_options.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
option('static', type: 'boolean', value: false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"matrix": { | ||
"options": { | ||
"static": [ | ||
{ "val": "true", "skip_on_env": [ "SKIP_STATIC_ZLIB" ] }, | ||
{ "val": "false" } | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters