aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-06-11 21:45:12 +0300
committerNirbheek Chauhan <nirbheek@centricular.com>2017-06-12 22:26:10 +0530
commit8244f4c6a6436a7ddf585592c184714f803cfef8 (patch)
treeb52e9eec27f754cb4f393467f6dd829d5978c7d5
parentd23e6b34c77f1e6bee8ab475ab05e3f5250949e7 (diff)
downloadmeson-8244f4c6a6436a7ddf585592c184714f803cfef8.zip
meson-8244f4c6a6436a7ddf585592c184714f803cfef8.tar.gz
meson-8244f4c6a6436a7ddf585592c184714f803cfef8.tar.bz2
Created unit test to ensure linker arguments from consecutive dependencies are kept in order.
-rwxr-xr-xrun_unittests.py16
-rw-r--r--test cases/unit/8 L order/first.pc13
-rw-r--r--test cases/unit/8 L order/meson.build6
-rw-r--r--test cases/unit/8 L order/prog.c5
-rw-r--r--test cases/unit/8 L order/second.pc13
5 files changed, 53 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py
index 9f39890..ab41f54 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -1755,6 +1755,22 @@ class LinuxlikeTests(BasePlatformTests):
env['LD_LIBRARY_PATH'] = installed_libdir
self.assertEqual(subprocess.call(installed_exe, env=env), 0)
+ def test_order_of_l_arguments(self):
+ testdir = os.path.join(self.unit_test_dir, '8 L order')
+ os.environ['PKG_CONFIG_PATH'] = testdir
+ self.init(testdir)
+ expected_order = ['-L/me/first', '-L/me/second', '-L/me/third', '-L/me/fourth']
+ with open(os.path.join(self.builddir, 'build.ninja')) as ifile:
+ for line in ifile:
+ if expected_order[0] in line:
+ previous_index = line.index(expected_order[0])
+ for entry in expected_order[1:]:
+ current_index = line.index(entry)
+ self.assertLess(previous_index, current_index)
+ previous_index = current_index
+ return
+ raise RuntimeError('Linker entries not found in the Ninja file.')
+
class LinuxArmCrossCompileTests(BasePlatformTests):
'''
Tests that verify cross-compilation to Linux/ARM
diff --git a/test cases/unit/8 L order/first.pc b/test cases/unit/8 L order/first.pc
new file mode 100644
index 0000000..8066f6e
--- /dev/null
+++ b/test cases/unit/8 L order/first.pc
@@ -0,0 +1,13 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${prefix}/lib/x86_64-linux-gnu
+sharedlibdir=${libdir}
+includedir=${prefix}/include
+
+Name: jonne
+Description: jonne library
+Version: 1.0.0
+
+Requires:
+Libs: -L/me/first -L/me/second
+Cflags: -I${includedir}
diff --git a/test cases/unit/8 L order/meson.build b/test cases/unit/8 L order/meson.build
new file mode 100644
index 0000000..cfcf033
--- /dev/null
+++ b/test cases/unit/8 L order/meson.build
@@ -0,0 +1,6 @@
+project('jonne', 'c')
+
+firstdep = dependency('first')
+seconddep = dependency('second')
+
+executable('lprog', 'prog.c', dependencies : [firstdep, seconddep])
diff --git a/test cases/unit/8 L order/prog.c b/test cases/unit/8 L order/prog.c
new file mode 100644
index 0000000..3a16ac3
--- /dev/null
+++ b/test cases/unit/8 L order/prog.c
@@ -0,0 +1,5 @@
+#include<stdio.h>
+
+int main(int argc, char **argv) {
+ return 0;
+}
diff --git a/test cases/unit/8 L order/second.pc b/test cases/unit/8 L order/second.pc
new file mode 100644
index 0000000..602f262
--- /dev/null
+++ b/test cases/unit/8 L order/second.pc
@@ -0,0 +1,13 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${prefix}/lib/x86_64-linux-gnu
+sharedlibdir=${libdir}
+includedir=${prefix}/include
+
+Name: jonne2
+Description: jonne2 library
+Version: 1.0.0
+
+Requires:
+Libs: -L/me/third -L/me/fourth
+Cflags: -I${includedir}