Fix "test cases/linuxlike/14 static dynamic linkage" on Solaris

Solaris doesn't ship static libraries, so the test can't rely on libz.a
existing on Solaris.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
pull/5917/head
Alan Coopersmith 5 years ago
parent 692fade34e
commit 0faaf9720f
  1. 14
      test cases/linuxlike/14 static dynamic linkage/meson.build

@ -1,22 +1,36 @@
project('static dynamic', 'c') project('static dynamic', 'c')
# Solaris does not ship static libraries
if host_machine.system() == 'sunos'
has_static = false
else
has_static = true
endif
cc = meson.get_compiler('c') cc = meson.get_compiler('c')
z_default = cc.find_library('z') z_default = cc.find_library('z')
if has_static
z_static = cc.find_library('z', static: true) z_static = cc.find_library('z', static: true)
endif
z_dynamic = cc.find_library('z', static: false) z_dynamic = cc.find_library('z', static: false)
exe_default = executable('main_default', 'main.c', dependencies: [z_default]) exe_default = executable('main_default', 'main.c', dependencies: [z_default])
if has_static
exe_static = executable('main_static', 'main.c', dependencies: [z_static]) exe_static = executable('main_static', 'main.c', dependencies: [z_static])
endif
exe_dynamic = executable('main_dynamic', 'main.c', dependencies: [z_dynamic]) exe_dynamic = executable('main_dynamic', 'main.c', dependencies: [z_dynamic])
test('test default', exe_default) test('test default', exe_default)
if has_static
test('test static', exe_static) test('test static', exe_static)
endif
test('test dynamic', exe_dynamic) test('test dynamic', exe_dynamic)
if has_static
test('verify static linking', find_program('verify_static.py'), test('verify static linking', find_program('verify_static.py'),
args: ['--platform=' + host_machine.system(), exe_static.full_path()]) args: ['--platform=' + host_machine.system(), exe_static.full_path()])
endif
test('verify dynamic linking', find_program('verify_static.py'), test('verify dynamic linking', find_program('verify_static.py'),
args: ['--platform=' + host_machine.system(), exe_dynamic.full_path()], args: ['--platform=' + host_machine.system(), exe_dynamic.full_path()],
should_fail: true) should_fail: true)

Loading…
Cancel
Save