Add a test for DLL loading on windows to the build tests

This commit is contained in:
Kovid Goyal 2014-06-10 13:22:15 +05:30
parent b9e048bf3d
commit 9c7851ea05

View File

@ -12,9 +12,26 @@ __docformat__ = 'restructuredtext en'
Test a binary calibre build to ensure that all needed binary images/libraries have loaded. Test a binary calibre build to ensure that all needed binary images/libraries have loaded.
''' '''
import cStringIO, os import cStringIO, os, ctypes
from calibre.constants import plugins, iswindows, islinux from calibre.constants import plugins, iswindows, islinux
def test_dlls():
import win32api
base = win32api.GetDllDirectory()
errors = []
for x in os.listdir(base):
if x.lower().endswith('.dll'):
try:
ctypes.WinDLL(os.path.join(base, x))
except Exception as err:
errors.append('Failed to load DLL %s with error: %s' % (x, err))
print (errors[-1])
if errors:
print ('Loading %d dll(s) failed!' % len(errors))
raise SystemExit(1)
print ('DLLs OK!')
def test_dbus(): def test_dbus():
import dbus import dbus
bus = dbus.SystemBus() bus = dbus.SystemBus()
@ -186,6 +203,8 @@ def test_podofo():
dotest() dotest()
def test(): def test():
if iswindows:
test_dlls()
test_plugins() test_plugins()
test_lxml() test_lxml()
test_ssl() test_ssl()