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