yetus-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject yetus git commit: YETUS-142. compile gets limited to 'warning' in generic log handler
Date Wed, 04 Nov 2015 00:48:44 GMT
Repository: yetus
Updated Branches:
  refs/heads/YETUS-83 1a9afeebe -> d0f68471b


YETUS-142. compile gets limited to 'warning' in generic log handler

Signed-off-by: Allen Wittenauer <aw@apache.org>


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

Branch: refs/heads/YETUS-83
Commit: d0f68471bc72a12633d7003969f54bace5cf8d5d
Parents: 1a9afee
Author: Allen Wittenauer <aw@apache.org>
Authored: Mon Nov 2 22:13:46 2015 -0800
Committer: Allen Wittenauer <aw@apache.org>
Committed: Tue Nov 3 16:48:36 2015 -0800

----------------------------------------------------------------------
 precommit/test-patch.d/ant.sh    | 32 +++++++----------
 precommit/test-patch.d/cc.sh     | 11 ++++--
 precommit/test-patch.d/gradle.sh | 37 +++++++++++--------
 precommit/test-patch.d/java.sh   | 26 ++++++++++++++
 precommit/test-patch.d/maven.sh  | 21 +++++------
 precommit/test-patch.d/scala.sh  | 26 ++++++++++++++
 precommit/test-patch.sh          | 67 ++++++++++++++++++-----------------
 7 files changed, 137 insertions(+), 83 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/yetus/blob/d0f68471/precommit/test-patch.d/ant.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/ant.sh b/precommit/test-patch.d/ant.sh
index d521aad..31c5881 100755
--- a/precommit/test-patch.d/ant.sh
+++ b/precommit/test-patch.d/ant.sh
@@ -119,36 +119,30 @@ function ant_modules_worker
   esac
 }
 
