X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=tests%2Futils%2Fwarn_processes.sh;fp=tests%2Futils%2Fwarn_processes.sh;h=fee1d0f58bfa24d0d716ab7a60e2bcd6d9c0c232;hb=4c2eee7f21682b9b4ea1311ec8d86ad1f877daf9;hp=0000000000000000000000000000000000000000;hpb=98c781ff7ebdf6430228c5128dd706ee37532d79;p=lttng-tools.git diff --git a/tests/utils/warn_processes.sh b/tests/utils/warn_processes.sh new file mode 100755 index 000000000..fee1d0f58 --- /dev/null +++ b/tests/utils/warn_processes.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +PGREP="$1" + +if [ x$LTTNG_TOOLS_TESTS_DISABLE_WARN_LTTNG_PROCESSES == x1 ]; then + exit +fi + +color_warn='\E[1;33m' +color_reset='\E[0m' +color_bold='\E[1m' + +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 + 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 +fi