summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Berg <bberg@redhat.com>2019-02-05 16:41:32 +0100
committerBenjamin Berg <bberg@redhat.com>2019-02-05 16:41:32 +0100
commitc7e5caf3a85172b911a27283f066e78f866b4b18 (patch)
tree3cb6e0a202301f2cbb9b628eae4448b19306cfc9
parent715e990345a5dd19f9255436ec6ac9ffd5500d33 (diff)
downloadgnome-settings-daemon-c7e5caf3a85172b911a27283f066e78f866b4b18.tar.gz
tests: LD_PRELOAD ASan library when address sanitize is enabled
This is required because umockdev is also preloaded
-rw-r--r--plugins/power/meson.build16
-rwxr-xr-xplugins/power/test.py5
2 files changed, 15 insertions, 6 deletions
diff --git a/plugins/power/meson.build b/plugins/power/meson.build
index 7d111099..81ec4ba4 100644
--- a/plugins/power/meson.build
+++ b/plugins/power/meson.build
@@ -124,12 +124,16 @@ gsdpowerenums_py = custom_target(
test_py = find_program('test.py')
-envs = [
-# 'G_DEBUG=fatal_warnings',
- 'BUILDDIR=' + meson.current_build_dir(),
- 'TOP_BUILDDIR=' + meson.build_root(),
- 'LD_PRELOAD=libumockdev-preload.so.0',
-]
+envs = environment()
+#envs.prepend('G_DEBUG', 'fatal-warnings')
+envs.set('BUILDDIR', meson.current_build_dir())
+envs.set('TOP_BUILDDIR', meson.build_root())
+envs.set('LD_PRELOAD', 'libumockdev-preload.so.0')
+
+if get_option('b_sanitize').split(',').contains('address')
+ # libasan needs to be loaded first; so we need to explicitly preload it
+ envs.set('POWER_LD_PRELOAD', 'libasan.so.5')
+endif
foreach i : [ 1, 2, 3, 4, 5, 6, 7, 8 ]
test(
diff --git a/plugins/power/test.py b/plugins/power/test.py
index 57be628e..b9873579 100755
--- a/plugins/power/test.py
+++ b/plugins/power/test.py
@@ -118,6 +118,11 @@ class PowerPluginBase(gsdtestcase.GSDTestCase):
# Use dummy script as testing backlight helper
env['GSD_BACKLIGHT_HELPER'] = os.path.join (project_root, 'plugins', 'power', 'test-backlight-helper')
+ if 'POWER_LD_PRELOAD' in env:
+ if 'LD_PRELOAD' in env and env['LD_PRELOAD']:
+ env['LD_PRELOAD'] = ':'.join((env['POWER_LD_PRELOAD'], env['LD_PRELOAD']))
+ else:
+ env['LD_PRELOAD'] = env['POWER_LD_PRELOAD']
self.daemon = subprocess.Popen(
[os.path.join(builddir, 'gsd-power'), '--verbose'],