Skip a couple of tests when running with sanitizer

This commit is contained in:
Kovid Goyal 2021-03-22 09:09:42 +05:30
parent 78b14e7ae2
commit ccc85bc358
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 5 additions and 0 deletions

View File

@ -16,6 +16,7 @@ from calibre.constants import iswindows, islinux, ismacos, plugins_loc
from polyglot.builtins import iteritems, map, unicode_type, getenv from polyglot.builtins import iteritems, map, unicode_type, getenv
is_ci = os.environ.get('CI', '').lower() == 'true' is_ci = os.environ.get('CI', '').lower() == 'true'
is_sanitized = 'libasan' in os.environ.get('LD_PRELOAD', '')
class BuildTest(unittest.TestCase): class BuildTest(unittest.TestCase):
@ -286,6 +287,8 @@ class BuildTest(unittest.TestCase):
@unittest.skipIf('SKIP_QT_BUILD_TEST' in os.environ, 'Skipping Qt build test as it causes crashes in the macOS VM') @unittest.skipIf('SKIP_QT_BUILD_TEST' in os.environ, 'Skipping Qt build test as it causes crashes in the macOS VM')
def test_qt(self): def test_qt(self):
if is_sanitized:
raise unittest.SkipTest('Skipping Qt build test as sanitizer is enabled')
from qt.core import QTimer from qt.core import QTimer
from qt.core import QApplication from qt.core import QApplication
from qt.webengine import QWebEnginePage from qt.webengine import QWebEnginePage

View File

@ -269,10 +269,12 @@ class CScorer(object):
def test(return_tests=False): def test(return_tests=False):
is_sanitized = 'libasan' in os.environ.get('LD_PRELOAD', '')
import unittest import unittest
class Test(unittest.TestCase): class Test(unittest.TestCase):
@unittest.skipIf(is_sanitized, 'Sanitizer enabled will cant check for leaks')
def test_mem_leaks(self): def test_mem_leaks(self):
import gc import gc
from calibre.utils.mem import get_memory as memory from calibre.utils.mem import get_memory as memory