yetus-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [2/2] yetus git commit: YETUS-611. xml test should specfically say which files are broken
Date Wed, 22 Aug 2018 23:22:43 GMT
YETUS-611. xml test should specfically say which files are broken

Signed-off-by: Jack Bearden <jack@jackbearden.com>


Project: http://git-wip-us.apache.org/repos/asf/yetus/repo
Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/cc91d613
Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/cc91d613
Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/cc91d613

Branch: refs/heads/master
Commit: cc91d61343ceb8a55bce5ecb3c91a4f1825d75ff
Parents: 444b200
Author: Allen Wittenauer <aw@apache.org>
Authored: Sun Aug 19 09:00:49 2018 -0700
Committer: Allen Wittenauer <aw@apache.org>
Committed: Wed Aug 22 16:19:40 2018 -0700

----------------------------------------------------------------------
 precommit/test-patch.d/xml.sh | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/yetus/blob/cc91d613/precommit/test-patch.d/xml.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/xml.sh b/precommit/test-patch.d/xml.sh
index 6460522..1e56905 100755
--- a/precommit/test-patch.d/xml.sh
+++ b/precommit/test-patch.d/xml.sh
@@ -14,6 +14,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+declare -a XML_FILES
+
 add_test_type xml
 
 function xml_filefilter
@@ -57,21 +59,32 @@ function xml_postcompile
   pushd "${BASEDIR}" >/dev/null
   for i in "${CHANGED_FILES[@]}"; do
     if [[ ${i} =~ \.xml$ && -f ${i} ]]; then
-      ${js} -e "XMLDocument(arguments[0])" "${i}" >> "${PATCH_DIR}/xml.txt" 2>&1
-      if [[ $? != 0 ]]; then
+      if ! "${js}" -e "XMLDocument(arguments[0])" "${i}" > "${PATCH_DIR}/xml.txt.tmp"
2>&1; then
+        {
+          echo ""
+          echo "${i}:"
+          echo ""
+          cat "${PATCH_DIR}/xml.txt.tmp"
+        } >> "${PATCH_DIR}/xml.txt"
         ((count=count+1))
+        XML_FILES+=("${i}")
       fi
     fi
   done
 
+  popd >/dev/null
+
+  if [[ -f "${PATCH_DIR}/xml.txt.tmp" ]]; then
+    rm "${PATCH_DIR}/xml.txt.tmp"
+  fi
+
   if [[ ${count} -gt 0 ]]; then
     add_vote_table -1 xml "${BUILDMODEMSG} has ${count} ill-formed XML file(s)."
     add_footer_table xml "@@BASE@@/xml.txt"
-    popd >/dev/null
+    populate_test_table "XML" "Parsing Error(s):" "${XML_FILES[@]}"
     return 1
   fi
 
-  popd >/dev/null
   add_vote_table +1 xml "${BUILDMODEMSG} has no ill-formed XML file."
   return 0
 }


Mime
View raw message