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-322. flip verify_ result codes
Date Sat, 19 Mar 2016 18:02:35 GMT
Repository: yetus
Updated Branches:
  refs/heads/master 5f12fe008 -> ce10af004


YETUS-322. flip verify_ result codes

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/ce10af00
Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/ce10af00
Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/ce10af00

Branch: refs/heads/master
Commit: ce10af004f063168c086a178adb7f4df04712600
Parents: 5f12fe0
Author: Allen Wittenauer <aw@apache.org>
Authored: Fri Mar 18 09:07:55 2016 -0700
Committer: Allen Wittenauer <aw@apache.org>
Committed: Sat Mar 19 10:07:26 2016 -0700

----------------------------------------------------------------------
 precommit/core.d/00-yetuslib.sh      |  6 ++--
 precommit/core.d/01-common.sh        |  4 +--
 precommit/personality/flink.sh       |  6 ++--
 precommit/personality/hadoop.sh      | 10 ++----
 precommit/personality/hbase.sh       |  6 ++--
 precommit/test-patch.d/cc.sh         |  3 +-
 precommit/test-patch.d/checkstyle.sh |  6 ++--
 precommit/test-patch.d/findbugs.sh   |  6 ++--
 precommit/test-patch.d/github.sh     |  6 +---
 precommit/test-patch.d/java.sh       |  8 ++---
 precommit/test-patch.d/jira.sh       | 12 +++----
 precommit/test-patch.d/maven.sh      | 14 +++-----
 precommit/test-patch.d/perlcritic.sh |  6 ++--
 precommit/test-patch.d/pylint.sh     |  6 ++--
 precommit/test-patch.d/rubocop.sh    |  6 ++--
 precommit/test-patch.d/ruby-lint.sh  |  6 ++--
 precommit/test-patch.d/scala.sh      |  5 ++-
 precommit/test-patch.d/shellcheck.sh |  6 ++--
 precommit/test-patch.d/shelldocs.sh  |  6 ++--
 precommit/test-patch.d/test4tests.sh |  6 ++--
 precommit/test-patch.d/unitveto.sh   |  8 ++---
 precommit/test-patch.d/xml.sh        |  3 +-
 precommit/test-patch.sh              | 56 +++++++++++--------------------
 23 files changed, 70 insertions(+), 131 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/yetus/blob/ce10af00/precommit/core.d/00-yetuslib.sh
----------------------------------------------------------------------
diff --git a/precommit/core.d/00-yetuslib.sh b/precommit/core.d/00-yetuslib.sh
index 5d0a942..1410b33 100755
--- a/precommit/core.d/00-yetuslib.sh
+++ b/precommit/core.d/00-yetuslib.sh
@@ -69,10 +69,10 @@ function yetus_add_entry
 ## @audience     public
 ## @stability    stable
 ## @replaceable  no
-## @return       1 = yes, 0 = no
+## @return       0 = yes, 1 = no
 function yetus_verify_entry
 {
-  [[ ! ${!1} =~ \ ${2}\  ]]
+  [[ ${!1} =~ \ ${2}\  ]]
 }
 
 ## @description  run the command, sending stdout and stderr to the given filename
@@ -223,4 +223,4 @@ function yetus_generic_columnprinter
     done < <(echo "${giventext}"| fold -s -w ${foldsize})
     ((i=i+1))
   done
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/yetus/blob/ce10af00/precommit/core.d/01-common.sh
----------------------------------------------------------------------
diff --git a/precommit/core.d/01-common.sh b/precommit/core.d/01-common.sh
index 5e49caa..0661f6e 100755
--- a/precommit/core.d/01-common.sh
+++ b/precommit/core.d/01-common.sh
@@ -354,8 +354,8 @@ function delete_test
 ## @stability    stable
 ## @replaceable  yes
 ## @param        test