-function ant_javac_count_probs
+## @description  Helper for generic_logfilter
+## @audience     private
+## @stability    evolving
+## @replaceable  no
+function ant_javac_logfilter
 {
-  declare warningfile=$1
-  declare val1
-  declare val2
+  declare input=$1
+  declare output=$2
 
   #shellcheck disable=SC2016
-  val1=$(${GREP} -E "\[javac\] [0-9]+ errors?$" "${warningfile}" | ${AWK} '{sum+=$2} END
{print sum}')
-  #shellcheck disable=SC2016
-  val2=$(${GREP} -E "\[javac\] [0-9]+ warnings?$" "${warningfile}" | ${AWK} '{sum+=$2} END
{print sum}')
-  echo $((val1+val2))
+  ${GREP} "\[javac\] /" "${input}" > "${output}"
 }
 
-## @description  Helper for check_patch_javadoc
+## @description  Helper for generic_logfilter
 ## @audience     private
 ## @stability    evolving
 ## @replaceable  no
-## @return       0 on success
-## @return       1 on failure
-function ant_javadoc_count_probs
+function ant_javadoc_logfilter
 {
-  local warningfile=$1
-  local val1
-  local val2
+  declare input=$1
+  declare output=$2
 
   #shellcheck disable=SC2016
-  val1=$(${GREP} -E "\[javadoc\] [0-9]+ errors?$" "${warningfile}" | ${AWK} '{sum+=$2} END
{print sum}')
-  #shellcheck disable=SC2016
-  val2=$(${GREP} -E "\[javadoc\] [0-9]+ warnings?$" "${warningfile}" | ${AWK} '{sum+=$2}
END {print sum}')
-  echo $((val1+val2))
+  ${GREP} "\[javadoc\] /" "${input}" > "${output}"
 }
 
 function ant_builtin_personality_modules

http://git-wip-us.apache.org/repos/asf/yetus/blob/d0f68471/precommit/test-patch.d/cc.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/cc.sh b/precommit/test-patch.d/cc.sh
index cae91d3..f411028 100755
--- a/precommit/test-patch.d/cc.sh
+++ b/precommit/test-patch.d/cc.sh
@@ -54,10 +54,15 @@ function cc_compile
   fi
 }
 
-function cc_count_probs
+## @description  Helper for generic_logfilter
+## @audience     private
+## @stability    evolving
+## @replaceable  no
+function cc_logfilter
 {
-  declare warningfile=$1
+  declare input=$1
+  declare output=$2
 
   #shellcheck disable=SC2016,SC2046
-  ${GREP} -E '^.*\.(c|cc|h|hh)\:[[:digit:]]*\:' "${warningfile}" | ${AWK} '{sum+=1} END {print
sum}'
+  ${GREP} -E '^.*\.(c|cc|h|hh|.cxx|.cpp)\:[[:digit:]]*\:' "${input}" > "${output}"
 }

http://git-wip-us.apache.org/repos/asf/yetus/blob/d0f68471/precommit/test-patch.d/gradle.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/gradle.sh b/precommit/test-patch.d/gradle.sh
index 15f14d0..4a4e4d2 100755
--- a/precommit/test-patch.d/gradle.sh
+++ b/precommit/test-patch.d/gradle.sh
@@ -127,36 +127,43 @@ function gradle_precompile
   return 0
 }
 
-function gradle_scalac_count_probs
+## @description  Helper for generic_logfilter
+## @audience     private
+## @stability    evolving
+## @replaceable  no
+function gradle_javac_logfilter
 {
-  local warningfile=$1
+  declare input=$1
+  declare output=$2
 
   #shellcheck disable=SC2016,SC2046
-  ${GREP} "^/.*.scala:[0-9]*:" "${warningfile}" | wc -l
+  ${GREP} "\.java" "${input}" > "${output}"
 }
 
-function gradle_javac_count_probs
+## @description  Helper for generic_logfilter
+## @audience     private
+## @stability    evolving
+## @replaceable  no
+function gradle_javadoc_logfilter
 {
-  echo 0
-}
+  declare input=$1
+  declare output=$2
 
-function gradle_javadoc_count_probs
-{
-  echo 0
+  #shellcheck disable=SC2016,SC2046
+  ${GREP} "javadoc.*\.java" "${input}" > "${output}"
 }
 
-## @description  Helper for check_patch_javadoc
+## @description  Helper for generic_logfilter
 ## @audience     private
 ## @stability    evolving
 ## @replaceable  no
-## @return       0 on success
-## @return       1 on failure
-function gradle_scaladoc_count_probs
+function gradle_scaladoc_logfilter
 {
-  local warningfile=$1
+  declare input=$1
+  declare output=$2
 
   #shellcheck disable=SC2016,SC2046
-  ${GREP} "^\[ant:scaladoc\]" "${warningfile}" | wc -l
+  ${GREP} "^\[ant:scaladoc\] /.*\.scala" "${input}" > "${output}"
 }
 
 function gradle_modules_worker

http://git-wip-us.apache.org/repos/asf/yetus/blob/d0f68471/precommit/test-patch.d/java.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/java.sh b/precommit/test-patch.d/java.sh
index 49a220f..ff66150 100755
--- a/precommit/test-patch.d/java.sh
+++ b/precommit/test-patch.d/java.sh
@@ -184,3 +184,29 @@ function javadoc_rebuild
     generic_post_handler javadoc javadoc "${multijdkmode}" true
   fi
 }
+
+## @description  Helper for generic_logfilter
+## @audience     private
+## @stability    evolving
+## @replaceable  no
+function javac_logfilter
+{
+  declare input=$1
+  declare output=$2
+
+  #shellcheck disable=SC2016,SC2046
+  ${GREP} "^.*.java:[0-9]*:" "${input}" > "${output}"
+}
+
+## @description  Helper for generic_logfilter
+## @audience     private
+## @stability    evolving
+## @replaceable  no
+function javadoc_logfilter
+{
+  declare input=$1
+  declare output=$2
+
+  #shellcheck disable=SC2016,SC2046
+  ${GREP} "^.*.java:[0-9]*:" "${input}" > "${output}"
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/yetus/blob/d0f68471/precommit/test-patch.d/maven.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/maven.sh b/precommit/test-patch.d/maven.sh
index c3cf12a..5a25130 100755
--- a/precommit/test-patch.d/maven.sh
+++ b/precommit/test-patch.d/maven.sh
@@ -222,17 +222,12 @@ function maven_modules_worker
   esac
 }
 
-function maven_javac_count_probs
+function maven_javac_logfilter
 {
-  local warningfile=$1
+  declare input=$1
+  declare output=$2
 
-  #shellcheck disable=SC2016,SC2046
-  ${GREP} '\[WARNING\]' "${warningfile}" | ${AWK} '{sum+=1} END {print sum}'
-}
-
-function maven_scalac_count_probs
-{
-  echo 0
+  ${GREP} -E '\[(ERROR|WARNING)\] /.*\.java:' "${input}" > "${output}"
 }
 
 ## @description  Helper for check_patch_javadoc
