From b6e2447a0a8d7fcd62c9c592082f5543eb10ade4 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 --- .../baddr-statedump/test_baddr-statedump.py | 9 +-------- 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 ++--------------- .../test_type_declarations.py | 10 +--------- tests/regression/ust/ust-dl/test_ust-dl.py | 10 +--------- 8 files changed, 10 insertions(+), 85 deletions(-) diff --git a/tests/regression/ust/baddr-statedump/test_baddr-statedump.py b/tests/regression/ust/baddr-statedump/test_baddr-statedump.py index 723eb1ba6..53f9dedd8 100644 --- a/tests/regression/ust/baddr-statedump/test_baddr-statedump.py +++ b/tests/regression/ust/baddr-statedump/test_baddr-statedump.py @@ -46,14 +46,7 @@ enable_ust_tracepoint_event(session_info, "*") start_session(session_info) test_process = subprocess.Popen(test_path + "prog.strip", stdout=subprocess.PIPE, stderr=subprocess.PIPE) -if sys.version_info >= (3, 3): - try: - test_process.wait(5) - except subprocess.TimeoutExpired: - test_process.kill() - bail("Failed to run ust baddr-statedump test application.", session_info) -else: - test_process.wait() +test_process.wait() print_test_result(test_process.returncode == 0, current_test, "Test application exited normally") current_test += 1 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) diff --git a/tests/regression/ust/type-declarations/test_type_declarations.py b/tests/regression/ust/type-declarations/test_type_declarations.py index 6f2d5ff68..b2fa282a1 100644 --- a/tests/regression/ust/type-declarations/test_type_declarations.py +++ b/tests/regression/ust/type-declarations/test_type_declarations.py @@ -45,15 +45,7 @@ test_env = os.environ.copy() test_env["LTTNG_UST_REGISTER_TIMEOUT"] = "-1" td_process = subprocess.Popen(test_path + "type-declarations", stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=test_env) - -if sys.version_info >= (3, 3): - try: - td_process.wait(5) - except TimeoutExpired: - td_process.kill() - bail("Failed to run type-declarations test application.") -else: - td_process.wait() +td_process.wait() print_test_result(td_process.returncode == 0, current_test, "Test application exited normally") current_test += 1 diff --git a/tests/regression/ust/ust-dl/test_ust-dl.py b/tests/regression/ust/ust-dl/test_ust-dl.py index 9801012a7..d9bc60a75 100644 --- a/tests/regression/ust/ust-dl/test_ust-dl.py +++ b/tests/regression/ust/ust-dl/test_ust-dl.py @@ -51,15 +51,7 @@ test_env["LD_LIBRARY_PATH"] = test_env.get("LD_LIBRARY_PATH", "") + ":" + test_p test_process = subprocess.Popen(test_path + "prog", stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=test_env) - -if sys.version_info >= (3, 3): - try: - test_process.wait(5) - except subprocess.TimeoutExpired: - test_process.kill() - bail("Failed to run ust-dl test application.", session_info) -else: - test_process.wait() +test_process.wait() print_test_result(test_process.returncode == 0, current_test, "Test application exited normally") current_test += 1 -- 2.34.1