yetus-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bus...@apache.org
Subject yetus git commit: YETUS-553 Add configuration options for junit plugin
Date Thu, 26 Oct 2017 15:01:56 GMT
Repository: yetus
Updated Branches:
  refs/heads/master 2ce16aa2e -> 7e7dcbe65


YETUS-553 Add configuration options for junit plugin

Signed-off-by: Sean Busbey <busbey@apache.org>


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

Branch: refs/heads/master
Commit: 7e7dcbe6561a478488330673ec534b6fb6ce33c4
Parents: 2ce16aa
Author: Mano Kovacs <manokovacs@gmail.com>
Authored: Mon Oct 2 20:28:28 2017 +0200
Committer: Sean Busbey <busbey@apache.org>
Committed: Sun Oct 22 01:05:34 2017 -0500

----------------------------------------------------------------------
 precommit/test-patch.d/junit.sh | 30 +++++++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/yetus/blob/7e7dcbe6/precommit/test-patch.d/junit.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/junit.sh b/precommit/test-patch.d/junit.sh
index 4393511..0bbe23e 100755
--- a/precommit/test-patch.d/junit.sh
+++ b/precommit/test-patch.d/junit.sh
@@ -19,6 +19,31 @@ add_test_format junit
 JUNIT_TEST_TIMEOUTS=""
 JUNIT_FAILED_TESTS=""
 
+JUNIT_TEST_OUTPUT_DIR="."
+JUNIT_TEST_PREFIX="org.apache."
+
+function junit_usage
+{
+  yetus_add_option "--junit-test-output=<path>" "Directory to search for the test output
TEST-*.xml files, relative to the module directory (default:'${JUNIT_TEST_OUTPUT_DIR}')"
+  yetus_add_option "--junit-test-prefix=<prefix to trim>" "Prefix of test names to
be be removed. Used to shorten test names by removing common package name. (default:'${JUNIT_TEST_PREFIX}')"
+}
+
+function junit_parse_args
+{
+  declare i
+
+  for i in "$@"; do
+    case ${i} in
+      --junit-test-output=*)
+        JUNIT_TEST_OUTPUT_DIR=${i#*=}
+      ;;
+      --junit-test-prefix=*)
+        JUNIT_TEST_PREFIX=${i#*=}
+      ;;
+    esac
+  done
+}
+
 function junit_process_tests
 {
   # shellcheck disable=SC2034
@@ -36,10 +61,9 @@ function junit_process_tests
   fi
 
   #shellcheck disable=SC2026,SC2038,SC2016
-  module_failed_tests=$(find . -name 'TEST*.xml'\
+  module_failed_tests=$(find "${JUNIT_TEST_OUTPUT_DIR}" -name 'TEST*.xml'\
     | xargs "${GREP}" -l -E "<failure|<error"\
-    | ${AWK} -F/ '{sub("TEST-org.apache.",""); sub(".xml",""); print $NF}')
-
+    | ${AWK} -F/ '{sub("'"TEST-${JUNIT_TEST_PREFIX}"'",""); sub(".xml",""); print $NF}')
   if [[ -n "${module_failed_tests}" ]] ; then
     JUNIT_FAILED_TESTS="${JUNIT_FAILED_TESTS} ${module_failed_tests}"
     ((result=result+1))


Mime
View raw message