| 1 | #!/bin/bash |
| 2 | |
| 3 | if [ -z $PGREP ]; then |
| 4 | PGREP=pgrep |
| 5 | fi |
| 6 | |
| 7 | if [ x$LTTNG_TOOLS_TESTS_DISABLE_WARN_LTTNG_PROCESSES == x1 ]; then |
| 8 | exit |
| 9 | fi |
| 10 | |
| 11 | color_error='\E[1;91m' |
| 12 | color_reset='\E[0m' |
| 13 | color_bold='\E[1m' |
| 14 | |
| 15 | lttng_processes="$("$PGREP" -l 'lttng|gen-ust-.+')" |
| 16 | |
| 17 | if [ $? -eq 0 ]; then |
| 18 | pids="$(cut -d ' ' -f 1 <<< "$lttng_processes" | tr '\n' ' ')" |
| 19 | |
| 20 | echo -e "${color_error}Error: the following LTTng processes were detected running on the system:$color_reset" |
| 21 | echo |
| 22 | echo "$lttng_processes" |
| 23 | echo |
| 24 | echo -e "Here's how to kill them: ${color_bold}kill -9 $pids$color_reset" |
| 25 | echo |
| 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 |
| 29 | fi |