aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Filippov <alekseyf@google.com>2018-02-18 07:28:43 +0000
committerJussi Pakkanen <jpakkane@gmail.com>2018-02-27 20:43:02 +0200
commitd040ce4165aab1ba32c96bbc35c2fad10b26664f (patch)
tree00d530d772806e17017b79da9f12f4e6c9fa485a
parent8c3a1afde07daa25eb93b04f356616793f2a1eb3 (diff)
downloadmeson-d040ce4165aab1ba32c96bbc35c2fad10b26664f.zip
meson-d040ce4165aab1ba32c96bbc35c2fad10b26664f.tar.gz
meson-d040ce4165aab1ba32c96bbc35c2fad10b26664f.tar.bz2
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.
-rw-r--r--test cases/common/145 whole archive/allofme/meson.build1
-rw-r--r--test cases/common/145 whole archive/exe/meson.build3
-rw-r--r--test cases/common/145 whole archive/exe2/meson.build2
-rw-r--r--test cases/common/145 whole archive/func1.c (renamed from test cases/common/145 whole archive/libfile.c)0
-rw-r--r--test cases/common/145 whole archive/func2.c (renamed from test cases/common/145 whole archive/dylib.c)0
-rw-r--r--test cases/common/145 whole archive/meson.build22
-rw-r--r--test cases/common/145 whole archive/sh_func2_linked_func1/meson.build3
-rw-r--r--test cases/common/145 whole archive/sh_only_link_whole/meson.build1
-rw-r--r--test cases/common/145 whole archive/shlib/meson.build4
-rw-r--r--test cases/common/145 whole archive/st_func1/meson.build1
-rw-r--r--test cases/common/145 whole archive/st_func2/meson.build1
-rw-r--r--test cases/common/145 whole archive/stlib/meson.build1
-rw-r--r--test cases/common/145 whole archive/wholeshlib/meson.build1
13 files changed, 23 insertions, 17 deletions
diff --git a/test cases/common/145 whole archive/allofme/meson.build b/test cases/common/145 whole archive/allofme/meson.build
deleted file mode 100644
index f5c2027..0000000
--- a/test cases/common/145 whole archive/allofme/meson.build
+++ /dev/null
@@ -1 +0,0 @@
-stlib = static_library('allofme', '../libfile.c')
diff --git a/test cases/common/145 whole archive/exe/meson.build b/test cases/common/145 whole archive/exe/meson.build
index f47a246..91d298d 100644
--- a/test cases/common/145 whole archive/exe/meson.build
+++ b/test cases/common/145 whole archive/exe/meson.build
@@ -1,2 +1 @@
-exe = executable('prog', '../prog.c',
- link_with : dylib)
+exe = executable('prog', '../prog.c', link_with : sh_func2_linked_func1)
diff --git a/test cases/common/145 whole archive/exe2/meson.build b/test cases/common/145 whole archive/exe2/meson.build
index 5365f03..9184864 100644
--- a/test cases/common/145 whole archive/exe2/meson.build
+++ b/test cases/common/145 whole archive/exe2/meson.build
@@ -1 +1 @@
-exe2 = executable('prog2', '../prog.c', link_with : dylib2)
+exe2 = executable('prog2', '../prog.c', link_with : sh_only_link_whole)
diff --git a/test cases/common/145 whole archive/libfile.c b/test cases/common/145 whole archive/func1.c
index b2690a0..b2690a0 100644
--- a/test cases/common/145 whole archive/libfile.c
+++ b/test cases/common/145 whole archive/func1.c
diff --git a/test cases/common/145 whole archive/dylib.c b/test cases/common/145 whole archive/func2.c
index 9e287a4..9e287a4 100644
--- a/test cases/common/145 whole archive/dylib.c
+++ b/test cases/common/145 whole archive/func2.c
diff --git a/test cases/common/145 whole archive/meson.build b/test cases/common/145 whole archive/meson.build
index 617ae03..56da157 100644
--- a/test cases/common/145 whole archive/meson.build
+++ b/test cases/common/145 whole archive/meson.build
@@ -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)
diff --git a/test cases/common/145 whole archive/sh_func2_linked_func1/meson.build b/test cases/common/145 whole archive/sh_func2_linked_func1/meson.build
new file mode 100644
index 0000000..2858f65
--- /dev/null
+++ b/test cases/common/145 whole archive/sh_func2_linked_func1/meson.build
@@ -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)
diff --git a/test cases/common/145 whole archive/sh_only_link_whole/meson.build b/test cases/common/145 whole archive/sh_only_link_whole/meson.build
new file mode 100644
index 0000000..64baabd
--- /dev/null
+++ b/test cases/common/145 whole archive/sh_only_link_whole/meson.build
@@ -0,0 +1 @@
+sh_only_link_whole = shared_library('sh_only_link_whole', link_whole : [st_func1, st_func2])
diff --git a/test cases/common/145 whole archive/shlib/meson.build b/test cases/common/145 whole archive/shlib/meson.build
deleted file mode 100644
index 34a1b78..0000000
--- a/test cases/common/145 whole archive/shlib/meson.build
+++ /dev/null
@@ -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)
diff --git a/test cases/common/145 whole archive/st_func1/meson.build b/test cases/common/145 whole archive/st_func1/meson.build
new file mode 100644
index 0000000..c84d781
--- /dev/null
+++ b/test cases/common/145 whole archive/st_func1/meson.build
@@ -0,0 +1 @@
+st_func1 = static_library('st_func1', '../func1.c')
diff --git a/test cases/common/145 whole archive/st_func2/meson.build b/test cases/common/145 whole archive/st_func2/meson.build
new file mode 100644
index 0000000..2732f96
--- /dev/null
+++ b/test cases/common/145 whole archive/st_func2/meson.build
@@ -0,0 +1 @@
+st_func2 = static_library('st_func2', '../func2.c')
diff --git a/test cases/common/145 whole archive/stlib/meson.build b/test cases/common/145 whole archive/stlib/meson.build
deleted file mode 100644
index 07a434e..0000000
--- a/test cases/common/145 whole archive/stlib/meson.build
+++ /dev/null
@@ -1 +0,0 @@
-static = static_library('static', '../dylib.c')
diff --git a/test cases/common/145 whole archive/wholeshlib/meson.build b/test cases/common/145 whole archive/wholeshlib/meson.build
deleted file mode 100644
index 69a1995..0000000
--- a/test cases/common/145 whole archive/wholeshlib/meson.build
+++ /dev/null
@@ -1 +0,0 @@
-dylib2 = shared_library('link_whole', link_whole : [stlib, static])