|
|
@ -3657,26 +3657,30 @@ class LinuxlikeTests(BasePlatformTests): |
|
|
|
privatedir2 = self.privatedir |
|
|
|
privatedir2 = self.privatedir |
|
|
|
|
|
|
|
|
|
|
|
os.environ['PKG_CONFIG_LIBDIR'] = os.pathsep.join([privatedir1, privatedir2]) |
|
|
|
os.environ['PKG_CONFIG_LIBDIR'] = os.pathsep.join([privatedir1, privatedir2]) |
|
|
|
cmd = ['pkg-config', 'dependency-test'] |
|
|
|
self._run(['pkg-config', 'dependency-test', '--validate']) |
|
|
|
|
|
|
|
|
|
|
|
out = self._run(cmd + ['--print-requires']).strip().split('\n') |
|
|
|
# pkg-config strips some duplicated flags so we have to parse the |
|
|
|
self.assertEqual(sorted(out), sorted(['libexposed'])) |
|
|
|
# generated file ourself. |
|
|
|
|
|
|
|
expected = { |
|
|
|
out = self._run(cmd + ['--print-requires-private']).strip().split('\n') |
|
|
|
'Requires': 'libexposed', |
|
|
|
self.assertEqual(sorted(out), sorted(['libfoo >= 1.0'])) |
|
|
|
'Requires.private': 'libfoo >= 1.0', |
|
|
|
|
|
|
|
'Libs': '-L${libdir} -llibmain -pthread -lcustom', |
|
|
|
out = self._run(cmd + ['--cflags-only-other']).strip().split() |
|
|
|
'Libs.private': '-lcustom2 -L${libdir} -llibinternal', |
|
|
|
self.check_pkg_flags_are_same(out, ['-pthread', '-DCUSTOM']) |
|
|
|
'Cflags': '-I${includedir} -pthread -DCUSTOM', |
|
|
|
|
|
|
|
} |
|
|
|
out = self._run(cmd + ['--libs-only-l', '--libs-only-other']).strip().split() |
|
|
|
if is_osx() or is_haiku(): |
|
|
|
self.check_pkg_flags_are_same(out, ['-pthread', '-lcustom', |
|
|
|
expected['Cflags'] = expected['Cflags'].replace('-pthread ', '') |
|
|
|
'-llibmain', '-llibexposed']) |
|
|
|
with open(os.path.join(privatedir2, 'dependency-test.pc')) as f: |
|
|
|
|
|
|
|
matched_lines = 0 |
|
|
|
out = self._run(cmd + ['--libs-only-l', '--libs-only-other', '--static']).strip().split() |
|
|
|
for line in f: |
|
|
|
self.check_pkg_flags_are_same(out, ['-pthread', '-lcustom', |
|
|
|
parts = line.split(':', 1) |
|
|
|
'-llibmain', '-llibexposed', |
|
|
|
if parts[0] in expected: |
|
|
|
'-llibinternal', '-lcustom2', |
|
|
|
key = parts[0] |
|
|
|
'-lfoo']) |
|
|
|
val = parts[1].strip() |
|
|
|
|
|
|
|
expected_val = expected[key] |
|
|
|
|
|
|
|
self.assertEqual(expected_val, val) |
|
|
|
|
|
|
|
matched_lines += 1 |
|
|
|
|
|
|
|
self.assertEqual(len(expected), matched_lines) |
|
|
|
|
|
|
|
|
|
|
|
cmd = ['pkg-config', 'requires-test'] |
|
|
|
cmd = ['pkg-config', 'requires-test'] |
|
|
|
out = self._run(cmd + ['--print-requires']).strip().split('\n') |
|
|
|
out = self._run(cmd + ['--print-requires']).strip().split('\n') |
|
|
@ -3686,11 +3690,6 @@ class LinuxlikeTests(BasePlatformTests): |
|
|
|
out = self._run(cmd + ['--print-requires-private']).strip().split('\n') |
|
|
|
out = self._run(cmd + ['--print-requires-private']).strip().split('\n') |
|
|
|
self.assertEqual(sorted(out), sorted(['libexposed', 'libfoo >= 1.0', 'libhello'])) |
|
|
|
self.assertEqual(sorted(out), sorted(['libexposed', 'libfoo >= 1.0', 'libhello'])) |
|
|
|
|
|
|
|
|
|
|
|
def check_pkg_flags_are_same(self, output, expected): |
|
|
|
|
|
|
|
if is_osx() or is_haiku(): |
|
|
|
|
|
|
|
expected = [x for x in expected if x != '-pthread'] |
|
|
|
|
|
|
|
self.assertEqual(sorted(output), sorted(expected)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_pkg_unfound(self): |
|
|
|
def test_pkg_unfound(self): |
|
|
|
testdir = os.path.join(self.unit_test_dir, '23 unfound pkgconfig') |
|
|
|
testdir = os.path.join(self.unit_test_dir, '23 unfound pkgconfig') |
|
|
|
self.init(testdir) |
|
|
|
self.init(testdir) |
|
|
|