This is an automated email from the ASF dual-hosted git repository.

sdedic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new 233ec7a  Better junit reporting, add stderr/out
     new 84bd3ea  Merge pull request #3450 from sdedic/infra/junit-report2
233ec7a is described below

commit 233ec7a288891ccd4a4873864a172712bd8a7ef1
Author: Svata Dedic <[email protected]>
AuthorDate: Wed Jan 12 18:48:49 2022 +0100

    Better junit reporting, add stderr/out
---
 nbbuild/travis/print-junit-report.sh | 41 ++++++++++++++++++++++++++++++------
 1 file changed, 35 insertions(+), 6 deletions(-)

diff --git a/nbbuild/travis/print-junit-report.sh 
b/nbbuild/travis/print-junit-report.sh
index 63f0237..9288a13 100755
--- a/nbbuild/travis/print-junit-report.sh
+++ b/nbbuild/travis/print-junit-report.sh
@@ -17,18 +17,47 @@
 # specific language governing permissions and limitations
 # under the License.
 
-echo junit report / failed tests:
+# 
+files=$(grep -L 'errors="0".*failures="0"' 
./*/*/build/test/*/results/TEST-*.xml 2> /dev/null) || exit 0
 
-ls ./*/*/build/test/*/results/TEST-*.xml | while read file ;
-do
-    TEST=$(xmllint --xpath '//testsuite[@failures>0]/@name' $file 2>/dev/null)
+echo =================== JUnit Report Summary / failed tests 
===================
+realfiles=''
+for file in $files ; do 
+    TEST=$(xmllint --xpath '//testsuite[@errors>0 or @failures>0]/@name' $file 
2>/dev/null)
     status=$?
 
     if [ $status -eq 0 ]; then
+        realfiles="$realfiles $file"
         echo
         echo $TEST | cut -f2 -d '=' | tr -d '"'
-        xmllint --xpath '//testsuite/testcase[./failure]/@name' $file | cut 
-f2 -d '=' | xargs -L1 echo "    failed:"
+        xmllint --xpath '//testsuite/testcase[./failure]/@name' $file 2> 
/dev/null | sed -r 's/name="([^"]+)"/     failed: \1\n/g' 
+        xmllint --xpath '//testsuite/testcase[./error]/@name' $file 2> 
/dev/null | sed -r 's/name="([^"]+)"/     errored: \1\n/g' 
     fi
 done
 
-echo end of report
+echo
+echo ====================== JUnit failure details 
===============================
+echo
+for file in $realfiles ; do 
+    classname=$(xmllint --xpath '//testsuite[@errors>0 or @failures>0]/@name' 
$file 2>/dev/null | cut -f2 -d '=' | tr -d '"')
+    echo Suite: $classname 
+    
+    for err in $(xmllint --xpath 
"//testsuite/testcase[@classname='${classname}'][./error]/@name" $file 2> 
/dev/null | sed -r 's/name="([^"]+)"/\1/g') ; do 
+        msg=$(xmllint --xpath "//testsuite/testcase[@classname='${classname}' 
and @name='${err}']/error/@message" $file 2> /dev/null | sed -r 
's/message="([^"]+)"/\1/g' )
+        echo "      $err ERRORED : $msg"
+        xmllint --xpath "//testsuite/testcase[@classname='${classname}' and 
@name='${err}']/error/text()" $file 2> /dev/null | sed -r 's/^(.*$)/          
\1/g'
+    done 
+    for err in $(xmllint --xpath 
"//testsuite/testcase[@classname='${classname}'][./failure]/@name" $file 2> 
/dev/null | sed -r 's/name="([^"]+)"/\1/g') ; do 
+        msg=$(xmllint --xpath "//testsuite/testcase[@classname='${classname}' 
and @name='${err}']/failure/@message" $file 2> /dev/null | sed -r 
's/message="([^"]+)"/\1/g' )
+        echo "      $err FAILED : $msg"
+        xmllint --xpath "//testsuite/testcase[@classname='${classname}' and 
@name='${err}']/failure/text()" $file 2> /dev/null | sed -r 's/^(.*$)/          
\1/g'
+    done 
+    text=$(xmllint --nocdata --xpath "//testsuite//system-out/text()" $file)
+    [ -n "$text" ] && { echo "Stdout 
----------%<----------%<-------------%<-------------%<---------------" ; echo 
"$text" ; }
+    text=$(xmllint --nocdata --xpath "//testsuite//system-err/text()" $file)
+    [ -n "$text" ] && { echo "Stderr 
----------%<----------%<-------------%<-------------%<---------------" ; echo 
"$text" ; }
+    echo "------------- End suite $classname ------------"
+    
+done
+echo
+echo ======================= End of JUnit report 
===============================

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to