See if forcibly loading the correct libxml2 dylib before running the tests fixes the lxml test failure on CI

This commit is contained in:
Kovid Goyal 2023-01-19 11:10:47 +05:30
parent f95180349c
commit 0bdde99372
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 8 additions and 2 deletions

View File

@ -6,8 +6,7 @@ import os
import subprocess import subprocess
import sys 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()) 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"]}') self.info(f'Re-execing with LD_PRELOAD={os.environ["LD_PRELOAD"]}')
sys.stdout.flush() sys.stdout.flush()
os.execl('setup.py', *sys.argv) 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 ( from calibre.utils.run_tests import (
filter_tests_by_name, remove_tests_by_name, run_cli, find_tests filter_tests_by_name, remove_tests_by_name, run_cli, find_tests
) )

View File

@ -161,6 +161,7 @@ username = api
if ismacos: if ismacos:
os.environ['SSL_CERT_FILE'] = os.path.abspath( os.environ['SSL_CERT_FILE'] = os.path.abspath(
'resources/mozilla-ca-certs.pem') '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() install_env()
run_python('setup.py test') run_python('setup.py test')