Commit | Line | Data |
---|---|---|
b67cd6f0 PP |
1 | #!/bin/bash |
2 | ||
4c2eee7f MJ |
3 | PGREP="$1" |
4 | ||
b67cd6f0 PP |
5 | if [ x$LTTNG_TOOLS_TESTS_DISABLE_WARN_LTTNG_PROCESSES == x1 ]; then |
6 | exit | |
7 | fi | |
8 | ||
e95abc31 | 9 | color_error='\E[1;91m' |
b67cd6f0 PP |
10 | color_reset='\E[0m' |
11 | color_bold='\E[1m' | |
12 | ||
4c2eee7f | 13 | lttng_processes="$("$PGREP" -l 'lttng|gen-ust-.+')" |
b67cd6f0 PP |
14 | |
15 | if [ $? -eq 0 ]; then | |
16 | pids="$(cut -d ' ' -f 1 <<< "$lttng_processes" | tr '\n' ' ')" | |
17 | ||
e95abc31 | 18 | echo -e "${color_error}Error: the following LTTng processes were detected running on the system:$color_reset" |
b67cd6f0 PP |
19 | echo |
20 | echo "$lttng_processes" | |
21 | echo | |
22 | echo -e "Here's how to kill them: ${color_bold}kill -9 $pids$color_reset" | |
b67cd6f0 | 23 | echo |
e95abc31 JG |
24 | echo "The test suite will not run in the presence of those processes since its result may not be reliable." |
25 | echo | |
26 | exit 1 | |
b67cd6f0 | 27 | fi |