tests: Fix hard-coded install path in glib-mkenums test

While this was useful for local testing while developing the test, it’s
not widely applicable. Look the binary up in the current `${PATH}` if
it’s not specified using `G_TEST_BUILDDIR`.

This is needed to get the `mkenums.py` test working as an
installed-test.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
Philip Withnall 2019-06-08 00:09:11 +01:00
parent 4e00fdea9b
commit 3f02660ea5

View File

@ -22,6 +22,7 @@
import collections
import os
import shutil
import subprocess
import tempfile
import textwrap
@ -57,7 +58,7 @@ class TestMkenums(unittest.TestCase):
os.path.join(os.environ['G_TEST_BUILDDIR'], '..',
'glib-mkenums')
else:
self.__mkenums = os.path.join('/', 'usr', 'bin', 'glib-mkenums')
self.__mkenums = shutil.which('glib-mkenums')
print('rspfile: {}, mkenums:'.format(self.rspfile), self.__mkenums)
def tearDown(self):