[lttng-dev] [PATCH lttng-tools] Fix: test: handle env variables undefined

Jérémie Galarneau jeremie.galarneau at efficios.com
Thu Feb 18 11:24:04 EST 2016


Merged, thanks!

Jérémie

On Wed, Feb 17, 2016 at 4:33 PM, Jonathan Rajotte
<jonathan.rajotte-julien at efficios.com> wrote:
> Prevent errors on non-existent key fetching e.g LD_PRELOAD & LD_LIBRARY_PATH.
> Uses .get() with a default empty string to prevent this case.
>
> Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
> ---
>  tests/regression/ust/ust-dl/test_ust-dl.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tests/regression/ust/ust-dl/test_ust-dl.py b/tests/regression/ust/ust-dl/test_ust-dl.py
> index 7117ca1..9801012 100644
> --- a/tests/regression/ust/ust-dl/test_ust-dl.py
> +++ b/tests/regression/ust/ust-dl/test_ust-dl.py
> @@ -46,8 +46,8 @@ enable_ust_tracepoint_event(session_info, "*")
>  start_session(session_info)
>
>  test_env = os.environ.copy()
> -test_env["LD_PRELOAD"] += ":liblttng-ust-dl.so"
> -test_env["LD_LIBRARY_PATH"] += ":" + test_path
> +test_env["LD_PRELOAD"] = test_env.get("LD_PRELOAD", "") + ":liblttng-ust-dl.so"
> +test_env["LD_LIBRARY_PATH"] = test_env.get("LD_LIBRARY_PATH", "") + ":" + test_path
>  test_process = subprocess.Popen(test_path + "prog",
>                                  stdout=subprocess.PIPE, stderr=subprocess.PIPE,
>                                  env=test_env)
> --
> 2.5.0
>



-- 
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com



More information about the lttng-dev mailing list