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

Thomas Guillem thomas at gllm.fr
Tue Nov 27 17:38:05 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
---

Changes since last patch:
 - use $() instead of ``
 - use sed instead of grep|cut|tail|awk
 - fix one hardcored test-suite.log value

 test/make_check_wrapper.sh | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 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..8ac3acf996
--- /dev/null
+++ b/test/make_check_wrapper.sh
@@ -0,0 +1,36 @@
+#!/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=$(sed -n 's/^# FAIL: *\([^ ]\+\)/\1/p' "$i")
+    if [ $error_cnt -gt 0 ];then
+        cat "$i"
+
+        test_path=$(dirname "$i")
+        core_path="$test_path/core"
+        failing_test=$(sed -n 's/^FAIL \([^ ]\+\) (exit status:.*/\1/p' ${test_path}/test-suite.log)
+        if [ -f "$core_path" -a ! -z "$failing_test" ];then
+            echo "Printing core dump:"
+            echo ""
+            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