+ env_args+=("LD_LIBRARY_PATH=${main_lib_path}:${LD_LIBRARY_PATH:-}")
+ fi
+
+ # On Windows, an embedded Python interpreter needs a way to locate the path
+ # to it's internal modules, set the prefix from python-config to the
+ # PYTHONHOME variable.
+ if [ "$BT_TESTS_OS_TYPE" = "mingw" ]; then
+ env_args+=("PYTHONHOME=$($BT_TESTS_PYTHON_CONFIG_BIN --prefix)")
+ fi
+
+ # If AddressSanitizer is used, we must preload libasan.so so that
+ # libasan doesn't complain about not being the first loaded library.
+ #
+ # Python and sed (executed as part of the libtool wrapper) produce some
+ # leaks, so we must unfortunately disable leak detection. Append it to
+ # existing ASAN_OPTIONS, such that we override the user's value if it
+ # contains detect_leaks=1.
+ if [ "${BT_TESTS_ENABLE_ASAN:-}" = "1" ]; then
+ if ${BT_TESTS_CC_BIN} --version | head -n 1 | grep -q '^gcc'; then
+ lib_asan=$(${BT_TESTS_CC_BIN} -print-file-name=libasan.so)
+ env_args+=("LD_PRELOAD=${lib_asan}:${LD_PRELOAD:-}")
+ fi
+
+ env_args+=("ASAN_OPTIONS=${ASAN_OPTIONS:-},detect_leaks=0")