@@ -241,12 +236,12 @@ function maven_scalac_count_probs
 ## @replaceable  no
 ## @return       0 on success
 ## @return       1 on failure
-function maven_javadoc_count_probs
+function maven_javadoc_logfilter
 {
-  local warningfile=$1
+  declare input=$1
+  declare output=$2
 
-  #shellcheck disable=SC2016,SC2046
-  ${GREP} -E "^[0-9]+ warnings?$" "${warningfile}" | ${AWK} '{sum+=$1} END {print sum}'
+  ${GREP} -E '\[(ERROR|WARNING)\] /.*\.java:' "${input}" > "${output}"
 }
 
 function maven_builtin_personality_modules

http://git-wip-us.apache.org/repos/asf/yetus/blob/d0f68471/precommit/test-patch.d/scala.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/scala.sh b/precommit/test-patch.d/scala.sh
index 06aa86f..dee2bd2 100755
--- a/precommit/test-patch.d/scala.sh
+++ b/precommit/test-patch.d/scala.sh
@@ -74,4 +74,30 @@ function scaladoc_rebuild
   else
     generic_post_handler scaladoc scaladoc false true
   fi
+}
+
+## @description  Helper for generic_logfilter
+## @audience     private
+## @stability    evolving
+## @replaceable  no
+function scalac_logfilter
+{
+  declare input=$1
+  declare output=$2
+
+  #shellcheck disable=SC2016,SC2046
+  ${GREP} "^/.*.scala:[0-9]*:" "${input}" > "${output}"
+}
+
+## @description  Helper for generic_logfilter
+## @audience     private
+## @stability    evolving
+## @replaceable  no
+function scaladoc_logfilter
+{
+  declare input=$1
+  declare output=$2
+
+  #shellcheck disable=SC2016,SC2046
+  ${GREP} "^/.*.scala:[0-9]*:" "${input}" > "${output}"
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/yetus/blob/d0f68471/precommit/test-patch.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.sh b/precommit/test-patch.sh
index fad543b..72ca097 100755
--- a/precommit/test-patch.sh
+++ b/precommit/test-patch.sh
@@ -2107,19 +2107,20 @@ function calcdiffs
 ## @stability    evolving
 ## @replaceable  no
 ## @return       number of issues
-function generic_count_probs
+function generic_logfilter
 {
   declare testtype=$1
   declare input=$2
-
-  if declare -f ${PROJECT_NAME}_${testtype}_count_probs >/dev/null; then
-    "${PROJECT_NAME}_${testtype}_count_probs" "${input}"
-  elif declare -f ${BUILDTOOL}_${testtype}_count_probs >/dev/null; then
-    "${BUILDTOOL}_${testtype}_count_probs" "${input}"
-  elif declare -f ${testtype}_count_probs >/dev/null; then
-    "${testtype}_count_probs" "${input}"
+  declare output=$3
+
+  if declare -f ${PROJECT_NAME}_${testtype}_logfilter >/dev/null; then
+    "${PROJECT_NAME}_${testtype}_logfilter" "${input}" "${output}"
+  elif declare -f ${BUILDTOOL}_${testtype}_logfilter >/dev/null; then
+    "${BUILDTOOL}_${testtype}_logfilter" "${input}" "${output}"
+  elif declare -f ${testtype}_logfilter >/dev/null; then
+    "${testtype}_logfilter" "${input}" "${output}"
   else
-    yetus_error "ERROR: ${testtype}: No function defined to count problems."
+    yetus_error "ERROR: ${testtype}: No function defined to filter problems."
     echo 0
   fi
 }
@@ -2192,6 +2193,9 @@ function generic_postlog_compare
   declare fn
   declare jdk
   declare statusjdk
+  declare numbranch
+  declare numpatch
+  declare diffpatch
 
   if [[ ${multijdk} == true ]]; then
     jdk=$(report_jvm_version "${JAVA_HOME}")
@@ -2218,39 +2222,36 @@ function generic_postlog_compare
     yetus_debug "${testtype}: branch-${origlog}-${fn}.txt vs. patch-${origlog}-${fn}.txt"
 
     # if it was a new module, this won't exist.
-    if [[ -f "${PATCH_DIR}/branch-${origlog}-${fn}.txt" ]]; then
-      ${GREP} -i warning "${PATCH_DIR}/branch-${origlog}-${fn}.txt" \
-        > "${PATCH_DIR}/branch-${testtype}-${fn}-warning.txt"
-    else
-      touch "${PATCH_DIR}/branch-${origlog}-${fn}.txt" \
-        "${PATCH_DIR}/branch-${testtype}-${fn}-warning.txt"
+    if [[ ! -f "${PATCH_DIR}/branch-${origlog}-${fn}.txt" ]]; then
+      touch "${PATCH_DIR}/branch-${origlog}-${fn}.txt"
     fi
 
-    if [[ -f "${PATCH_DIR}/patch-${origlog}-${fn}.txt" ]]; then
-      ${GREP} -i warning "${PATCH_DIR}/patch-${origlog}-${fn}.txt" \
-        > "${PATCH_DIR}/patch-${testtype}-${fn}-warning.txt"
-    else
-      touch "${PATCH_DIR}/patch-${origlog}-${fn}.txt" \
-        "${PATCH_DIR}/patch-${testtype}-${fn}-warning.txt"
+    if [[ ! -f "${PATCH_DIR}/patch-${origlog}-${fn}.txt" ]]; then
+      touch "${PATCH_DIR}/patch-${origlog}-${fn}.txt"
     fi
 
-    numbranch=$("generic_count_probs" "${testtype}" "${PATCH_DIR}/branch-${testtype}-${fn}-warning.txt")
-    numpatch=$("generic_count_probs" "${testtype}" "${PATCH_DIR}/patch-${testtype}-${fn}-warning.txt")
+    generic_logfilter "${testtype}" "${PATCH_DIR}/branch-${origlog}-${fn}.txt" "${PATCH_DIR}/branch-${origlog}-${testtype}-${fn}.txt"
+    generic_logfilter "${testtype}" "${PATCH_DIR}/patch-${origlog}-${fn}.txt" "${PATCH_DIR}/patch-${origlog}-${testtype}-${fn}.txt"
 
-    yetus_debug "${testtype}: old: ${numbranch} vs new: ${numpatch}"
+    numbranch=$(wc -l "${PATCH_DIR}/branch-${origlog}-${testtype}-${fn}.txt" | ${AWK} '{print
$1}')
+    numpatch=$(wc -l "${PATCH_DIR}/patch-${origlog}-${testtype}-${fn}.txt" | ${AWK} '{print
$1}')
 
-    if [[ -n ${numbranch}
-       && -n ${numpatch}
-       && ${numpatch} -gt ${numbranch} ]]; then
+    calcdiffs \
+      "${PATCH_DIR}/branch-${origlog}-${testtype}-${fn}.txt" \
+      "${PATCH_DIR}/patch-${origlog}-${testtype}-${fn}.txt" \
+      > "${PATCH_DIR}/diff-${origlog}-${testtype}-${fn}.txt"
 
-      ${DIFF} -u "${PATCH_DIR}/branch-${testtype}-${fn}-warning.txt" \
-        "${PATCH_DIR}/patch-${testtype}-${fn}-warning.txt" \
-        > "${PATCH_DIR}/${testtype}-${fn}-diff.txt"
+    diffpatch=$(wc -l "${PATCH_DIR}/diff-${origlog}-${testtype}-${fn}.txt" | ${AWK} '{print
$1}')
 
-      add_vote_table -1 "${testtype}" "${fn}${statusjdk} has problems."
-      add_footer_table "${testtype}" "${fn}: @@BASE@@/${testtype}-${fn}-diff.txt"
+    echo ""
+    echo "${module_suffix}/${testtype}: ${diffpatch} new issues (was ${numbranch}, now ${numpatch})."
 
-      ((result=result+1))
+    if [[ ${diffpatch} -gt 0 ]] ; then
+      ((result = result + 1))
+
+      add_vote_table -1 "${testtype}" "${fn}${statusjdk} generated " \
+        "${diffpatch} new issues (was ${numbranch}, now ${numpatch}). "
+      add_footer_table "${testtype}" "${fn}: @@BASE@@/diff-${origlog}-${testtype}-${fn}.txt"
     fi
     ((i=i+1))
   done


Mime
View raw message