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 21:37:32 GMT
Repository: yetus
Updated Branches:
  refs/heads/master ca0fa9f5f -> f2fefdb23


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

Signed-off-by: Chris Nauroth <cnauroth@apache.org>


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

Branch: refs/heads/master
Commit: f2fefdb23ede6942e2aa3b228108a20421e717fe
Parents: ca0fa9f
Author: Allen Wittenauer <aw@apache.org>
Authored: Mon Nov 2 22:13:46 2015 -0800
Committer: Allen Wittenauer <aw@apache.org>
Committed: Wed Nov 4 13:36:38 2015 -0800

----------------------------------------------------------------------
 precommit/test-patch.d/ant.sh    | 32 +++++++----------
 precommit/test-patch.d/cc.sh     | 30 +++++++++-------
 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, 146 insertions(+), 93 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/yetus/blob/f2fefdb2/precommit/test-patch.d/ant.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/ant.sh b/precommit/test-patch.d/ant.sh
index 9d931a5..6fc9e2f 100755
--- a/precommit/test-patch.d/ant.sh
+++ b/precommit/test-patch.d/ant.sh
@@ -108,36 +108,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/f2fefdb2/precommit/test-patch.d/cc.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/cc.sh b/precommit/test-patch.d/cc.sh
index cae91d3..eb8ce4e 100755
--- a/precommit/test-patch.d/cc.sh
+++ b/precommit/test-patch.d/cc.sh
@@ -16,21 +16,20 @@
 
 add_test_type cc
 
+CC_EXT_RE='(c|cc|cpp|cxx|c\+\+|h|hh|hpp|hxx|h\+\+)'
+
 function cc_filefilter
 {
   declare filename=$1
 
-  if [[ ${filename} =~ \.c$
-      || ${filename} =~ \.cc$
-      || ${filename} =~ \.cpp$
-      || ${filename} =~ \.cxx$
-      || ${filename} =~ \.h$
-      || ${filename} =~ \.hh$
-     ]]; then
-   yetus_debug "tests/cc: ${filename}"
-   add_test cc
-   add_test compile
+  shopt -s nocasematch
+  if [[ ${filename} =~ \.${CC_EXT_RE}$ ]]; then
+    shopt -u nocasematch
+    yetus_debug "tests/cc: ${filename}"
+    add_test cc
+    add_test compile
   fi
+  shopt -u nocasematch
 }
 
 ## @description  check for C/C++ compiler errors
@@ -54,10 +53,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} -i -E "^.*\.${CC_EXT_RE}\:[[:digit:]]*\:" "${input}" > "${output}"
 }

http://git-wip-us.apache.org/repos/asf/yetus/blob/f2fefdb2/precommit/test-patch.d/gradle.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/gradle.sh b/precommit/test-patch.d/gradle.sh
index 56da8d5..2a5fb42 100755
--- a/precommit/test-patch.d/gradle.sh
+++ b/precommit/test-patch.d/gradle.sh
@@ -114,36 +114,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/f2fefdb2/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/f2fefdb2/precommit/test-patch.d/maven.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/maven.sh b/precommit/test-patch.d/maven.sh
index 1f9b35d..43e2b0b 100755
--- a/precommit/test-patch.d/maven.sh
+++ b/precommit/test-patch.d/maven.sh
@@ -212,17 +212,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
@@ -231,12 +226,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/f2fefdb2/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/f2fefdb2/precommit/test-patch.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.sh b/precommit/test-patch.sh
index 6b398ad..5cd5912 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