diff --git a/run_unittests.py b/run_unittests.py index 078b4ca15..50874142c 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -4821,6 +4821,23 @@ endian = 'little' self.assertTrue(os.path.isfile(test_exe)) 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 000000000..dae1eed75 --- /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: