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