[RFC PATCH] t: move metadata into TAP test description

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



662f9cf154 (tests: when run in Bash, annotate test failures with file
name/line number, 2020-04-11) adds metadata to the TAP output to help
identify the location of the failed test, but does it in a way that
break the TAP format and therefore confuses prove.

Move the metadata to the description to workaround the issue and
change the regex from 676eb0c1ce (ci: add a problem matcher for GitHub
Actions, 2020-04-11) to match.

Reported-by: Alban Gruin <alban.gruin@xxxxxxxxx>
---
 ci/git-problem-matcher.json | 10 +++++-----
 t/test-lib.sh               |  6 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/ci/git-problem-matcher.json b/ci/git-problem-matcher.json
index 506dfbd97f..e10e88bba1 100644
--- a/ci/git-problem-matcher.json
+++ b/ci/git-problem-matcher.json
@@ -4,11 +4,11 @@
             "owner": "git-test-suite",
             "pattern": [
                 {
-                    "regexp": "^([^ :]+\\.sh):(\\d+): (error|warning|info):\\s+(.*)$",
-                    "file": 1,
-                    "line": 2,
-                    "severity": 3,
-                    "message": 4
+                    "regexp": "^(.*)(error|warning|info):\\([^ :]+\\.sh):(\\d+)\\)$",
+                    "file": 3,
+                    "line": 4,
+                    "severity": 2,
+                    "message": 1
                 }
             ]
         }
diff --git a/t/test-lib.sh b/t/test-lib.sh
index baf94546da..d5f59ab3bf 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -682,8 +682,8 @@ file_lineno () {
 		for i in ${!BASH_SOURCE[*]}
 		do
 			case $i,"${BASH_SOURCE[$i]##*/}" in
-			0,t[0-9]*.sh) echo "t/${BASH_SOURCE[$i]}:$LINENO: ${1+$1: }"; return;;
-			*,t[0-9]*.sh) echo "t/${BASH_SOURCE[$i]}:${BASH_LINENO[$(($i-1))]}: ${1+$1: }"; return;;
+			0,t[0-9]*.sh) echo "(${1+$1:}t/${BASH_SOURCE[$i]}:$LINENO)"; return;;
+			*,t[0-9]*.sh) echo "(${1+$1:}t/${BASH_SOURCE[$i]}:${BASH_LINENO[$(($i-1))]})"; return;;
 			esac
 		done
 	'
@@ -734,7 +734,7 @@ test_failure_ () {
 		write_junit_xml_testcase "$1" "      $junit_insert"
 	fi
 	test_failure=$(($test_failure + 1))
-	say_color error "$(file_lineno error)not ok $test_count - $1"
+	say_color error "not ok $test_count - $1$(file_lineno error)"
 	shift
 	printf '%s\n' "$*" | sed -e 's/^/#	/'
 	test "$immediate" = "" || { finalize_junit_xml; GIT_EXIT_OK=t; exit 1; }
-- 
2.26.2.812.g046d49d455




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux