Refactor 'common/145 whole archive' test case

Former test is extremely hard to follow,
target names are inconsistent with directory names,
test case mixes up 2 separate testing scenarios,
names are meaningless. In order to fix this
provides comments what each command is doing and why,
renamed targets into descriptive and longer names,
made names consistent with contents so that it is easier
to follow test logic without looking up source code.
pull/3146/head
Aleksey Filippov 7 years ago committed by Jussi Pakkanen
parent 8c3a1afde0
commit d040ce4165
  1. 1
      test cases/common/145 whole archive/allofme/meson.build
  2. 3
      test cases/common/145 whole archive/exe/meson.build
  3. 2
      test cases/common/145 whole archive/exe2/meson.build
  4. 0
      test cases/common/145 whole archive/func1.c
  5. 0
      test cases/common/145 whole archive/func2.c
  6. 22
      test cases/common/145 whole archive/meson.build
  7. 3
      test cases/common/145 whole archive/sh_func2_linked_func1/meson.build
  8. 1
      test cases/common/145 whole archive/sh_only_link_whole/meson.build
  9. 4
      test cases/common/145 whole archive/shlib/meson.build
  10. 1
      test cases/common/145 whole archive/st_func1/meson.build
  11. 1
      test cases/common/145 whole archive/st_func2/meson.build
  12. 1
      test cases/common/145 whole archive/stlib/meson.build
  13. 1
      test cases/common/145 whole archive/wholeshlib/meson.build

@ -1 +0,0 @@
stlib = static_library('allofme', '../libfile.c')

@ -1,2 +1 @@
exe = executable('prog', '../prog.c',
link_with : dylib)
exe = executable('prog', '../prog.c', link_with : sh_func2_linked_func1)

@ -1 +1 @@
exe2 = executable('prog2', '../prog.c', link_with : dylib2)
exe2 = executable('prog2', '../prog.c', link_with : sh_only_link_whole)

@ -10,15 +10,23 @@ if cc.get_id() == 'msvc'
endif
endif
subdir('allofme')
subdir('shlib')
# Test 1: link_whole keeps all symbols
# Make static func1
subdir('st_func1')
# Make shared func2 linking whole func1 archive
subdir('sh_func2_linked_func1')
# Link exe with shared library only
subdir('exe')
# Test that both func1 and func2 are accessible from shared library
test('prog', exe)
# link_whole only
subdir('stlib')
subdir('wholeshlib')
# Test 2: link_whole can be used instead of source list, see #2180
# Make static func2
subdir('st_func2')
# Link both func1 and func2 into same shared library
# which does not have any sources other than 2 static libraries
subdir('sh_only_link_whole')
# Link exe2 with shared library only
subdir('exe2')
# Test that both func1 and func2 are accessible from shared library
test('prog2', exe2)

@ -0,0 +1,3 @@
# Nothing in func2.c uses func1, so the linker would throw it
# away and thus linking the exe would fail.
sh_func2_linked_func1 = shared_library('sh_func2_linked_func1', '../func2.c', link_whole : st_func1)

@ -0,0 +1 @@
sh_only_link_whole = shared_library('sh_only_link_whole', link_whole : [st_func1, st_func2])

@ -1,4 +0,0 @@
# Nothing in dylib.c uses func1, so the linker would throw it
# away and thus linking the exe would fail.
dylib = shared_library('shlib', '../dylib.c',
link_whole : stlib)

@ -0,0 +1 @@
st_func1 = static_library('st_func1', '../func1.c')

@ -0,0 +1 @@
st_func2 = static_library('st_func2', '../func2.c')

@ -1 +0,0 @@
static = static_library('static', '../dylib.c')

@ -1 +0,0 @@
dylib2 = shared_library('link_whole', link_whole : [stlib, static])
Loading…
Cancel
Save