[vlc-devel] [PATCH 2/2] test: add make_check_wrapper.sh

Thomas Guillem thomas at gllm.fr
Tue Nov 27 15:02:19 CET 2018


This helper will print on the standard input the failing test-suite.log and
core dump in case of a failing make check.

This script should be used by build bots in order to find the root cause of
failing tests.

See https://jenkins.videolan.org/job/vlc-continuous/job/vlc-cont-debian-x86_64/5852/console
---
 test/make_check_wrapper.sh | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100755 test/make_check_wrapper.sh

diff --git a/test/make_check_wrapper.sh b/test/make_check_wrapper.sh
new file mode 100755
index 0000000000..0d1058d273
--- /dev/null
+++ b/test/make_check_wrapper.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# Helper used to print more information (log + core dump) about a failing test
+
+ulimit -c unlimited
+
+make check $*
+ret=$?
+
+if [ $ret -eq 0 ] || ! (which gdb >/dev/null);then
+    exit $ret
+fi
+
+# test failed
+
+for i in `find -name test-suite.log`;do
+    # Search for a failing test
+    error_cnt=`grep "# FAIL:" "$i" | awk '{print $3}'`
+    if [ $error_cnt -gt 0 ];then
+        cat "$i"
+        echo ""
+        echo "Printing core dump:"
+        echo ""
+
+        test_path=`dirname "$i"`
+        core_path="$test_path/core"
+        failing_line=`tail -2 test/test-suite.log | grep "FAIL " | grep "(exit status:"`
+        if [ -f "$core_path" -a ! -z "$failing_line" ];then
+            failing_test=`echo $failing_line | awk '{print $2}'`
+            gdb "$test_path/$failing_test" -c "$core_path" \
+                -ex "set pagination off" \
+                -ex "thread apply all bt" \
+                -ex "quit"
+        fi
+    fi
+done
+
+exit $ret
-- 
2.19.2



More information about the vlc-devel mailing list