Return-Path: X-Original-To: apmail-yetus-commits-archive@minotaur.apache.org Delivered-To: apmail-yetus-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6498818ED3 for ; Wed, 23 Sep 2015 02:23:32 +0000 (UTC) Received: (qmail 30097 invoked by uid 500); 23 Sep 2015 02:23:32 -0000 Delivered-To: apmail-yetus-commits-archive@yetus.apache.org Received: (qmail 30039 invoked by uid 500); 23 Sep 2015 02:23:32 -0000 Mailing-List: contact commits-help@yetus.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@yetus.apache.org Delivered-To: mailing list commits@yetus.apache.org Received: (qmail 29857 invoked by uid 99); 23 Sep 2015 02:23:32 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 23 Sep 2015 02:23:32 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 14210E0440; Wed, 23 Sep 2015 02:23:32 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: busbey@apache.org To: commits@yetus.apache.org Date: Wed, 23 Sep 2015 02:23:46 -0000 Message-Id: In-Reply-To: <0b3197fedc2746eb9a47743e175497b7@git.apache.org> References: <0b3197fedc2746eb9a47743e175497b7@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [16/50] [abbrv] yetus git commit: Convert 'unit' to 'junit' (aw) Convert 'unit' to 'junit' (aw) Project: http://git-wip-us.apache.org/repos/asf/yetus/repo Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/11ad56e2 Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/11ad56e2 Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/11ad56e2 Branch: refs/heads/master Commit: 11ad56e2eb41bbc5e90afc9c8107e57691339a4f Parents: a627ff0 Author: Allen Wittenauer Authored: Mon Aug 3 19:40:51 2015 -0700 Committer: Allen Wittenauer Committed: Mon Aug 3 19:40:51 2015 -0700 ---------------------------------------------------------------------- dev-support/test-patch.d/junit.sh | 68 ++++++++++++++++++++++++++++++++++ dev-support/test-patch.sh | 53 ++++++++++---------------- 2 files changed, 88 insertions(+), 33 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/yetus/blob/11ad56e2/dev-support/test-patch.d/junit.sh ---------------------------------------------------------------------- diff --git a/dev-support/test-patch.d/junit.sh b/dev-support/test-patch.d/junit.sh new file mode 100755 index 0000000..4393511 --- /dev/null +++ b/dev-support/test-patch.d/junit.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash +# 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 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +add_test_format junit + +JUNIT_TEST_TIMEOUTS="" +JUNIT_FAILED_TESTS="" + +function junit_process_tests +{ + # shellcheck disable=SC2034 + declare module=$1 + declare buildlogfile=$2 + declare result=0 + declare module_test_timeouts + declare module_failed_tests + + # shellcheck disable=SC2016 + module_test_timeouts=$(${AWK} '/^Running / { array[$NF] = 1 } /^Tests run: .* in / { delete array[$NF] } END { for (x in array) { print x } }' "${buildlogfile}") + if [[ -n "${module_test_timeouts}" ]] ; then + JUNIT_TEST_TIMEOUTS="${JUNIT_TEST_TIMEOUTS} ${module_test_timeouts}" + ((result=result+1)) + fi + + #shellcheck disable=SC2026,SC2038,SC2016 + module_failed_tests=$(find . -name 'TEST*.xml'\ + | xargs "${GREP}" -l -E "/dev/null 2>&1; then echo "${plugin}_usage" @@ -2940,10 +2941,7 @@ function populate_test_table function check_unittests { local i - local failed_tests="" - local test_timeouts="" local test_logfile - local module_test_timeouts="" local result=0 local -r savejavahome=${JAVA_HOME} local multijdkmode=false @@ -3001,40 +2999,20 @@ function check_unittests fn="${fn}${jdk}" test_logfile="${PATCH_DIR}/patch-unit-${fn}.txt" - # shellcheck disable=2016 - module_test_timeouts=$(${AWK} '/^Running / { array[$NF] = 1 } /^Tests run: .* in / { delete array[$NF] } END { for (x in array) { print x } }' "${test_logfile}") - if [[ -n "${module_test_timeouts}" ]] ; then - test_timeouts="${test_timeouts} ${module_test_timeouts}" - ((result=result+1)) - fi - pushd "${MODULE[${i}]}" >/dev/null - #shellcheck disable=SC2026,SC2038,SC2016 - module_failed_tests=$(find . -name 'TEST*.xml'\ - | xargs "${GREP}" -l -E "/dev/null + for j in ${TESTSYSTEMS}; do + if declare -f ${j}_process_tests; then + "${j}_process_tests" "${module}" "${test_logfile}" + ((results=results+$?)) + fi + done - if [[ -n "${module_failed_tests}" ]] ; then - failed_tests="${failed_tests} ${module_failed_tests}" - ((result=result+1)) - fi + popd >/dev/null ((i=i+1)) done - if [[ -n "${failed_tests}" ]] ; then - # shellcheck disable=SC2086 - populate_test_table "${statusjdk}Failed unit tests" ${failed_tests} - failed_tests="" - fi - if [[ -n "${test_timeouts}" ]] ; then - # shellcheck disable=SC2086 - populate_test_table "${statusjdk}Timed out tests" ${test_timeouts} - test_timeouts="" - fi - done JAVA_HOME=${savejavahome} @@ -3433,7 +3411,7 @@ function importplugins ## @replaceable no function parse_args_plugins { - for plugin in ${PLUGINS} ${BUGSYSTEMS}; do + for plugin in ${PLUGINS} ${BUGSYSTEMS} ${TESTFORMATS}; do if declare -f ${plugin}_parse_args >/dev/null 2>&1; then yetus_debug "Running ${plugin}_parse_args" #shellcheck disable=SC2086 @@ -3452,7 +3430,7 @@ function add_plugin PLUGINS="${PLUGINS} $1" } -## @description Register test-patch.d plugins +## @description Register test-patch.d bugsystems ## @audience public ## @stability stable ## @replaceable no @@ -3461,6 +3439,15 @@ function add_bugsystem BUGSYSTEMS="${BUGSYSTEMS} $1" } +## @description Register test-patch.d test output formats +## @audience public +## @stability stable +## @replaceable no +function add_test_format +{ + TESTFORMATS="${TESTFORMATS} $1" +} + ## @description Calculate the differences between the specified files ## @description and output it to stdout. ## @audience public