From e1ca473c4dba80a9646b197846d105957267cbed Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Tue, 5 Jul 2016 15:13:15 -0400 Subject: [PATCH] Tests: eliminate process timeouts from Python tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- tests/regression/ust/daemon/test_daemon.py | 9 +-------- .../ust/exit-fast/test_exit-fast.py | 20 ++----------------- tests/regression/ust/fork/test_fork.py | 10 +--------- .../ust/libc-wrapper/test_libc-wrapper.py | 9 +-------- tests/regression/ust/linking/test_linking.py | 18 ++--------------- 5 files changed, 7 insertions(+), 59 deletions(-) diff --git a/tests/regression/ust/daemon/test_daemon.py b/tests/regression/ust/daemon/test_daemon.py index 70afe3ce3..d85f95521 100644 --- a/tests/regression/ust/daemon/test_daemon.py +++ b/tests/regression/ust/daemon/test_daemon.py @@ -44,14 +44,7 @@ enable_ust_tracepoint_event(session_info, "*") start_session(session_info) daemon_process = subprocess.Popen(test_path + "daemon", stdout=subprocess.PIPE) -if sys.version_info >= (3, 3): - try: - daemon_process_return_code = daemon_process.wait(5) - except subprocess.TimeoutExpired: - daemon_process.kill() - daemon_process_return_code = -1 -else: - daemon_process_return_code = daemon_process.wait() +daemon_process_return_code = daemon_process.wait() daemon_process_output = daemon_process.communicate()[0] daemon_process_output = daemon_process_output.decode('utf-8').splitlines() diff --git a/tests/regression/ust/exit-fast/test_exit-fast.py b/tests/regression/ust/exit-fast/test_exit-fast.py index fbe3c857a..77261539a 100644 --- a/tests/regression/ust/exit-fast/test_exit-fast.py +++ b/tests/regression/ust/exit-fast/test_exit-fast.py @@ -48,29 +48,13 @@ test_env = os.environ.copy() test_env["LTTNG_UST_REGISTER_TIMEOUT"] = "-1" exit_fast_process = subprocess.Popen(test_path + "exit-fast", stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=test_env) - -if sys.version_info >= (3, 3): - try: - exit_fast_process.wait(5) - except subprocess.TimeoutExpired: - exit_fast_process.kill() - bail("Failed to run exit-fast test application.") -else: - exit_fast_process.wait() +exit_fast_process.wait() print_test_result(exit_fast_process.returncode == 0, current_test, "Test application exited normally") current_test += 1 exit_fast_process = subprocess.Popen([test_path + "exit-fast", "suicide"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=test_env) - -if sys.version_info >= (3, 3): - try: - exit_fast_process.wait(5) - except subprocess.TimeoutExpired: - exit_fast_process.kill() - bail("Failed to run exit-fast test application in suicide mode.") -else: - exit_fast_process.wait() +exit_fast_process.wait() stop_session(session_info) diff --git a/tests/regression/ust/fork/test_fork.py b/tests/regression/ust/fork/test_fork.py index ec444aef7..3baa8cc38 100644 --- a/tests/regression/ust/fork/test_fork.py +++ b/tests/regression/ust/fork/test_fork.py @@ -43,15 +43,7 @@ enable_ust_tracepoint_event(session_info, "ust_tests_fork*") start_session(session_info) fork_process = subprocess.Popen([test_path + "fork", test_path + "fork2"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) - -if sys.version_info >= (3, 3): - try: - fork_process.wait(5) - except subprocess.TimeoutExpired: - fork_process.kill() - bail("Failed to run fork test application (time out)", session_info) -else: - fork_process.wait() +fork_process.wait() parent_pid = -1 child_pid = -1 diff --git a/tests/regression/ust/libc-wrapper/test_libc-wrapper.py b/tests/regression/ust/libc-wrapper/test_libc-wrapper.py index 8f3222cc3..545d5662f 100644 --- a/tests/regression/ust/libc-wrapper/test_libc-wrapper.py +++ b/tests/regression/ust/libc-wrapper/test_libc-wrapper.py @@ -43,14 +43,7 @@ enable_ust_tracepoint_event(session_info, "lttng_ust_libc*") start_session(session_info) malloc_process = subprocess.Popen(test_path + "prog", stdout=subprocess.PIPE, stderr=subprocess.PIPE) -if sys.version_info >= (3, 3): - try: - malloc_process.wait(5) - except subprocess.TimeoutExpired: - malloc_process.kill() - bail("Failed to run libustinstr-malloc test application.", session_info) -else: - malloc_process.wait() +malloc_process.wait() print_test_result(malloc_process.returncode == 0, current_test, "Test application exited normally") current_test += 1 diff --git a/tests/regression/ust/linking/test_linking.py b/tests/regression/ust/linking/test_linking.py index f2081f807..29128aa29 100644 --- a/tests/regression/ust/linking/test_linking.py +++ b/tests/regression/ust/linking/test_linking.py @@ -111,14 +111,7 @@ if DYNAMIC_TEST_ENABLED: # Dry run, no events should be logged demo_process = subprocess.Popen(test_path + "demo", stdout=subprocess.PIPE, stderr=subprocess.PIPE) - if sys.version_info >= (3 ,3): - try: - demo_process.wait(5) - except subprocess.TimeoutExpired: - demo_process.kill() - bail("Failed to run demo test application without preloading") - else: - demo_process.wait() + demo_process.wait() stop_session(session_info) print_test_result(demo_process.returncode == 0, current_test,\ @@ -137,14 +130,7 @@ for executable in test_executables: start_session(session_info) demo_process = subprocess.Popen(executable, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - if sys.version_info >= (3, 3): - try: - demo_process.wait(5) - except subprocess.TimeoutExpired: - demo_process.kill() - bail("Failed to run {0} test application".format(executable_name)) - else: - demo_process.wait() + demo_process.wait() stop_session(session_info) trace_found = os.path.exists(session_info.trace_path) -- 2.34.1