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

jungm pushed a commit to branch ee11
in repository https://gitbox.apache.org/repos/asf/tomee-tck.git


The following commit(s) were added to refs/heads/ee11 by this push:
     new 2311593  Surface JavaTest suite results as JUnit XML for CI ingestion
2311593 is described below

commit 2311593dcc48338620eeffea97e34e01ed2b2e41
Author: Markus Jung <[email protected]>
AuthorDate: Sun Jul 19 23:03:14 2026 +0200

    Surface JavaTest suite results as JUnit XML for CI ingestion
    
    The JT Harness suites (transactions, security-old, faces-old) report only
    through the harness work/report directories, so the Jenkins junit step never
    saw their per-test results. run-standalone-suite.sh now converts the harness
    text report into JUnit XML under target/surefire-reports/ after every run,
    embedding each failed test's .jtr harness log in its failure element; the
    existing Jenkinsfile junit and archive globs pick it up unchanged.
---
 Jenkinsfile                                   |   1 +
 runner-standalone/README.md                   |   9 +++
 runner-standalone/javatest-report-to-junit.sh | 111 ++++++++++++++++++++++++++
 runner-standalone/run-standalone-suite.sh     |  19 ++++-
 4 files changed, 139 insertions(+), 1 deletion(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index 720d272..78c1058 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -60,6 +60,7 @@ pipeline {
           sh -n runner-webprofile/run-platform-suite.sh
           sh -n runner-standalone/run-standalone-suite.sh
           sh -n runner-standalone/verify-invoker-result.sh
+          sh -n runner-standalone/javatest-report-to-junit.sh
           sh -n runner-smoke/run-smoke-suite.sh
         '''
         sh '''python3 -c '
diff --git a/runner-standalone/README.md b/runner-standalone/README.md
index 30e0e5c..4748227 100644
--- a/runner-standalone/README.md
+++ b/runner-standalone/README.md
@@ -38,6 +38,15 @@ so the runner selects TomEE's HTTP port around 8080 and 
leaves it free.
 Maven build compiles these modules but runs nothing; execution requires
 `-Dtck.standalone=true` (the script passes it).
 
+The JavaTest-harness suites (`transactions`, `security-old`, `faces-old`)
+report through the JT Harness work/report directories instead of surefire.
+After each run (red or green) `run-standalone-suite.sh` converts the harness
+text report into JUnit XML under the module's `target/surefire-reports/` via
+[javatest-report-to-junit.sh](javatest-report-to-junit.sh), embedding each
+failed test's `.jtr` harness log in its `<failure>` element, so CI's junit
+ingestion shows per-test results and failure logs alongside the archived
+HTML report.
+
 Every wired runner applies the reviewed known-gap exclusion list from
 [exclusions/](exclusions/README.md) by default, so a default run is expected
 green and a failure is a regression. Pass
diff --git a/runner-standalone/javatest-report-to-junit.sh 
b/runner-standalone/javatest-report-to-junit.sh
new file mode 100644
index 0000000..693326c
--- /dev/null
+++ b/runner-standalone/javatest-report-to-junit.sh
@@ -0,0 +1,111 @@
+#!/bin/sh
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0.
+
+# Converts a JT Harness (JavaTest) run of a legacy old-tck suite into JUnit
+# XML so the Jenkins junit step can surface per-test results.
+#
+#   runner-standalone/javatest-report-to-junit.sh <module-dir>
+#
+# Statuses come from the harness text report (target/*report/<suite>/text/
+# summary.txt, one "<file>#<testid>  <Status>." line per test). For failed
+# and errored tests the matching .jtr file in the work directory
+# (target/*work/<suite>/) text-format sibling of the report - contributes
+# the harness log from its testresult section as the failure body, so the
+# Jenkins test page shows the per-test log without the archived HTML report.
+# The XML lands in target/surefire-reports/, which the Jenkinsfile junit and
+# archiveArtifacts globs already ingest; these antrun-driven modules run no
+# surefire themselves, so the directory is otherwise unused.
+#
+# Only POSIX sh, awk and tr are used: the suites run inside plain
+# eclipse-temurin containers that ship no python.
+
+set -eu
+
+MODULE_DIR=${1:?usage: javatest-report-to-junit.sh <module-dir>}
+MODULE_DIR=$(CDPATH= cd -- "$MODULE_DIR" && pwd)
+TARGET="$MODULE_DIR/target"
+MODULE=$(basename "$MODULE_DIR")
+
+converted=0
+for summary in "$TARGET"/*report/*/text/summary.txt; do
+  [ -f "$summary" ] || continue
+  reportdir=${summary%/text/summary.txt}   # .../<x>report/<suite>
+  suite=${reportdir##*/}
+  prefix=${reportdir%/*}; prefix=${prefix##*/}; prefix=${prefix%report}
+  workdir="$TARGET/${prefix}work/$suite"
+  out="$TARGET/surefire-reports/TEST-javatest.$MODULE.$suite.xml"
+
+  mkdir -p "$TARGET/surefire-reports"
+  awk -v WORK="$workdir" -v SUITE="javatest-$MODULE" '
+    function xesc(s) {
+      gsub(/&/, "\\&amp;", s); gsub(/</, "\\&lt;", s)
+      gsub(/>/, "\\&gt;", s); gsub(/"/, "\\&quot;", s)
+      return s
+    }
+    # Reads the .jtr from its testresult section on (skipping the noisy
+    # description/environment dumps), stripping XML-invalid control chars.
+    function jtrbody(jtr,   cmd, l, started, content) {
+      cmd = "tr -d \047\\000-\\010\\013\\014\\016-\\037\047 2>/dev/null < 
\047" jtr "\047"
+      started = 0; content = ""
+      while ((cmd | getline l) > 0) {
+        if (!started) {
+          if (l ~ /^#-----testresult-----/) started = 1
+          continue
+        }
+        if (l ~ /^execStatus=/) { msg = substr(l, 12); gsub(/\\/, "", msg) }
+        content = content l "\n"
+      }
+      close(cmd)
+      if (length(content) > 100000)
+        content = "[truncated, showing tail]\n" substr(content, 
length(content) - 100000)
+      return content
+    }
+    {
+      if (match($0, /  +/) == 0) next
+      ref = substr($0, 1, RSTART - 1)
+      status = substr($0, RSTART + RLENGTH)
+      h = index(ref, "#"); if (h == 0) next
+      path = substr(ref, 1, h - 1)
+      id = substr(ref, h + 1)
+
+      classname = path; sub(/\.java$/, "", classname); gsub(/\//, ".", 
classname)
+      dir = path; sub(/\/[^\/]*$/, "", dir)
+      base = path; sub(/^.*\//, "", base); sub(/\.java$/, "", base)
+      jtr = WORK "/" dir "/" base "_" id ".jtr"
+
+      tests++
+      open = "  <testcase classname=\"" xesc(classname) "\" name=\"" xesc(id) 
"\""
+      if (status ~ /^Passed/) {
+        cases = cases open "/>\n"
+      } else if (status ~ /^Not run/) {
+        skipped++
+        cases = cases open ">\n    <skipped/>\n  </testcase>\n"
+      } else {
+        tag = (status ~ /^Failed/) ? "failure" : "error"
+        if (tag == "failure") failures++; else errors++
+        msg = status
+        body = jtrbody(jtr)
+        if (body == "") body = "(no .jtr found at " jtr ")"
+        cases = cases open ">\n    <" tag " message=\"" xesc(msg) "\">" \
+                xesc(body) "</" tag ">\n  </testcase>\n"
+      }
+    }
+    END {
+      printf "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+      printf "<testsuite name=\"%s\" tests=\"%d\" failures=\"%d\" 
errors=\"%d\" skipped=\"%d\">\n", \
+        SUITE, tests, failures + 0, errors + 0, skipped + 0
+      printf "%s", cases
+      printf "</testsuite>\n"
+    }
+  ' "$summary" > "$out"
+  echo "javatest-report-to-junit: wrote $out" >&2
+  converted=$((converted + 1))
+done
+
+if [ "$converted" -eq 0 ]; then
+  echo "javatest-report-to-junit: no JavaTest report under $TARGET" >&2
+fi
diff --git a/runner-standalone/run-standalone-suite.sh 
b/runner-standalone/run-standalone-suite.sh
index 75aea95..541eb0c 100755
--- a/runner-standalone/run-standalone-suite.sh
+++ b/runner-standalone/run-standalone-suite.sh
@@ -123,8 +123,25 @@ if [ "$selected" = yes ]; then
   echo "run-standalone-suite: selected ports http=${HTTP:-} https=${HTTPS:-} 
shutdown=${SHUTDOWN:-} derby=${DERBY:-} harness=${HARNESS:-}" >&2
 fi
 
-exec "$ROOT_DIR/mvnw" -B -ntp \
+# No exec: the JavaTest suites need post-processing after Maven returns,
+# red or green - a failed run is exactly when the JUnit conversion matters.
+set +e
+"$ROOT_DIR/mvnw" -B -ntp \
   -pl "$MODULES" -am \
   -Dtck.standalone=true \
   "-Dtomee.classifier=$TOMEE_CLASSIFIER" \
   "$GOAL" "$@"
+MVN_STATUS=$?
+set -e
+
+# Convert the JT Harness report of the legacy JavaTest suites into JUnit XML
+# under target/surefire-reports/ so the Jenkins junit step surfaces per-test
+# results (with the .jtr harness log embedded for failures). Conversion
+# problems never mask the Maven result.
+case "$ID" in
+  transactions|security-old|faces-old)
+    sh "$SCRIPT_DIR/javatest-report-to-junit.sh" "$SCRIPT_DIR/$ID" ||
+      echo "run-standalone-suite: WARN: JavaTest report conversion failed" >&2 
;;
+esac
+
+exit "$MVN_STATUS"

Reply via email to