From 8c0f24404bebffdaf3132d81e2b9560d34ff1677 Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@intel.com>
Date: Thu, 12 Mar 2020 17:25:45 +0000
Subject: [PATCH 6/7] autotest-automake-result-format.patch

Upstream-Status: Inappropriate [oe specific]
---
 lib/autotest/general.m4 | 39 +++++++++++++++++++++++++++++----------
 1 file changed, 29 insertions(+), 10 deletions(-)

diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4
index 0c0e3c5b..17590e96 100644
--- a/lib/autotest/general.m4
+++ b/lib/autotest/general.m4
@@ -412,6 +412,9 @@ at_recheck=
 # Whether a write failure occurred
 at_write_fail=0
 
+# Automake result format "result: testname"
+at_am_fmt=false
+
 # The directory we run the suite in.  Default to . if no -C option.
 at_dir=`pwd`
 # An absolute reference to this testsuite script.
@@ -525,6 +528,10 @@ do
 	at_check_filter_trace=at_fn_filter_trace
 	;;
 
+    --am-fmt | -A )
+	at_am_fmt=:
+	;;
+
     [[0-9] | [0-9][0-9] | [0-9][0-9][0-9] | [0-9][0-9][0-9][0-9]])
 	at_fn_validate_ranges at_option
 	AS_VAR_APPEND([at_groups], ["$at_option$as_nl"])
@@ -713,10 +720,10 @@ m4_divert_push([HELP_MODES])dnl
 cat <<_ATEOF || at_write_fail=1
 
 Operation modes:
-  -h, --help     print the help message, then exit
-  -V, --version  print version number, then exit
-  -c, --clean    remove all the files this test suite might create and exit
-  -l, --list     describes all the tests, or the selected TESTS
+  -h, --help      print the help message, then exit
+  -V, --version   print version number, then exit
+  -c, --clean     remove all the files this test suite might create and exit
+  -l, --list      describes all the tests, or the selected TESTS
 _ATEOF
 m4_divert_pop([HELP_MODES])dnl
 m4_wrap([m4_divert_push([HELP_TUNING_BEGIN])dnl
@@ -742,6 +749,7 @@ Execution tuning:
   -d, --debug    inhibit clean up and top-level logging
 [                 default for debugging scripts]
   -x, --trace    enable tests shell tracing
+  -A, --am-fmt   automake result format "result: testname"
 _ATEOF
 m4_divert_pop([HELP_TUNING_BEGIN])])dnl
 m4_divert_push([HELP_END])dnl
@@ -1129,7 +1137,9 @@ at_fn_group_banner ()
     [*])          at_desc_line="$[1]: "  ;;
   esac
   AS_VAR_APPEND([at_desc_line], ["$[3]$[4]"])
-  $at_quiet AS_ECHO_N(["$at_desc_line"])
+  if ! $at_am_fmt; then
+    $at_quiet AS_ECHO_N(["$at_desc_line"])
+  fi
   echo "#                             -*- compilation -*-" >> "$at_group_log"
 }
 
@@ -1155,42 +1165,51 @@ _ATEOF
   case $at_xfail:$at_status in
     yes:0)
 	at_msg="UNEXPECTED PASS"
+	at_am_msg="XPASS"
 	at_res=xpass
 	at_errexit=$at_errexit_p
 	at_color=$at_red
 	;;
     no:0)
 	at_msg="ok"
+	at_am_msg="PASS"
 	at_res=pass
 	at_errexit=false
 	at_color=$at_grn
 	;;
     *:77)
 	at_msg='skipped ('`cat "$at_check_line_file"`')'
+	at_am_msg="SKIP"
 	at_res=skip
 	at_errexit=false
 	at_color=$at_blu
 	;;
     no:* | *:99)
 	at_msg='FAILED ('`cat "$at_check_line_file"`')'
+	at_am_msg="FAIL"
 	at_res=fail
 	at_errexit=$at_errexit_p
 	at_color=$at_red
 	;;
     yes:*)
 	at_msg='expected failure ('`cat "$at_check_line_file"`')'
+	at_am_msg="XFAIL"
 	at_res=xfail
 	at_errexit=false
 	at_color=$at_lgn
 	;;
   esac
   echo "$at_res" > "$at_job_dir/$at_res"
-  # In parallel mode, output the summary line only afterwards.
-  if test $at_jobs -ne 1 && test -n "$at_verbose"; then
-    AS_ECHO(["$at_desc_line $at_color$at_msg$at_std"])
+  if $at_am_fmt; then
+      AS_ECHO(["$at_am_msg: $at_desc"])
   else
-    # Make sure there is a separator even with long titles.
-    AS_ECHO([" $at_color$at_msg$at_std"])
+    # In parallel mode, output the summary line only afterwards.
+    if test $at_jobs -ne 1 && test -n "$at_verbose"; then
+      AS_ECHO(["$at_desc_line $at_color$at_msg$at_std"])
+    else
+      # Make sure there is a separator even with long titles.
+      AS_ECHO([" $at_color$at_msg$at_std"])
+    fi
   fi
   at_log_msg="$at_group. $at_desc ($at_setup_line): $at_msg"
   case $at_status in
-- 
2.25.1

