From c6234e114bc3dc5779451cf29634337879f0c6be Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 13 May 2020 22:17:50 +0200 Subject: clients/tests: preserve caller's ASAN/LSAN/UBSAN environment variables for client tests --- clients/tests/test-client.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'clients/tests') diff --git a/clients/tests/test-client.py b/clients/tests/test-client.py index daa69842c8..934cec60d3 100755 --- a/clients/tests/test-client.py +++ b/clients/tests/test-client.py @@ -63,6 +63,10 @@ ENV_NM_TEST_REGENERATE = 'NM_TEST_REGENERATE' # numbers enabled. ENV_NM_TEST_WITH_LINENO = 'NM_TEST_WITH_LINENO' +ENV_NM_TEST_ASAN_OPTIONS = 'NM_TEST_ASAN_OPTIONS' +ENV_NM_TEST_LSAN_OPTIONS = 'NM_TEST_LSAN_OPTIONS' +ENV_NM_TEST_UBSAN_OPTIONS = 'NM_TEST_UBSAN_OPTIONS' + # ############################################################################### @@ -406,6 +410,17 @@ class Configuration: v = (os.environ.get(ENV_NM_TEST_REGENERATE, '0') == '1') elif name == ENV_NM_TEST_WITH_LINENO: v = (os.environ.get(ENV_NM_TEST_WITH_LINENO, '0') == '1') + elif name in [ ENV_NM_TEST_ASAN_OPTIONS, ENV_NM_TEST_LSAN_OPTIONS, ENV_NM_TEST_UBSAN_OPTIONS ]: + v = os.environ.get(name, None) + if v is None: + if name == ENV_NM_TEST_ASAN_OPTIONS: + v = 'detect_leaks=0' + elif name == ENV_NM_TEST_LSAN_OPTIONS: + v = '' + elif name == ENV_NM_TEST_UBSAN_OPTIONS: + v = '' + else: + assert(False) else: raise Exception() self._values[name] = v @@ -763,7 +778,9 @@ class TestNmcli(NmTestBase): env['LIBNM_USE_SESSION_BUS'] = '1' env['LIBNM_USE_NO_UDEV'] = '1' env['TERM'] = 'linux' - env['ASAN_OPTIONS'] = 'detect_leaks=0' + env['ASAN_OPTIONS'] = conf.get(ENV_NM_TEST_ASAN_OPTIONS) + env['LSAN_OPTIONS'] = conf.get(ENV_NM_TEST_LSAN_OPTIONS) + env['LBSAN_OPTIONS'] = conf.get(ENV_NM_TEST_UBSAN_OPTIONS) env['XDG_CONFIG_HOME'] = PathConfiguration.srcdir() env['NM_TEST_CALLING_NUM'] = str(calling_num) if fatal_warnings is _DEFAULT_ARG or fatal_warnings: -- cgit v1.2.1