aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgnacio Casal Quinteiro <qignacio@amazon.com>2019-03-11 15:18:07 +0100
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2019-03-11 17:38:22 +0000
commitc6f84a223cffb95b272dbd15b74a6caf81c72fb0 (patch)
tree53fd8842d7cc7134de6cc6109c89f3203d6a1088
parentca34b0af70f2827d45e9b372118718400f698b3a (diff)
downloadmeson-c6f84a223cffb95b272dbd15b74a6caf81c72fb0.zip
meson-c6f84a223cffb95b272dbd15b74a6caf81c72fb0.tar.gz
meson-c6f84a223cffb95b272dbd15b74a6caf81c72fb0.tar.bz2
Add unit test for pkgconfig relative paths
-rwxr-xr-xrun_unittests.py17
-rw-r--r--test cases/unit/58 pkgconfig relative paths/pkgconfig/librelativepath.pc9
2 files changed, 26 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py
index 078b4ca..5087414 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -4822,6 +4822,23 @@ endian = 'little'
subprocess.check_call(test_exe, env=myenv)
@skipIfNoPkgconfig
+ def test_pkgconfig_relative_paths(self):
+ testdir = os.path.join(self.unit_test_dir, '58 pkgconfig relative paths')
+ pkg_dir = os.path.join(testdir, 'pkgconfig')
+ self.assertTrue(os.path.exists(os.path.join(pkg_dir, 'librelativepath.pc')))
+ os.environ['PKG_CONFIG_PATH'] = pkg_dir
+
+ env = get_fake_env(testdir, self.builddir, self.prefix)
+ kwargs = {'required': True, 'silent': True}
+ relative_path_dep = PkgConfigDependency('librelativepath', env, kwargs)
+ self.assertTrue(relative_path_dep.found())
+
+ # Ensure link_args are properly quoted
+ libpath = Path(self.builddir) / '../relativepath/lib'
+ link_args = ['-L' + libpath.as_posix(), '-lrelativepath']
+ self.assertEqual(relative_path_dep.get_link_args(), link_args)
+
+ @skipIfNoPkgconfig
def test_pkgconfig_internal_libraries(self):
'''
'''
diff --git a/test cases/unit/58 pkgconfig relative paths/pkgconfig/librelativepath.pc b/test cases/unit/58 pkgconfig relative paths/pkgconfig/librelativepath.pc
new file mode 100644
index 0000000..dae1eed
--- /dev/null
+++ b/test cases/unit/58 pkgconfig relative paths/pkgconfig/librelativepath.pc
@@ -0,0 +1,9 @@
+prefix=../relativepath
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+
+Name: Relative path
+Description: Relative path library
+Version: 0.0.1
+Libs: -L${libdir} -lrelativepath
+Cflags: