Skip to content

Commit

Permalink
See if forcibly loading the correct libxml2 dylib before running the …
Browse files Browse the repository at this point in the history
…tests fixes the lxml test failure on CI
  • Loading branch information
kovidgoyal committed Jan 19, 2023
1 parent f951803 commit b892bf6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions setup/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import subprocess
import sys

from setup import Command

from setup import Command, ismacos, is_ci
TEST_MODULES = frozenset('srv db polish opf css docx cfi matcher icu smartypants build misc dbcli ebooks'.split())


Expand Down Expand Up @@ -41,6 +40,13 @@ def run(self, opts):
self.info(f'Re-execing with LD_PRELOAD={os.environ["LD_PRELOAD"]}')
sys.stdout.flush()
os.execl('setup.py', *sys.argv)
if is_ci and ismacos:
import ctypes
sys.libxml2_dylib = ctypes.CDLL(os.path.join(os.environ['SW'], 'lib', 'libxml2.dylib'))
sys.libxslt_dylib = ctypes.CDLL(os.path.join(os.environ['SW'], 'lib', 'libxslt.dylib'))
sys.libexslt_dylib = ctypes.CDLL(os.path.join(os.environ['SW'], 'lib', 'libexslt.dylib'))
print(sys.libxml2_dylib, sys.libxslt_dylib, sys.libexslt_dylib, file=sys.stderr, flush=True)
del os.environ['DYLD_LIBRARY_PATH']
from calibre.utils.run_tests import (
filter_tests_by_name, remove_tests_by_name, run_cli, find_tests
)
Expand Down
1 change: 1 addition & 0 deletions setup/unix-ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ def main():
if ismacos:
os.environ['SSL_CERT_FILE'] = os.path.abspath(
'resources/mozilla-ca-certs.pem')
os.environ['DYLD_LIBRARY_PATH'] = os.path.join(SW, 'lib')

install_env()
run_python('setup.py test')
Expand Down

0 comments on commit b892bf6

Please sign in to comment.