-## @return       1 = yes
-## @return       0 = no
+## @return       0 = yes
+## @return       1 = no
 function verify_needed_test
 {
   yetus_verify_entry NEEDED_TESTS "${1}"

http://git-wip-us.apache.org/repos/asf/yetus/blob/ce10af00/precommit/personality/flink.sh
----------------------------------------------------------------------
diff --git a/precommit/personality/flink.sh b/precommit/personality/flink.sh
index 071096e..8a077ac 100755
--- a/precommit/personality/flink.sh
+++ b/precommit/personality/flink.sh
@@ -52,8 +52,7 @@ function flinklib_preapply
   start_clock
   big_console_header "${PATCH_BRANCH} flink library dependencies"
 
-  verify_needed_test flinklib
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test flinklib; then
     echo "Patch does not need flinklib testing."
     return 0
   fi
@@ -73,8 +72,7 @@ function flinklib_postapply
   start_clock
   big_console_header "Patch flink library dependencies"
 
-  verify_needed_test flinklib
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test flinklib; then
     echo "Patch does not need flinklib testing."
     return 0
   fi

http://git-wip-us.apache.org/repos/asf/yetus/blob/ce10af00/precommit/personality/hadoop.sh
----------------------------------------------------------------------
diff --git a/precommit/personality/hadoop.sh b/precommit/personality/hadoop.sh
index 1fc0295..1084cd5 100755
--- a/precommit/personality/hadoop.sh
+++ b/precommit/personality/hadoop.sh
@@ -228,20 +228,16 @@ function personality_modules
       needflags=true
       hadoop_unittest_prereqs "${ordering}"
 
-      verify_needed_test javac
-      if [[ $? == 0 ]]; then
+      if ! verify_needed_test javac; then
         yetus_debug "hadoop: javac not requested"
-        verify_needed_test native
-        if [[ $? == 0 ]]; then
+        if ! verify_needed_test native; then
           yetus_debug "hadoop: native not requested"
           yetus_debug "hadoop: adding -DskipTests to unit test"
           extra="-DskipTests"
         fi
       fi
 
-      verify_needed_test shellcheck
-      if [[ $? == 0
-          && ! ${CHANGED_FILES} =~ \.bats ]]; then
+      if ! verify_needed_test shellcheck && [[ ! ${CHANGED_FILES} =~ \.bats ]]; then
         yetus_debug "hadoop: NO shell code change detected; disabling shelltest profile"
         extra="${extra} -P!shelltest"
       else

http://git-wip-us.apache.org/repos/asf/yetus/blob/ce10af00/precommit/personality/hbase.sh
----------------------------------------------------------------------
diff --git a/precommit/personality/hbase.sh b/precommit/personality/hbase.sh
index c38634a..4705903 100755
--- a/precommit/personality/hbase.sh
+++ b/precommit/personality/hbase.sh
@@ -144,8 +144,7 @@ function hbaseprotoc_rebuild
     return 0
   fi
 
-  verify_needed_test hbaseprotoc
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test hbaseprotoc; then
     return 0
   fi
 
@@ -204,8 +203,7 @@ function hbaseanti_patchfile
   local warnings
   local result
 
-  verify_needed_test hbaseanti
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test hbaseanti; then
     return 0
   fi
 

http://git-wip-us.apache.org/repos/asf/yetus/blob/ce10af00/precommit/test-patch.d/cc.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/cc.sh b/precommit/test-patch.d/cc.sh
index eb8ce4e..3241191 100755
--- a/precommit/test-patch.d/cc.sh
+++ b/precommit/test-patch.d/cc.sh
@@ -43,8 +43,7 @@ function cc_compile
   declare codebase=$1
   declare multijdkmode=$2
 
-  verify_needed_test cc
-  if [[ $? = 0 ]]; then
+  if ! verify_needed_test cc; then
     return 0
   fi
 

http://git-wip-us.apache.org/repos/asf/yetus/blob/ce10af00/precommit/test-patch.d/checkstyle.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/checkstyle.sh b/precommit/test-patch.d/checkstyle.sh
index 1ad657a..1c0e078 100755
--- a/precommit/test-patch.d/checkstyle.sh
+++ b/precommit/test-patch.d/checkstyle.sh
@@ -284,8 +284,7 @@ function checkstyle_preapply
 {
   local result
 
-  verify_needed_test checkstyle
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test checkstyle; then
     return 0
   fi
 
@@ -318,8 +317,7 @@ function checkstyle_postapply
   declare addpatch=0
   declare summarize=true
 
-  verify_needed_test checkstyle
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test checkstyle; then
     return 0
   fi
 

http://git-wip-us.apache.org/repos/asf/yetus/blob/ce10af00/precommit/test-patch.d/findbugs.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/findbugs.sh b/precommit/test-patch.d/findbugs.sh
index da073a0..e4399fc 100755
--- a/precommit/test-patch.d/findbugs.sh
+++ b/precommit/test-patch.d/findbugs.sh
@@ -244,8 +244,7 @@ function findbugs_preapply
   declare result=0
   declare msg
 
-  verify_needed_test findbugs
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test findbugs; then
     return 0
   fi
 
@@ -326,8 +325,7 @@ function findbugs_postinstall
   declare summarize=true
   declare statstring
 
-  verify_needed_test findbugs
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test findbugs; then
     return 0
   fi
 

http://git-wip-us.apache.org/repos/asf/yetus/blob/ce10af00/precommit/test-patch.d/github.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/github.sh b/precommit/test-patch.d/github.sh
index b6c9379..b4f5aa0 100755
--- a/precommit/test-patch.d/github.sh
+++ b/precommit/test-patch.d/github.sh
@@ -208,11 +208,7 @@ function github_determine_branch
 
   yetus_debug "Github determine branch: starting with ${PATCH_BRANCH}"
 
-  verify_valid_branch  "${PATCH_BRANCH}"
-  if [[ $? == 0 ]]; then
-    return 0
-  fi
-  return 1
+  verify_valid_branch "${PATCH_BRANCH}"
 }
 
 function github_locate_patch

http://git-wip-us.apache.org/repos/asf/yetus/blob/ce10af00/precommit/test-patch.d/java.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/java.sh b/precommit/test-patch.d/java.sh
index f6880ee..f36c868 100755
--- a/precommit/test-patch.d/java.sh
+++ b/precommit/test-patch.d/java.sh
@@ -157,8 +157,7 @@ function javac_compile
   declare codebase=$1
   declare multijdkmode=$2
 
-  verify_needed_test javac
-  if [[ $? = 0 ]]; then
+  if ! verify_needed_test javac; then
     return 0
   fi
 
@@ -179,9 +178,10 @@ function javadoc_rebuild
   declare codebase=$1
   declare multijdkmode
 
-  verify_multijdk_test javadoc
-  if [[ $? == 1 ]]; then
+  if verify_multijdk_test javadoc; then
     multijdkmode=true
+  else
+    multijdkmode=false
   fi
 
   if [[ "${codebase}" = branch ]]; then

http://git-wip-us.apache.org/repos/asf/yetus/blob/ce10af00/precommit/test-patch.d/jira.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/jira.sh b/precommit/test-patch.d/jira.sh
index a2920b9..60afe00 100755
--- a/precommit/test-patch.d/jira.sh
+++ b/precommit/test-patch.d/jira.sh
@@ -239,8 +239,7 @@ function jira_determine_branch
     PATCH_BRANCH=$(echo "${patchnamechunk}" | cut -f3- -d- | cut -f1,2 -d-)
     yetus_debug "Determine branch: ISSUE-branch-## = ${PATCH_BRANCH}"
     if [[ -n "${PATCH_BRANCH}" ]]; then
-      verify_valid_branch  "${PATCH_BRANCH}"
-      if [[ $? == 0 ]]; then
+      if verify_valid_branch  "${PATCH_BRANCH}"; then
         return 0
       fi
     fi
@@ -255,8 +254,7 @@ function jira_determine_branch
       yetus_debug "Determine branch: ISSUE[.##].branch = ${PATCH_BRANCH}"
       ((total=total-1))
       if [[ -n "${PATCH_BRANCH}" ]]; then
-        verify_valid_branch  "${PATCH_BRANCH}"
-        if [[ $? == 0 ]]; then
+        if verify_valid_branch  "${PATCH_BRANCH}"; then
           return 0
         fi
       fi
@@ -272,8 +270,7 @@ function jira_determine_branch
       yetus_debug "Determine branch: ISSUE.branch[.##] = ${PATCH_BRANCH}"
       ((total=total-1))
       if [[ -n "${PATCH_BRANCH}" ]]; then
-        verify_valid_branch  "${PATCH_BRANCH}"
-        if [[ $? == 0 ]]; then
+        if verify_valid_branch  "${PATCH_BRANCH}"; then
           return 0
         fi
       fi
@@ -289,8 +286,7 @@ function jira_determine_branch
       yetus_debug "Determine branch: ISSUE-branch[.##] = ${PATCH_BRANCH}"
       ((total=total-1))
       if [[ -n "${PATCH_BRANCH}" ]]; then
-        verify_valid_branch  "${PATCH_BRANCH}"
-        if [[ $? == 0 ]]; then
+        if verify_valid_branch  "${PATCH_BRANCH}"; then
           return 0
         fi
       fi

http://git-wip-us.apache.org/repos/asf/yetus/blob/ce10af00/precommit/test-patch.d/maven.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/maven.sh b/precommit/test-patch.d/maven.sh
index 91088f4..3e98957 100755
--- a/precommit/test-patch.d/maven.sh
+++ b/precommit/test-patch.d/maven.sh
@@ -446,8 +446,7 @@ function mvnsite_postcompile
     return 0
   fi
 
-  verify_needed_test mvnsite
-  if [[ $? == 0 ]];then
+  if ! verify_needed_test mvnsite; then
     return 0
   fi
 
@@ -482,8 +481,7 @@ function mvneclipse_postcompile
     return 0
   fi
 
-  verify_needed_test javac
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test javac; then
     return 0
   fi
 
@@ -519,16 +517,14 @@ function maven_precompile
     return 0
   fi
 
-  verify_needed_test javac
-  if [[ $? == 1 ]]; then
+  if verify_needed_test javac; then
     need=true
   else
     # not everything needs a maven install
     # but quite a few do ...
     # shellcheck disable=SC2086
     for index in ${MAVEN_NEED_INSTALL}; do
-      verify_needed_test ${index}
-      if [[ $? == 1 ]]; then
+      if verify_needed_test ${index}; then
          need=branch
       fi
     done
@@ -677,4 +673,4 @@ function maven_reorder_modules
   yetus_debug "Finished list: ${CHANGED_MODULES}"
 
   add_vote_table 0 mvndep "Maven dependency ordering for ${repostatus}"
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/yetus/blob/ce10af00/precommit/test-patch.d/perlcritic.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/perlcritic.sh b/precommit/test-patch.d/perlcritic.sh
index 79a43bc..c346e3d 100755
--- a/precommit/test-patch.d/perlcritic.sh
+++ b/precommit/test-patch.d/perlcritic.sh
@@ -60,8 +60,7 @@ function perlcritic_preapply
 {
   local i
 
-  verify_needed_test perlcritic
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test perlcritic; then
     return 0
   fi
 
@@ -103,8 +102,7 @@ function perlcritic_postapply
   declare fixedpatch
   declare statstring
 
-  verify_needed_test perlcritic
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test perlcritic; then
     return 0
   fi
 

http://git-wip-us.apache.org/repos/asf/yetus/blob/ce10af00/precommit/test-patch.d/pylint.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/pylint.sh b/precommit/test-patch.d/pylint.sh
index c98b2e0..b73d8a0 100755
--- a/precommit/test-patch.d/pylint.sh
+++ b/precommit/test-patch.d/pylint.sh
@@ -67,8 +67,7 @@ function pylint_preapply
   local count
   local pylintStderr=branch-pylint-stderr.txt
 
-  verify_needed_test pylint
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test pylint; then
     return 0
   fi
 
@@ -110,8 +109,7 @@ function pylint_postapply
   declare fixedpatch
   declare statstring
 
-  verify_needed_test pylint
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test pylint; then
     return 0
   fi
 

http://git-wip-us.apache.org/repos/asf/yetus/blob/ce10af00/precommit/test-patch.d/rubocop.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/rubocop.sh b/precommit/test-patch.d/rubocop.sh
index a75b636..070eb55 100755
--- a/precommit/test-patch.d/rubocop.sh
+++ b/precommit/test-patch.d/rubocop.sh
@@ -60,8 +60,7 @@ function rubocop_preapply
 {
   local i
 
-  verify_needed_test rubocop
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test rubocop; then
     return 0
   fi
 
@@ -103,8 +102,7 @@ function rubocop_postapply
   declare fixedpatch
   declare statstring
 
-  verify_needed_test rubocop
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test rubocop; then
     return 0
   fi
 

http://git-wip-us.apache.org/repos/asf/yetus/blob/ce10af00/precommit/test-patch.d/ruby-lint.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/ruby-lint.sh b/precommit/test-patch.d/ruby-lint.sh
index 1586d34..350733e 100755
--- a/precommit/test-patch.d/ruby-lint.sh
+++ b/precommit/test-patch.d/ruby-lint.sh
@@ -59,8 +59,7 @@ function ruby_lint_preapply
 {
   local i
 
-  verify_needed_test ruby_lint
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test ruby_lint; then
     return 0
   fi
 
@@ -133,8 +132,7 @@ function ruby_lint_postapply
   declare fixedpatch
   declare statstring
 
-  verify_needed_test ruby_lint
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test ruby_lint; then
     return 0
   fi
 

http://git-wip-us.apache.org/repos/asf/yetus/blob/ce10af00/precommit/test-patch.d/scala.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/scala.sh b/precommit/test-patch.d/scala.sh
index 87d092c..f2b599a 100755
--- a/precommit/test-patch.d/scala.sh
+++ b/precommit/test-patch.d/scala.sh
@@ -87,8 +87,7 @@ function scalac_compile
   declare codebase=$1
   declare multijdkmode=$2
 
-  verify_needed_test scalac
-  if [[ $? = 0 ]]; then
+  if ! verify_needed_test scalac; then
     return 0
   fi
 
@@ -138,4 +137,4 @@ function scaladoc_logfilter
 
   #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/ce10af00/precommit/test-patch.d/shellcheck.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/shellcheck.sh b/precommit/test-patch.d/shellcheck.sh
index 5de8726..fd5109f 100755
--- a/precommit/test-patch.d/shellcheck.sh
+++ b/precommit/test-patch.d/shellcheck.sh
@@ -74,8 +74,7 @@ function shellcheck_preapply
   declare i
   declare msg
 
-  verify_needed_test shellcheck
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test shellcheck; then
     return 0
   fi
 
@@ -126,8 +125,7 @@ function shellcheck_postapply
   declare fixedpatch
   declare statstring
 
-  verify_needed_test shellcheck
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test shellcheck; then
     return 0
   fi
 

http://git-wip-us.apache.org/repos/asf/yetus/blob/ce10af00/precommit/test-patch.d/shelldocs.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/shelldocs.sh b/precommit/test-patch.d/shelldocs.sh
index bff6934..fea982a 100755
--- a/precommit/test-patch.d/shelldocs.sh
+++ b/precommit/test-patch.d/shelldocs.sh
@@ -99,8 +99,7 @@ function shelldocs_preapply
 {
   declare i
 
-  verify_needed_test shelldocs
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test shelldocs; then
     return 0
   fi
 
@@ -131,8 +130,7 @@ function shelldocs_postapply
   declare fixedpatch
   declare statstring
 
-  verify_needed_test shelldocs
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test shelldocs; then
     return 0
   fi
 

http://git-wip-us.apache.org/repos/asf/yetus/blob/ce10af00/precommit/test-patch.d/test4tests.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/test4tests.sh b/precommit/test-patch.d/test4tests.sh
index 94b9b7f..f4ad1c7 100755
--- a/precommit/test-patch.d/test4tests.sh
+++ b/precommit/test-patch.d/test4tests.sh
@@ -29,9 +29,7 @@ function test4tests_patchfile
 
   big_console_header "Checking there are new or changed tests in the patch."
 
-  verify_needed_test unit
-
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test unit; then
     echo "Patch does not appear to need new or modified tests."
     return 0
   fi
@@ -55,4 +53,4 @@ function test4tests_patchfile
   add_vote_table +1 "test4tests" \
     "The patch appears to include ${testReferences} new or modified test files."
   return 0
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/yetus/blob/ce10af00/precommit/test-patch.d/unitveto.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/unitveto.sh b/precommit/test-patch.d/unitveto.sh
index 363ba59..e0d348e 100755
--- a/precommit/test-patch.d/unitveto.sh
+++ b/precommit/test-patch.d/unitveto.sh
@@ -49,15 +49,11 @@ function unitveto_parse_args
 
 function unitveto_patchfile
 {
-  verify_needed_test unit
-
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test unit; then
     return 0
   fi
 
-  verify_needed_test unitveto
-
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test unitveto; then
     return 0
   fi
 

http://git-wip-us.apache.org/repos/asf/yetus/blob/ce10af00/precommit/test-patch.d/xml.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/xml.sh b/precommit/test-patch.d/xml.sh
index 4aba556..dd8f206 100755
--- a/precommit/test-patch.d/xml.sh
+++ b/precommit/test-patch.d/xml.sh
@@ -40,8 +40,7 @@ function xml_postcompile
   declare i
   declare count
 
-  verify_needed_test xml
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test xml; then
     return 0
   fi
 

http://git-wip-us.apache.org/repos/asf/yetus/blob/ce10af00/precommit/test-patch.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.sh b/precommit/test-patch.sh
index 793190a..3f42cd2 100755
--- a/precommit/test-patch.sh
+++ b/precommit/test-patch.sh
@@ -270,22 +270,22 @@ function report_jvm_version
 ## @stability    stable
 ## @replaceable  yes
 ## @param        test
-## @return       1 = yes
-## @return       0 = no
+## @return       0 = yes
+## @return       1 = no
 function verify_multijdk_test
 {
   local i=$1
 
   if [[ "${JDK_DIR_LIST}" == "${JAVA_HOME}" ]]; then
     yetus_debug "MultiJDK not configured."
-    return 0
+    return 1
   fi
 
   if [[ ${JDK_TEST_LIST} =~ $i ]]; then
     yetus_debug "${i} is in ${JDK_TEST_LIST} and MultiJDK configured."
-    return 1
+    return 0
   fi
-  return 0
+  return 1
 }
 
 ## @description  Put the opening environment information at the bottom
@@ -1703,8 +1703,7 @@ function modules_messages
     repo="the patch"
   fi
 
-  verify_multijdk_test "${testtype}"
-  if [[ $? == 1 ]]; then
+  if verify_multijdk_test "${testtype}"; then
     multijdkmode=true
   fi
 
@@ -1823,8 +1822,7 @@ function modules_workers
 
   modules_reset
 
-  verify_multijdk_test "${testtype}"
-  if [[ $? == 1 ]]; then
+  if verify_multijdk_test "${testtype}"; then
     jdk=$(report_jvm_version "${JAVA_HOME}")
     statusjdk=" with JDK v${jdk}"
     jdk="-jdk${jdk}"
@@ -1986,7 +1984,7 @@ function check_unittests
   declare test_logfile
   declare result=0
   declare -r savejavahome=${JAVA_HOME}
-  declare multijdkmode=false
+  declare multijdkmode
   declare jdk=""
   declare jdkindex=0
   declare jdklist
@@ -1995,22 +1993,17 @@ function check_unittests
   declare needlog
   declare unitlogs
 
-  verify_needed_test unit
-
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test unit; then
     return 0
   fi
 
   big_console_header "Running unit tests"
 
-  verify_multijdk_test unit
-  if [[ $? == 1 ]]; then
+  if verify_multijdk_test unit; then
     multijdkmode=true
-  fi
-
-  if [[ "${multijdkmode}" = true ]]; then
     jdklist=${JDK_DIR_LIST}
   else
+    multijdkmode=false
     jdklist=${JAVA_HOME}
   fi
 
@@ -2393,25 +2386,21 @@ function generic_pre_handler
   declare multijdkmode=$2
   declare result=0
   declare -r savejavahome=${JAVA_HOME}
-  declare multijdkmode=false
+  declare multijdkmode
   declare jdkindex=0
   declare jdklist
 
-  verify_needed_test "${testtype}"
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test "${testtype}"; then
      return 0
   fi
 
   big_console_header "Pre-patch ${testtype} verification on ${PATCH_BRANCH}"
 
-  verify_multijdk_test "${testtype}"
-  if [[ $? == 1 ]]; then
+  if verify_multijdk_test "${testtype}"; then
     multijdkmode=true
-  fi
-
-  if [[ "${multijdkmode}" = true ]]; then
     jdklist=${JDK_DIR_LIST}
   else
+    multijdkmode=false
     jdklist=${JAVA_HOME}
   fi
 
@@ -2556,8 +2545,7 @@ function generic_post_handler
   declare -i numbranch=0
   declare -i numpatch=0
 
-  verify_needed_test "${testtype}"
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test "${testtype}"; then
     yetus_debug "${testtype} not needed"
     return 0
   fi
@@ -2603,18 +2591,15 @@ function compile_jvm
   declare codebase=$1
   declare result=0
   declare -r savejavahome=${JAVA_HOME}
-  declare multijdkmode=false
+  declare multijdkmode
   declare jdkindex=0
   declare jdklist
 
-  verify_multijdk_test compile
-  if [[ $? == 1 ]]; then
+  if verify_multijdk_test compile; then
     multijdkmode=true
-  fi
-
-  if [[ "${multijdkmode}" = true ]]; then
     jdklist=${JDK_DIR_LIST}
   else
+    multijdkmode=false
     jdklist=${JAVA_HOME}
   fi
 
@@ -2681,8 +2666,7 @@ function compile
 {
   declare codebase=$1
 
-  verify_needed_test compile
-  if [[ $? == 0 ]]; then
+  if ! verify_needed_test compile; then
      return 0
   fi
 


Mime
View raw message