From c3591e5303099a69e7ff5742bc1541dd2e7734ec Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sun, 18 Jun 2017 23:42:01 +0300 Subject: [PATCH] Handle both pkg-config and pkgconf argument order. Closes #1934. --- run_unittests.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/run_unittests.py b/run_unittests.py index 61dc0eeb0..95f418d50 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -1770,16 +1770,22 @@ class LinuxlikeTests(BasePlatformTests): self.init(testdir) # NOTE: .pc file has -Lfoo -lfoo -Lbar -lbar but pkg-config reorders # the flags before returning them to -Lfoo -Lbar -lfoo -lbar - expected_order = ['-L/me/first', '-L/me/second','-lfoo1', '-lfoo2', - '-L/me/third', '-L/me/fourth', '-lfoo3', '-lfoo4'] + # but pkgconf seems to not do that. Sigh. Support both. + expected_order = [('-L/me/first', '-lfoo1'), + ('-L/me/second', '-lfoo2'), + ('-L/me/first', '-L/me/second'), + ('-lfoo1', '-lfoo2'), + ('-L/me/second', '-L/me/third'), + ('-L/me/third', '-L/me/fourth',), + ('-L/me/third', '-lfoo3'), + ('-L/me/fourth', '-lfoo4'), + ('-lfoo3', '-lfoo4'), + ] 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 + if expected_order[0][0] in line: + for first, second in expected_order: + self.assertLess(line.index(first), line.index(second)) return raise RuntimeError('Linker entries not found in the Ninja file.')