From: Jonathan Rajotte Date: Wed, 17 Feb 2016 21:33:00 +0000 (-0500) Subject: Fix: test: handle env variables undefined X-Git-Tag: v2.8.0-rc1~159 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=1f8f19a417b0b818b7edf566812acf7cf3d21f24;p=lttng-tools.git Fix: test: handle env variables undefined 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 Signed-off-by: Jérémie Galarneau --- diff --git a/tests/regression/ust/ust-dl/test_ust-dl.py b/tests/regression/ust/ust-dl/test_ust-dl.py index 7117ca1b3..9801012a7 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)