From e95abc31102d65800185e29919036e53a55e0b93 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Fri, 9 Feb 2018 16:40:39 -0500 Subject: [PATCH] Tests: refuse to run test suite if lttng processes are present MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The test suite often fails because of unclean environments where stale LTTng processes are left running. Since the test suite assumes that no LTTng process (daemons and test applications) are running, it makes sense to force the user to kill all those processes before running the test suite. The warn_processes.sh script now prints an error and returns 1 to indicate an early failure to the test harness. It is possible to circumvent this check by invoking the tests manually or by removing the "exit 1" from the warn_processes.sh script if there is a need to have persistent processes across the execution of the test suite. Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau --- tests/utils/warn_processes.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/utils/warn_processes.sh b/tests/utils/warn_processes.sh index fee1d0f58..6858b8663 100755 --- a/tests/utils/warn_processes.sh +++ b/tests/utils/warn_processes.sh @@ -6,7 +6,7 @@ if [ x$LTTNG_TOOLS_TESTS_DISABLE_WARN_LTTNG_PROCESSES == x1 ]; then exit fi -color_warn='\E[1;33m' +color_error='\E[1;91m' color_reset='\E[0m' color_bold='\E[1m' @@ -15,11 +15,13 @@ lttng_processes="$("$PGREP" -l 'lttng|gen-ust-.+')" if [ $? -eq 0 ]; then pids="$(cut -d ' ' -f 1 <<< "$lttng_processes" | tr '\n' ' ')" - echo -e "${color_warn}Warning: the following LTTng processes were detected running on the system:$color_reset" + echo -e "${color_error}Error: the following LTTng processes were detected running on the system:$color_reset" echo echo "$lttng_processes" echo echo -e "Here's how to kill them: ${color_bold}kill -9 $pids$color_reset" - echo -e "${color_warn}If you leave them alive, some tests could fail.$color_reset" echo + echo "The test suite will not run in the presence of those processes since its result may not be reliable." + echo + exit 1 fi -- 2.34.1