Add unit test for pkgconfig relative paths

pull/5058/head
Ignacio Casal Quinteiro 6 years ago committed by Nirbheek Chauhan
parent ca34b0af70
commit c6f84a223c
  1. 17
      run_unittests.py
  2. 9
      test cases/unit/58 pkgconfig relative paths/pkgconfig/librelativepath.pc

@ -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):
'''

@ -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:
Loading…
Cancel
Save