2 # Licensed to the Apache Software Foundation (ASF) under one or more
3 # contributor license agreements. See the NOTICE file distributed with
4 # this work for additional information regarding copyright ownership.
5 # The ASF licenses this file to You under the Apache License, Version 2.0
6 # (the "License"); you may not use this file except in compliance with
7 # the License. You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # You'll need a local installation of
18 # [Apache Yetus' precommit checker](http://yetus.apache.org/documentation/0.1.0/#yetus-precommit)
19 # to use this personality.
21 # Download from: http://yetus.apache.org/downloads/ . You can either grab the source artifact and
22 # build from it, or use the convenience binaries provided on that download page.
24 # To run against, e.g. HBASE-15074 you'd then do
26 # test-patch --personality=dev-support/hbase-personality.sh HBASE-15074
29 # If you want to skip the ~1 hour it'll take to do all the hadoop API checks, use
31 # test-patch --plugins=all,-hadoopcheck --personality=dev-support/hbase-personality.sh HBASE-15074
34 # pass the `--sentinel` flag if you want to allow test-patch to destructively alter local working
35 # directory / branch in order to have things match what the issue patch requests.
37 personality_plugins
"all"
39 if ! declare -f "yetus_info" >/dev
/null
; then
43 echo "[$(date) INFO]: $*" 1>&2
48 # work around yetus overwriting JAVA_HOME from our docker image
49 function docker_do_env_adds
53 for k
in "${DOCKER_EXTRAENVS[@]}"; do
54 if [[ "JAVA_HOME" == "${k}" ]]; then
55 if [ -n "${JAVA_HOME}" ]; then
56 DOCKER_EXTRAARGS
+=("--env=JAVA_HOME=${JAVA_HOME}")
59 DOCKER_EXTRAARGS
+=("--env=${k}=${!k}")
65 ## @description Globals specific to this personality
67 ## @stability evolving
68 function personality_globals
71 #shellcheck disable=SC2034
73 #shellcheck disable=SC2034
74 PATCH_BRANCH_DEFAULT
=master
75 #shellcheck disable=SC2034
76 JIRA_ISSUE_RE
='^HBASE-[0-9]+$'
77 #shellcheck disable=SC2034
78 GITHUB_REPO
="apache/hbase"
80 # TODO use PATCH_BRANCH to select jdk versions to use.
82 # Override the maven options
83 MAVEN_OPTS
="${MAVEN_OPTS:-"-Xms4G -Xmx4G"}"
85 # Yetus 0.7.0 enforces limits. Default proclimit is 1000.
86 # Up it. See HBASE-19902 for how we arrived at this number.
87 #shellcheck disable=SC2034
90 # Set docker container to run with 20g. Default is 4g in yetus.
91 # See HBASE-19902 for how we arrived at 20g.
92 #shellcheck disable=SC2034
96 ## @description Parse extra arguments required by personalities, if any.
98 ## @stability evolving
99 function personality_parse_args
105 --exclude-tests-url=*)
106 delete_parameter
"${i}"
107 EXCLUDE_TESTS_URL
=${i#*=}
109 --include-tests-url=*)
110 delete_parameter
"${i}"
111 INCLUDE_TESTS_URL
=${i#*=}
114 delete_parameter
"${i}"
115 HADOOP_PROFILE
=${i#*=}
118 delete_parameter
"${i}"
125 ## @description Queue up modules for this personality
127 ## @stability evolving
130 function personality_modules
137 local MODULES
=("${CHANGED_MODULES[@]}")
139 yetus_info
"Personality: ${repostatus} ${testtype}"
141 clear_personality_queue
143 extra
="-DHBasePatchProcess"
144 if [[ "${PATCH_BRANCH}" = branch-1
* ]]; then
145 extra
="${extra} -Dhttps.protocols=TLSv1.2"
148 if [[ -n "${HADOOP_PROFILE}" ]]; then
149 extra
="${extra} -Dhadoop.profile=${HADOOP_PROFILE}"
152 # BUILDMODE value is 'full' when there is no patch to be tested, and we are running checks on
153 # full source code instead. In this case, do full compiles, tests, etc instead of per
155 # Used in nightly runs.
156 # If BUILDMODE is 'patch', for unit and compile testtypes, there is no need to run individual
157 # modules if root is included. HBASE-18505
158 if [[ "${BUILDMODE}" == "full" ]] || \
159 ( ( [[ "${testtype}" == unit ]] || [[ "${testtype}" == compile ]] || [[ "${testtype}" == checkstyle
]] ) && \
160 [[ "${MODULES[*]}" =~ \.
]] ); then
164 # If the checkstyle configs change, check everything.
165 if [[ "${testtype}" == checkstyle
]] && [[ "${MODULES[*]}" =~ hbase-checkstyle
]]; then
169 if [[ ${testtype} == mvninstall
]]; then
170 # shellcheck disable=SC2086
171 personality_enqueue_module .
${extra}
175 # This list should include any modules that require jdk8. Maven should be configured to only
176 # include them when a proper JDK is in use, but that doesn' work if we specifically ask for the
177 # module to build as yetus does if something changes in the module. Rather than try to
178 # figure out what jdk is in use so we can duplicate the module activation logic, just
179 # build at the top level if anything changes in one of these modules and let maven sort it out.
180 branch1jdk8
=(hbase-error-prone hbase-tinylfu-blockcache
)
181 if [[ "${PATCH_BRANCH}" = branch-1
* ]]; then
182 for jdk8module
in "${branch1jdk8[@]}"; do
183 if [[ "${MODULES[*]}" =~
${jdk8module} ]]; then
190 if [[ ${testtype} == findbugs
]]; then
191 # Run findbugs on each module individually to diff pre-patch and post-patch results and
192 # report new warnings for changed modules only.
193 # For some reason, findbugs on root is not working, but running on individual modules is
194 # working. For time being, let it run on original list of CHANGED_MODULES. HBASE-19491
195 for module
in "${CHANGED_MODULES[@]}"; do
196 # skip findbugs on hbase-shell and hbase-it. hbase-it has nothing
197 # in src/main/java where findbugs goes to look
198 if [[ ${module} == hbase-shell
]]; then
200 elif [[ ${module} == hbase-it
]]; then
203 # shellcheck disable=SC2086
204 personality_enqueue_module
${module} ${extra}
210 if [[ ${testtype} == compile
]] && [[ "${SKIP_ERRORPRONE}" != "true" ]] &&
211 [[ "${PATCH_BRANCH}" != branch-1
* ]] ; then
212 extra
="${extra} -PerrorProne"
215 # If EXCLUDE_TESTS_URL/INCLUDE_TESTS_URL is set, fetches the url
216 # and sets -Dtest.exclude.pattern/-Dtest to exclude/include the
217 # tests respectively.
218 if [[ ${testtype} == unit
]]; then
220 get_include_exclude_tests_arg tests_arg
221 extra
="${extra} -PrunAllTests ${tests_arg}"
223 # Inject the jenkins build-id for our surefire invocations
224 # Used by zombie detection stuff, even though we're not including that yet.
225 if [ -n "${BUILD_ID}" ]; then
226 extra
="${extra} -Dbuild.id=${BUILD_ID}"
229 # If the set of changed files includes CommonFSUtils then add the hbase-server
230 # module to the set of modules (if not already included) to be tested
231 for f
in "${CHANGED_FILES[@]}"
233 if [[ "${f}" =~ CommonFSUtils
]]; then
234 if [[ ! "${MODULES[*]}" =~ hbase-server
]] && [[ ! "${MODULES[*]}" =~ \.
]]; then
235 MODULES
+=("hbase-server")
242 for module
in "${MODULES[@]}"; do
243 # shellcheck disable=SC2086
244 personality_enqueue_module
${module} ${extra}
248 ## @description places where we override the built in assumptions about what tests to run
250 ## @stability evolving
251 ## @param filename of changed file
252 function personality_file_tests
255 yetus_debug
"HBase specific personality_file_tests"
256 # If the change is to the refguide, then we don't need any builtin yetus tests
257 # the refguide test (below) will suffice for coverage.
258 if [[ ${filename} =~ src
/main
/asciidoc
]] ||
259 [[ ${filename} =~ src
/main
/xslt
]]; then
260 yetus_debug
"Skipping builtin yetus checks for ${filename}. refguide test should pick it up."
262 # If we change our asciidoc, rebuild mvnsite
263 if [[ ${BUILDTOOL} = maven
]]; then
264 if [[ ${filename} =~ src
/site ||
${filename} =~ src
/main
/asciidoc
]]; then
265 yetus_debug
"tests/mvnsite: ${filename}"
269 # If we change checkstyle configs, run checkstyle
270 if [[ ${filename} =~ checkstyle.
*\.xml
]]; then
271 yetus_debug
"tests/checkstyle: ${filename}"
274 # fallback to checking which tests based on what yetus would do by default
275 if declare -f "${BUILDTOOL}_builtin_personality_file_tests" >/dev
/null
; then
276 "${BUILDTOOL}_builtin_personality_file_tests" "${filename}"
277 elif declare -f builtin_personality_file_tests
>/dev
/null
; then
278 builtin_personality_file_tests
"${filename}"
283 ## @description Uses relevant include/exclude env variable to fetch list of included/excluded
284 # tests and sets given variable to arguments to be passes to maven command.
286 ## @stability evolving
287 ## @param name of variable to set with maven arguments
288 function get_include_exclude_tests_arg
291 yetus_info
"EXCLUDE_TESTS_URL=${EXCLUDE_TESTS_URL}"
292 yetus_info
"INCLUDE_TESTS_URL=${INCLUDE_TESTS_URL}"
293 if [[ -n "${EXCLUDE_TESTS_URL}" ]]; then
294 if wget
"${EXCLUDE_TESTS_URL}" -O "excludes"; then
295 excludes
=$
(cat excludes
)
296 yetus_debug
"excludes=${excludes}"
297 if [[ -n "${excludes}" ]]; then
298 eval "${__resultvar}='-Dtest.exclude.pattern=${excludes}'"
302 yetus_error
"Wget error $? in fetching excludes file from url" \
303 "${EXCLUDE_TESTS_URL}. Ignoring and proceeding."
305 elif [[ -n "$INCLUDE_TESTS_URL" ]]; then
306 if wget
"$INCLUDE_TESTS_URL" -O "includes"; then
307 includes
=$
(cat includes
)
308 yetus_debug
"includes=${includes}"
309 if [[ -n "${includes}" ]]; then
310 eval "${__resultvar}='-Dtest=${includes}'"
314 yetus_error
"Wget error $? in fetching includes file from url" \
315 "${INCLUDE_TESTS_URL}. Ignoring and proceeding."
318 # Use branch specific exclude list when EXCLUDE_TESTS_URL and INCLUDE_TESTS_URL are empty
319 FLAKY_URL
="https://builds.apache.org/job/HBase-Find-Flaky-Tests/job/${PATCH_BRANCH}/lastSuccessfulBuild/artifact/excludes/"
320 if wget
"${FLAKY_URL}" -O "excludes"; then
321 excludes
=$
(cat excludes
)
322 yetus_debug
"excludes=${excludes}"
323 if [[ -n "${excludes}" ]]; then
324 eval "${__resultvar}='-Dtest.exclude.pattern=${excludes}'"
328 yetus_error
"Wget error $? in fetching excludes file from url" \
329 "${FLAKY_URL}. Ignoring and proceeding."
334 ###################################################
335 # Below here are our one-off tests specific to hbase.
336 # TODO break them into individual files so it's easier to maintain them?
338 # TODO line length check? could ignore all java files since checkstyle gets them.
340 ###################################################
342 add_test_type refguide
344 function refguide_initialize
346 maven_add_install refguide
349 function refguide_filefilter
353 if [[ ${filename} =~ src
/main
/asciidoc
]] ||
354 [[ ${filename} =~ src
/main
/xslt
]] ||
355 [[ ${filename} =~ hbase-common
/src
/main
/resources
/hbase-default.xml
]]; then
360 function refguide_rebuild
363 local logfile
="${PATCH_DIR}/${repostatus}-refguide.log"
367 if ! verify_needed_test refguide
; then
371 big_console_header
"Checking we can create the ref guide on ${repostatus}"
375 # disabled because "maven_executor" needs to return both command and args
376 # shellcheck disable=2046
377 echo_and_redirect
"${logfile}" \
378 $
(maven_executor
) clean site
--batch-mode \
380 -Dtest=NoUnitTests
-DHBasePatchProcess -Prelease \
381 -Dmaven.javadoc.skip
=true
-Dcheckstyle.skip
=true
-Dfindbugs.skip
=true
383 count
=$
(${GREP} -c '\[ERROR\]' "${logfile}")
384 if [[ ${count} -gt 0 ]]; then
385 add_vote_table
-1 refguide
"${repostatus} has ${count} errors when building the reference guide."
386 add_footer_table refguide
"@@BASE@@/${repostatus}-refguide.log"
390 if ! mv target
/site
"${PATCH_DIR}/${repostatus}-site"; then
391 add_vote_table
-1 refguide
"${repostatus} failed to produce a site directory."
392 add_footer_table refguide
"@@BASE@@/${repostatus}-refguide.log"
396 if [[ ! -f "${PATCH_DIR}/${repostatus}-site/book.html" ]]; then
397 add_vote_table
-1 refguide
"${repostatus} failed to produce the html version of the reference guide."
398 add_footer_table refguide
"@@BASE@@/${repostatus}-refguide.log"
402 if [[ "${PATCH_BRANCH}" = branch-1
* ]]; then
403 pdf_output
="book.pdf"
405 pdf_output
="apache_hbase_reference_guide.pdf"
408 if [[ ! -f "${PATCH_DIR}/${repostatus}-site/${pdf_output}" ]]; then
409 add_vote_table
-1 refguide
"${repostatus} failed to produce the pdf version of the reference guide."
410 add_footer_table refguide
"@@BASE@@/${repostatus}-refguide.log"
414 add_vote_table
0 refguide
"${repostatus} has no errors when building the reference guide. See footer for rendered docs, which you should manually inspect."
415 add_footer_table refguide
"@@BASE@@/${repostatus}-site/book.html"
419 add_test_type shadedjars
422 function shadedjars_initialize
424 yetus_debug
"initializing shaded client checks."
425 maven_add_install shadedjars
428 ## @description only run the test if java changes.
430 ## @stability evolving
432 function shadedjars_filefilter
436 if [[ ${filename} =~ \.java$
]] ||
[[ ${filename} =~ pom.xml$
]]; then
441 ## @description test the shaded client artifacts
443 ## @stability evolving
445 function shadedjars_rebuild
448 local logfile
="${PATCH_DIR}/${repostatus}-shadedjars.txt"
450 if ! verify_needed_test shadedjars
; then
454 big_console_header
"Checking shaded client builds on ${repostatus}"
458 # disabled because "maven_executor" needs to return both command and args
459 # shellcheck disable=2046
460 echo_and_redirect
"${logfile}" \
461 $
(maven_executor
) clean verify
-fae --batch-mode \
462 -pl hbase-shaded
/hbase-shaded-check-invariants
-am \
463 -Dtest=NoUnitTests
-DHBasePatchProcess -Prelease \
464 -Dmaven.javadoc.skip
=true
-Dcheckstyle.skip
=true
-Dfindbugs.skip
=true
466 count
=$
(${GREP} -c '\[ERROR\]' "${logfile}")
467 if [[ ${count} -gt 0 ]]; then
468 add_vote_table
-1 shadedjars
"${repostatus} has ${count} errors when building our shaded downstream artifacts."
469 add_footer_table shadedjars
"@@BASE@@/${repostatus}-shadedjars.txt"
473 add_vote_table
+1 shadedjars
"${repostatus} has no errors when building our shaded downstream artifacts."
477 ###################################################
479 add_test_type hadoopcheck
481 ## @description hadoopcheck file filter
483 ## @stability evolving
485 function hadoopcheck_filefilter
489 if [[ ${filename} =~ \.java$
]] ||
[[ ${filename} =~ pom.xml$
]]; then
494 ## @description Parse args to detect if QUICK_HADOOPCHECK mode is enabled.
496 ## @stability evolving
497 function hadoopcheck_parse_args
504 delete_parameter
"${i}"
505 QUICK_HADOOPCHECK
=true
511 ## @description Adds QUICK_HADOOPCHECK env variable to DOCKER_EXTRAARGS.
513 ## @stability evolving
514 function hadoopcheck_docker_support
516 DOCKER_EXTRAARGS
=("${DOCKER_EXTRAARGS[@]}" "--env=QUICK_HADOOPCHECK=${QUICK_HADOOPCHECK}")
519 ## @description hadoopcheck test
521 ## @stability evolving
523 function hadoopcheck_rebuild
530 local hbase_hadoop2_versions
531 local hbase_hadoop3_versions
533 if [[ "${repostatus}" = branch
]]; then
537 if ! verify_needed_test hadoopcheck
; then
541 big_console_header
"Compiling against various Hadoop versions"
545 # All supported Hadoop versions that we want to test the compilation with
546 # See the Hadoop section on prereqs in the HBase Reference Guide
547 if [[ "${PATCH_BRANCH}" = branch-1.
* ]] && [[ "${PATCH_BRANCH#branch-1.}" -lt "4" ]]; then
548 yetus_info
"Setting Hadoop 2 versions to test based on before-branch-1.4 rules."
549 if [[ "${QUICK_HADOOPCHECK}" == "true" ]]; then
550 hbase_hadoop2_versions
="2.4.1 2.5.2 2.6.5 2.7.7"
552 hbase_hadoop2_versions
="2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7"
554 elif [[ "${PATCH_BRANCH}" = branch-1.4
]]; then
555 yetus_info
"Setting Hadoop 2 versions to test based on branch-1.4 rules."
556 if [[ "${QUICK_HADOOPCHECK}" == "true" ]]; then
557 hbase_hadoop2_versions
="2.7.7"
559 hbase_hadoop2_versions
="2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7"
561 elif [[ "${PATCH_BRANCH}" = branch-2.0
]]; then
562 yetus_info
"Setting Hadoop 2 versions to test based on branch-2.0 rules."
563 if [[ "${QUICK_HADOOPCHECK}" == "true" ]]; then
564 hbase_hadoop2_versions
="2.6.5 2.7.7 2.8.5"
566 hbase_hadoop2_versions
="2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.8.2 2.8.3 2.8.4 2.8.5"
568 elif [[ "${PATCH_BRANCH}" = branch-2.1
]]; then
569 yetus_info
"Setting Hadoop 2 versions to test based on branch-2.1 rules."
570 if [[ "${QUICK_HADOOPCHECK}" == "true" ]]; then
571 hbase_hadoop2_versions
="2.7.7 2.8.5"
573 hbase_hadoop2_versions
="2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.8.2 2.8.3 2.8.4 2.8.5"
576 yetus_info
"Setting Hadoop 2 versions to test based on branch-1.5+/branch-2.2+/master/feature branch rules."
577 if [[ "${QUICK_HADOOPCHECK}" == "true" ]]; then
578 hbase_hadoop2_versions
="2.8.5 2.9.2"
580 hbase_hadoop2_versions
="2.8.5 2.9.2"
583 if [[ "${PATCH_BRANCH}" = branch-1
* ]]; then
584 yetus_info
"Setting Hadoop 3 versions to test based on branch-1.x rules."
585 hbase_hadoop3_versions
=""
586 elif [[ "${PATCH_BRANCH}" = branch-2.0
]] ||
[[ "${PATCH_BRANCH}" = branch-2.1
]]; then
587 yetus_info
"Setting Hadoop 3 versions to test based on branch-2.0/branch-2.1 rules"
588 if [[ "${QUICK_HADOOPCHECK}" == "true" ]]; then
589 hbase_hadoop3_versions
="3.0.3 3.1.2"
591 hbase_hadoop3_versions
="3.0.3 3.1.1 3.1.2"
594 yetus_info
"Setting Hadoop 3 versions to test based on branch-2.2+/master/feature branch rules"
595 if [[ "${QUICK_HADOOPCHECK}" == "true" ]]; then
596 hbase_hadoop3_versions
="3.1.2"
598 hbase_hadoop3_versions
="3.1.1 3.1.2"
602 export MAVEN_OPTS
="${MAVEN_OPTS}"
603 for hadoopver
in ${hbase_hadoop2_versions}; do
604 logfile
="${PATCH_DIR}/patch-javac-${hadoopver}.txt"
605 # disabled because "maven_executor" needs to return both command and args
606 # shellcheck disable=2046
607 echo_and_redirect
"${logfile}" \
608 $
(maven_executor
) clean
install \
609 -DskipTests -DHBasePatchProcess \
610 -Dhadoop-two.version
="${hadoopver}"
611 count
=$
(${GREP} -c '\[ERROR\]' "${logfile}")
612 if [[ ${count} -gt 0 ]]; then
613 add_vote_table
-1 hadoopcheck
"${BUILDMODEMSG} causes ${count} errors with Hadoop v${hadoopver}."
614 add_footer_table hadoopcheck
"@@BASE@@/patch-javac-${hadoopver}.txt"
619 for hadoopver
in ${hbase_hadoop3_versions}; do
620 logfile
="${PATCH_DIR}/patch-javac-${hadoopver}.txt"
621 # disabled because "maven_executor" needs to return both command and args
622 # shellcheck disable=2046
623 echo_and_redirect
"${logfile}" \
624 $
(maven_executor
) clean
install \
625 -DskipTests -DHBasePatchProcess \
626 -Dhadoop-three.version
="${hadoopver}" \
628 count
=$
(${GREP} -c '\[ERROR\]' "${logfile}")
629 if [[ ${count} -gt 0 ]]; then
630 add_vote_table
-1 hadoopcheck
"${BUILDMODEMSG} causes ${count} errors with Hadoop v${hadoopver}."
631 add_footer_table hadoopcheck
"@@BASE@@/patch-javac-${hadoopver}.txt"
636 if [[ ${result} -gt 0 ]]; then
640 if [[ -n "${hbase_hadoop3_versions}" ]]; then
641 add_vote_table
+1 hadoopcheck
"Patch does not cause any errors with Hadoop ${hbase_hadoop2_versions} or ${hbase_hadoop3_versions}."
643 add_vote_table
+1 hadoopcheck
"Patch does not cause any errors with Hadoop ${hbase_hadoop2_versions}."
646 logfile
="${PATCH_DIR}/patch-install-after-hadoopcheck.txt"
647 echo_and_redirect
"${logfile}" \
648 $
(maven_executor
) clean
install \
649 -DskipTests -DHBasePatchProcess
654 ######################################
656 # TODO if we need the protoc check, we probably need to check building all the modules that rely on hbase-protocol
657 add_test_type hbaseprotoc
659 ## @description hbaseprotoc file filter
661 ## @stability evolving
663 function hbaseprotoc_filefilter
667 if [[ ${filename} =~ \.proto$
]]; then
672 ## @description check hbase proto compilation
674 ## @stability evolving
676 function hbaseprotoc_rebuild
678 declare repostatus
=$1
686 if [[ "${repostatus}" = branch
]]; then
690 if ! verify_needed_test hbaseprotoc
; then
694 big_console_header
"HBase protoc plugin: ${BUILDMODE}"
698 personality_modules
patch hbaseprotoc
699 # Need to run 'install' instead of 'compile' because shading plugin
700 # is hooked-up to 'install'; else hbase-protocol-shaded is left with
701 # half of its process done.
702 modules_workers
patch hbaseprotoc
install -DskipTests -X -DHBasePatchProcess
704 # shellcheck disable=SC2153
705 until [[ $i -eq "${#MODULE[@]}" ]]; do
706 if [[ ${MODULE_STATUS[${i}]} == -1 ]]; then
712 fn
=$
(module_file_fragment
"${module}")
713 logfile
="${PATCH_DIR}/patch-hbaseprotoc-${fn}.txt"
715 count
=$
(${GREP} -c '\[ERROR\]' "${logfile}")
717 if [[ ${count} -gt 0 ]]; then
718 module_status
${i} -1 "patch-hbaseprotoc-${fn}.txt" "Patch generated "\
719 "${count} new protoc errors in ${module}."
725 modules_messages
patch hbaseprotoc true
726 if [[ ${result} -gt 0 ]]; then
732 ######################################
734 add_test_type hbaseanti
736 ## @description hbaseanti file filter
738 ## @stability evolving
740 function hbaseanti_filefilter
744 if [[ ${filename} =~ \.java$
]]; then
749 ## @description hbaseanti patch file check
751 ## @stability evolving
753 function hbaseanti_patchfile
759 if [[ "${BUILDMODE}" = full
]]; then
763 if ! verify_needed_test hbaseanti
; then
767 big_console_header
"Checking for known anti-patterns"
771 warnings
=$
(${GREP} -c 'new TreeMap<byte.*()' "${patchfile}")
772 if [[ ${warnings} -gt 0 ]]; then
773 add_vote_table
-1 hbaseanti
"" "The patch appears to have anti-pattern where BYTES_COMPARATOR was omitted."
777 if [[ ${result} -gt 0 ]]; then
781 add_vote_table
+1 hbaseanti
"" "Patch does not have any anti-patterns."
785 ## @description process the javac output for generating WARNING/ERROR
787 ## @stability evolving
788 ## @param input filename
789 ## @param output filename
790 # Override the default javac_logfilter so that we can do a sort before outputing the WARNING/ERROR.
791 # This is because that the output order of the error prone warnings is not stable, so the diff
792 # method will report unexpected errors if we do not sort it. Notice that a simple sort will cause
793 # line number being sorted by lexicographical so the output maybe a bit strange to human but it is
794 # really hard to sort by file name first and then line number and column number in shell...
795 function hbase_javac_logfilter
800 ${GREP} -E '\[(ERROR|WARNING)\] /.*\.java:' "${input}" | sort > "${output}"
803 ## This is named so that yetus will check us right after running tests.
804 ## Essentially, we check for normal failures and then we look for zombies.
805 #function hbase_unit_logfilter
807 # declare testtype="unit
"
811 # declare process_output
813 # declare zombie_count=0
814 # declare zombie_process
816 # yetus_debug "in hbase-specific unit logfilter.
"
818 # # pass-through to whatever is counting actual failures
819 # if declare -f ${BUILDTOOL}_${testtype}_logfilter >/dev/null; then
820 # "${BUILDTOOL}_${testtype}_logfilter" "${input}" "${output}"
821 # elif declare -f ${testtype}_logfilter >/dev/null; then
822 # "${testtype}_logfilter" "${input}" "${output}"
826 # if [ -n "${BUILD_ID}" ]; then
827 # yetus_debug "Checking
for zombie
test processes.
"
828 # processes=$(jps -v | "${GREP}" surefirebooter | "${GREP}" -e "hbase.build.id=${BUILD_ID}")
829 # if [ -n "${processes}" ] && [ "$
(echo "${processes}" |
wc -l)" -gt 0 ]; then
830 # yetus_warn "Found some suspicious process
(es
). Waiting a bit to see
if they
're just slow to stop."
831 # yetus_debug "${processes}"
833 # #shellcheck disable=SC2016
834 # for pid in $(echo "${processes}"| ${AWK} '{print $1}'); do
835 # # Test our zombie still running (and that it still an hbase build item)
836 # process_output=$(ps -p "${pid}" | tail +2 | "${GREP}" -e "hbase.build.id=${BUILD_ID}")
837 # if [[ -n "${process_output}" ]]; then
838 # yetus_error "Zombie: ${process_output}"
839 # ((zombie_count = zombie_count + 1))
840 # zombie_process=$(jstack "${pid}" | "${GREP}" -e "\.Test" | "${GREP}" -e "\.java"| head -3)
841 # zombies="${zombies} ${zombie_process}"
845 # if [ "${zombie_count}" -ne 0 ]; then
846 # add_vote_table -1 zombies "There are ${zombie_count} zombie test(s)"
847 # populate_test_table "zombie unit tests" "${zombies}"
849 # yetus_info "Zombie check complete. All test runs exited normally."
853 # add_vote_table -0 zombies "There is no BUILD_ID env variable; can't check for zombies."