Fix: test: handle env variables undefined
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Wed, 17 Feb 2016 21:33:00 +0000 (16:33 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 18 Feb 2016 16:22:45 +0000 (11:22 -0500)
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@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/regression/ust/ust-dl/test_ust-dl.py

index 7117ca1b343ed8f9568c63f410defbe8d66e2616..9801012a7e83791ec9f3a85f6da401f54c91098d 100644 (file)
@@ -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)
This page took 0.02606 seconds and 4 git commands to generate.