From 0bdde99372183eb321cb47fb45487dc52accd333 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 19 Jan 2023 11:10:47 +0530 Subject: [PATCH] See if forcibly loading the correct libxml2 dylib before running the tests fixes the lxml test failure on CI --- setup/test.py | 9 +++++++-- setup/unix-ci.py | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/setup/test.py b/setup/test.py index 5ee7c78240..6855681be6 100644 --- a/setup/test.py +++ b/setup/test.py @@ -6,8 +6,7 @@ import os 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()) @@ -41,6 +40,12 @@ class Test(Command): 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) from calibre.utils.run_tests import ( filter_tests_by_name, remove_tests_by_name, run_cli, find_tests ) diff --git a/setup/unix-ci.py b/setup/unix-ci.py index 1a6ba4e3dd..733df81c70 100644 --- a/setup/unix-ci.py +++ b/setup/unix-ci.py @@ -161,6 +161,7 @@ username = api 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') # needed to ensure correct libxml2.dylib is loaded install_env() run_python('setup.py test')