File: warn_processes.sh

package info (click to toggle)
ltt-control 2.14.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 21,860 kB
  • sloc: cpp: 192,012; sh: 28,777; ansic: 10,960; python: 7,108; makefile: 3,520; java: 109; xml: 46
file content (34 lines) | stat: -rwxr-xr-x 806 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
#
# SPDX-FileCopyrightText: 2016 Michael Jeanson <mjeanson@efficios.com>
#
# SPDX-License-Identifier: GPL-2.0-only
#

if [ -z $PGREP ]; then
	PGREP=pgrep
fi

if [ x$LTTNG_TOOLS_TESTS_DISABLE_WARN_LTTNG_PROCESSES == x1 ]; then
	exit
fi

color_error='\E[1;91m'
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_error}Error: 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
	echo "The test suite will not run in the presence of those processes since its result may not be reliable."
	echo
	exit 1
fi