SoW-2019-0002: Dynamic Snapshot
[lttng-tools.git] / tests / utils / warn_processes.sh
... / ...
CommitLineData
1#!/bin/bash
2#
3# Copyright (C) 2016 Michael Jeanson <mjeanson@efficios.com>
4#
5# SPDX-License-Identifier: GPL-2.0-only
6#
7
8if [ -z $PGREP ]; then
9 PGREP=pgrep
10fi
11
12if [ x$LTTNG_TOOLS_TESTS_DISABLE_WARN_LTTNG_PROCESSES == x1 ]; then
13 exit
14fi
15
16color_error='\E[1;91m'
17color_reset='\E[0m'
18color_bold='\E[1m'
19
20lttng_processes="$("$PGREP" -l 'lttng|gen-ust-.+')"
21
22if [ $? -eq 0 ]; then
23 pids="$(cut -d ' ' -f 1 <<< "$lttng_processes" | tr '\n' ' ')"
24
25 echo -e "${color_error}Error: the following LTTng processes were detected running on the system:$color_reset"
26 echo
27 echo "$lttng_processes"
28 echo
29 echo -e "Here's how to kill them: ${color_bold}kill -9 $pids$color_reset"
30 echo
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
34fi
This page took 0.023326 seconds and 5 git commands to generate.