make check: add warning when LTTng processes are running
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 1 Sep 2015 02:32:11 +0000 (22:32 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 11 Nov 2015 22:25:45 +0000 (17:25 -0500)
This patch adds a warning when running LTTng/test processes are
detected at the beginning of make check. It offers a convenient
way to kill them and warns the user that some tests could fail
if the processes are kept alive.

The check can be disabled by setting
$LTTNG_TOOLS_TESTS_DISABLE_WARN_LTTNG_PROCESSES to 1

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
configure.ac
tests/Makefile.am
tests/utils/Makefile.am
tests/utils/warn_lttng_processes.sh [new file with mode: 0755]

index 6020596a1da7d2bbb412f64c68f459bd5e0d6776..4a0673e768535d1bc53be2c555e356cd209a8035 100644 (file)
@@ -703,6 +703,10 @@ AM_CONDITIONAL([BUILD_LIB_SESSIOND_COMM], [test x$build_lib_sessiond_comm = xyes
 AM_CONDITIONAL([BUILD_LIB_TESTPOINT], [test x$build_lib_testpoint = xyes])
 AM_CONDITIONAL([BUILD_LIB_UST_CONSUMER], [test x$build_lib_ust_consumer = xyes])
 
+# check for pgrep
+AC_PATH_PROG([PGREP], [pgrep], [no])
+AM_CONDITIONAL([HAS_PGREP], [test "x$PGREP" != "xno"])
+
 if test ! -f "$srcdir/src/lib/lttng-ctl/filter/filter-parser.h"; then
        if test x"$(basename "$YACC")" != "xbison -y"; then
                AC_MSG_ERROR([[bison not found and is required when building from git.
index 99c20422e0cfbfca5231d3bd1046420f8e3c3fca..31a958ec354d246417a7d41094ac2bec028294ca 100644 (file)
@@ -7,6 +7,9 @@ endif
 
 installcheck-am:
 if BUILD_TESTS
+if HAS_PGREP
+       ./utils/warn_lttng_processes.sh $(PGREP)
+endif
        ./run.sh unit_tests
        ./run.sh fast_regression
 if PYTHON_BINDING
@@ -20,6 +23,9 @@ endif
 
 check-am:
 if BUILD_TESTS
+if HAS_PGREP
+       ./utils/warn_lttng_processes.sh $(PGREP)
+endif
        ./run.sh unit_tests
        ./run.sh fast_regression
 if PYTHON_BINDING
index b3d5929738f4d8c7d92b929763685ca3cda8c717..f43233d8637d87a372d9a2325de9a3d9b1df3e7e 100644 (file)
@@ -1,7 +1,7 @@
 SUBDIRS = tap testapp
 
-EXTRA_DIST = utils.sh test_utils.py babelstats.pl
-dist_noinst_SCRIPTS = utils.sh test_utils.py babelstats.pl
+EXTRA_DIST = utils.sh test_utils.py babelstats.pl warn_lttng_processes.sh
+dist_noinst_SCRIPTS = utils.sh test_utils.py babelstats.pl warn_lttng_processes.sh
 
 all-local:
        @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
diff --git a/tests/utils/warn_lttng_processes.sh b/tests/utils/warn_lttng_processes.sh
new file mode 100755 (executable)
index 0000000..939163b
--- /dev/null
@@ -0,0 +1,23 @@
+#!/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
This page took 0.037331 seconds and 4 git commands to generate.