[FFmpeg-devel,v2,7/8] fate: run command and get logs rungetavlogs() allows to get avlog messages

Submitted by Gaullier Nicolas on Feb. 12, 2018, 9:48 a.m.

Details

Message ID 20180212094830.9304-7-nicolas.gaullier@arkena.com
State New
Headers show

Commit Message

Gaullier Nicolas Feb. 12, 2018, 9:48 a.m.
From: nicolas gaullier <nicolas.gaullier@arkena.com>

---
 tests/fate-run.sh | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Patch hide | download patch | download mbox

diff --git a/tests/fate-run.sh b/tests/fate-run.sh
index 05f4ca5e20..0f28af5858 100755
--- a/tests/fate-run.sh
+++ b/tests/fate-run.sh
@@ -84,6 +84,20 @@  runecho(){
     $target_exec $target_path/"$@" >&3
 }
 
+# $1=regex $2..$n=command
+# catch av_log messages
+rungetavlogs(){
+    test "${V:-0}" -gt 0 && echo "$target_exec" $target_path/"${@:2}" >&3
+    $target_exec $target_path/"${@:2}" 3>&2 2>&1 1>&3|awk -F' ' "{
+        if (/${@:1:1}/) {
+            for(i=4; i<=NF; ++i)
+                printf \$i FS
+            print \"\"
+        } else {
+            print > \"/dev/stderr\"}
+        }"
+}
+
 probefmt(){
     run ffprobe${PROGSUF} -show_entries format=format_name -print_format default=nw=1:nk=1 -v 0 "$@"
 }