Tests: Make warn_processes.sh more portable
authorMichael Jeanson <mjeanson@efficios.com>
Thu, 9 Jun 2016 16:21:31 +0000 (12:21 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 14 Jun 2016 14:34:30 +0000 (10:34 -0400)
Options to pgrep aren't standardised across coreutils
implementations, use a more common option.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/Makefile.am
tests/utils/Makefile.am
tests/utils/warn_lttng_processes.sh [deleted file]
tests/utils/warn_processes.sh [new file with mode: 0755]

index 58caeb1590fde8fdd33feb4e658b4f1f182d1bc5..3600e99d87786920764a65c4d84b839a826a41cc 100644 (file)
@@ -5,7 +5,7 @@ if BUILD_TESTS
 SUBDIRS += . utils regression unit stress destructive
 if HAS_PGREP
 check-am:
-       $(top_srcdir)/tests/utils/warn_lttng_processes.sh $(PGREP)
+       $(top_srcdir)/tests/utils/warn_processes.sh $(PGREP)
 endif
 else
        @echo "========================================="
index bd79d20e3f901acac651b385830b845305d33fc7..9d327e0ec7b96fbb0aa554dab2699ffcbb765bd5 100644 (file)
@@ -1,6 +1,6 @@
 SUBDIRS = . tap testapp
 
-EXTRA_DIST = utils.sh test_utils.py babelstats.pl warn_lttng_processes.sh
+EXTRA_DIST = utils.sh test_utils.py babelstats.pl warn_processes.sh
 dist_noinst_SCRIPTS = utils.sh test_utils.py babelstats.pl
 noinst_LTLIBRARIES = libtestutils.la
 
diff --git a/tests/utils/warn_lttng_processes.sh b/tests/utils/warn_lttng_processes.sh
deleted file mode 100755 (executable)
index 939163b..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-
-if [ x$LTTNG_TOOLS_TESTS_DISABLE_WARN_LTTNG_PROCESSES == x1 ]; then
-       exit
-fi
-
-color_warn='\E[1;33m'
-color_reset='\E[0m'
-color_bold='\E[1m'
-
-lttng_processes="$("$1" 'lttng|gen-ust-.+' -a | grep -v "$(basename "$0")")"
-
-if [ $? -eq 0 ]; then
-       pids="$(cut -d ' ' -f 1 <<< "$lttng_processes" | tr '\n' ' ')"
-
-       echo -e "${color_warn}Warning: 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 -e "${color_warn}If you leave them alive, some tests could fail.$color_reset"
-       echo
-fi
diff --git a/tests/utils/warn_processes.sh b/tests/utils/warn_processes.sh
new file mode 100755 (executable)
index 0000000..fee1d0f
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+PGREP="$1"
+
+if [ x$LTTNG_TOOLS_TESTS_DISABLE_WARN_LTTNG_PROCESSES == x1 ]; then
+       exit
+fi
+
+color_warn='\E[1;33m'
+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_warn}Warning: 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 -e "${color_warn}If you leave them alive, some tests could fail.$color_reset"
+       echo
+fi
This page took 0.026865 seconds and 4 git commands to generate.