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 # Yetus 0.7.0 enforces limits. Default proclimit is 1000.
83 # Up it. See HBASE-25081 for how we arrived at this number.
84 #shellcheck disable=SC2034
87 # Set docker container to run with 20g. Default is 4g in yetus.
88 # See HBASE-19902 for how we arrived at 20g.
89 #shellcheck disable=SC2034
93 ## @description Parse extra arguments required by personalities, if any.
95 ## @stability evolving
96 function personality_parse_args
102 --exclude-tests-url=*)
103 delete_parameter
"${i}"
104 EXCLUDE_TESTS_URL
=${i#*=}
106 --include-tests-url=*)
107 delete_parameter
"${i}"
108 INCLUDE_TESTS_URL
=${i#*=}
111 delete_parameter
"${i}"
112 HADOOP_PROFILE
=${i#*=}
115 delete_parameter
"${i}"
118 --asf-nightlies-general-check-base=*)
119 delete_parameter
"${i}"
120 ASF_NIGHTLIES_GENERAL_CHECK_BASE
=${i#*=}
123 delete_parameter
"${i}"
126 --surefire-first-part-fork-count=*)
127 delete_parameter
"${i}"
128 SUREFIRE_FIRST_PART_FORK_COUNT
=${i#*=}
130 --surefire-second-part-fork-count=*)
131 delete_parameter
"${i}"
132 SUREFIRE_SECOND_PART_FORK_COUNT
=${i#*=}
138 ## @description Queue up modules for this personality
140 ## @stability evolving
143 function personality_modules
150 local MODULES
=("${CHANGED_MODULES[@]}")
152 yetus_info
"Personality: ${repostatus} ${testtype}"
154 clear_personality_queue
156 # At a few points, hbase modules can run build, test, etc. in parallel
157 # Let it happen. Means we'll use more CPU but should be for short bursts.
158 # https://cwiki.apache.org/confluence/display/MAVEN/Parallel+builds+in+Maven+3
159 if [[ -n "${BUILD_THREAD}" ]]; then
160 extra
="--threads=${BUILD_THREAD}"
165 # Set java.io.tmpdir to avoid exhausting the /tmp space
166 # Just simply set to 'target', it is not very critical so we do not care
167 # whether it is placed in the root directory or a sub module's directory
168 # let's make it absolute
169 tmpdir
=$
(realpath target
)
170 extra
="${extra} -Djava.io.tmpdir=${tmpdir} -DHBasePatchProcess"
172 if [[ "${PATCH_BRANCH}" = branch-1
* ]]; then
173 extra
="${extra} -Dhttps.protocols=TLSv1.2"
176 # If we have HADOOP_PROFILE specified and we're on branch-2.x, pass along
177 # the hadoop.profile system property. Ensures that Hadoop2 and Hadoop3
178 # logic is not both activated within Maven.
179 if [[ -n "${HADOOP_PROFILE}" ]] && [[ "${PATCH_BRANCH}" = branch-2
* ]] ; then
180 extra
="${extra} -Dhadoop.profile=${HADOOP_PROFILE}"
183 # BUILDMODE value is 'full' when there is no patch to be tested, and we are running checks on
184 # full source code instead. In this case, do full compiles, tests, etc instead of per
186 # Used in nightly runs.
187 # If BUILDMODE is 'patch', for unit and compile testtypes, there is no need to run individual
188 # modules if root is included. HBASE-18505
189 if [[ "${BUILDMODE}" == "full" ]] || \
190 { { [[ "${testtype}" == unit ]] || [[ "${testtype}" == compile ]] || [[ "${testtype}" == checkstyle ]]; } && \
191 [[ "${MODULES[*]}" =~ \. ]]; }; then
195 # If the checkstyle configs change, check everything.
196 if [[ "${testtype}" == checkstyle ]] && [[ "${MODULES[*]}" =~ hbase-checkstyle ]]; then
200 if [[ ${testtype} == mvninstall ]]; then
201 # shellcheck disable=SC2086
202 personality_enqueue_module . ${extra}
206 # This list should include any modules that require jdk8. Maven should be configured to only
207 # include them when a proper JDK is in use, but that doesn' work if we specifically ask for the
208 # module to build as yetus does if something changes in the module. Rather than try to
209 # figure out what jdk is in use so we can duplicate the module activation logic, just
210 # build at the top level if anything changes in one of these modules and let maven sort it out.
211 branch1jdk8=(hbase-error-prone hbase-tinylfu-blockcache)
212 if [[ "${PATCH_BRANCH}" = branch-1* ]]; then
213 for jdk8module in "${branch1jdk8[@]}"; do
214 if [[ "${MODULES[*]}" =~ ${jdk8module} ]]; then
221 if [[ ${testtype} == spotbugs ]]; then
222 # Run spotbugs on each module individually to diff pre-patch and post-patch results and
223 # report new warnings for changed modules only.
224 # For some reason, spotbugs on root is not working, but running on individual modules is
225 # working. For time being, let it run on original list of CHANGED_MODULES. HBASE-19491
226 for module in "${CHANGED_MODULES[@]}"; do
227 # skip spotbugs on any module that lacks content in `src/main/java`
228 if [[ "$
(find "${BASEDIR}/${module}" -iname '*.java' -and -ipath '*/src/main/java/*' \
229 -type f |
wc -l |
tr -d '[:space:]')" -eq 0 ]]; then
230 yetus_debug "no java files found under
${module}/src
/main
/java. skipping.
"
233 # shellcheck disable=SC2086
234 personality_enqueue_module ${module} ${extra}
240 if [[ ${testtype} == compile ]] && [[ "${SKIP_ERRORPRONE}" != "true
" ]] &&
241 [[ "${PATCH_BRANCH}" != branch-1* ]] ; then
242 extra="${extra} -PerrorProne"
245 # If EXCLUDE_TESTS_URL/INCLUDE_TESTS_URL is set, fetches the url
246 # and sets -Dtest.exclude.pattern/-Dtest to exclude/include the
247 # tests respectively.
248 if [[ ${testtype} == unit ]]; then
250 get_include_exclude_tests_arg tests_arg
251 extra="${extra} -PrunAllTests ${tests_arg}"
253 # Inject the jenkins build-id for our surefire invocations
254 # Used by zombie detection stuff, even though we're not including that yet.
255 if [ -n "${BUILD_ID}" ]; then
256 extra="${extra} -Dbuild.id
=${BUILD_ID}"
260 if [[ -n "${SUREFIRE_FIRST_PART_FORK_COUNT}" ]]; then
261 extra="${extra} -Dsurefire.firstPartForkCount
=${SUREFIRE_FIRST_PART_FORK_COUNT}"
264 if [[ -n "${SUREFIRE_SECOND_PART_FORK_COUNT}" ]]; then
265 extra="${extra} -Dsurefire.secondPartForkCount
=${SUREFIRE_SECOND_PART_FORK_COUNT}"
268 # If the set of changed files includes CommonFSUtils then add the hbase-server
269 # module to the set of modules (if not already included) to be tested
270 for f in "${CHANGED_FILES[@]}"
272 if [[ "${f}" =~ CommonFSUtils ]]; then
273 if [[ ! "${MODULES[*]}" =~ hbase-server ]] && [[ ! "${MODULES[*]}" =~ \. ]]; then
274 MODULES+=("hbase-server
")
281 for module in "${MODULES[@]}"; do
282 # shellcheck disable=SC2086
283 personality_enqueue_module ${module} ${extra}
287 ## @description places where we override the built in assumptions about what tests to run
289 ## @stability evolving
290 ## @param filename of changed file
291 function personality_file_tests
294 yetus_debug "HBase specific personality_file_tests
"
295 # If the change is to the refguide, then we don't need any builtin yetus tests
296 # the refguide test (below) will suffice for coverage.
297 if [[ ${filename} =~ src/main/asciidoc ]] ||
298 [[ ${filename} =~ src/main/xslt ]]; then
299 yetus_debug "Skipping
builtin yetus checks
for ${filename}. refguide
test should pick it up.
"
301 # If we change our asciidoc, rebuild mvnsite
302 if [[ ${BUILDTOOL} = maven ]]; then
303 if [[ ${filename} =~ src/site || ${filename} =~ src/main/asciidoc ]]; then
304 yetus_debug "tests
/mvnsite
: ${filename}"
308 # If we change checkstyle configs, run checkstyle
309 if [[ ${filename} =~ checkstyle.*\.xml ]]; then
310 yetus_debug "tests
/checkstyle
: ${filename}"
313 # fallback to checking which tests based on what yetus would do by default
314 if declare -f "${BUILDTOOL}_builtin_personality_file_tests
" >/dev/null; then
315 "${BUILDTOOL}_builtin_personality_file_tests
" "${filename}"
316 elif declare -f builtin_personality_file_tests >/dev/null; then
317 builtin_personality_file_tests "${filename}"
322 ## @description Uses relevant include/exclude env variable to fetch list of included/excluded
323 # tests and sets given variable to arguments to be passes to maven command.
325 ## @stability evolving
326 ## @param name of variable to set with maven arguments
327 function get_include_exclude_tests_arg
330 yetus_info "EXCLUDE_TESTS_URL
=${EXCLUDE_TESTS_URL}"
331 yetus_info "INCLUDE_TESTS_URL
=${INCLUDE_TESTS_URL}"
332 if [[ -n "${EXCLUDE_TESTS_URL}" ]]; then
333 if wget "${EXCLUDE_TESTS_URL}" -O "excludes
"; then
334 excludes=$(cat excludes)
335 yetus_debug "excludes
=${excludes}"
336 if [[ -n "${excludes}" ]]; then
337 eval "${__resultvar}='-Dtest.exclude.pattern=${excludes}'"
341 yetus_error "Wget error $?
in fetching excludes
file from url
" \
342 "${EXCLUDE_TESTS_URL}. Ignoring and proceeding.
"
344 elif [[ -n "$INCLUDE_TESTS_URL" ]]; then
345 if wget "$INCLUDE_TESTS_URL" -O "includes
"; then
346 includes=$(cat includes)
347 yetus_debug "includes
=${includes}"
348 if [[ -n "${includes}" ]]; then
349 eval "${__resultvar}='-Dtest=${includes}'"
353 yetus_error "Wget error $?
in fetching includes
file from url
" \
354 "${INCLUDE_TESTS_URL}. Ignoring and proceeding.
"
357 # Use branch specific exclude list when EXCLUDE_TESTS_URL and INCLUDE_TESTS_URL are empty
358 FLAKY_URL="https
://ci-hadoop.apache.org
/job
/HBase
/job
/HBase-Find-Flaky-Tests
/job
/${PATCH_BRANCH}/lastSuccessfulBuild
/artifact
/output
/excludes
"
359 if wget "${FLAKY_URL}" -O "excludes
"; then
360 excludes=$(cat excludes)
361 yetus_debug "excludes
=${excludes}"
362 if [[ -n "${excludes}" ]]; then
363 eval "${__resultvar}='-Dtest.exclude.pattern=${excludes}'"
367 yetus_error "Wget error $?
in fetching excludes
file from url
" \
368 "${FLAKY_URL}. Ignoring and proceeding.
"
373 ###################################################
374 # Below here are our one-off tests specific to hbase.
375 # TODO break them into individual files so it's easier to maintain them?
377 # TODO line length check? could ignore all java files since checkstyle gets them.
379 ###################################################
381 add_test_type refguide
383 function refguide_initialize
385 maven_add_install refguide
388 function refguide_filefilter
392 if [[ ${filename} =~ src/main/asciidoc ]] ||
393 [[ ${filename} =~ src/main/xslt ]] ||
394 [[ ${filename} =~ hbase-common/src/main/resources/hbase-default\.xml ]]; then
399 function refguide_rebuild
402 local logfile="${PATCH_DIR}/${repostatus}-refguide.log
"
406 if ! verify_needed_test refguide; then
410 big_console_header "Checking we can create the ref guide on
${repostatus}"
414 # disabled because "maven_executor
" needs to return both command and args
415 # shellcheck disable=2046
416 echo_and_redirect "${logfile}" \
417 $(maven_executor) clean site --batch-mode \
419 -Dtest=NoUnitTests -DHBasePatchProcess -Prelease \
420 -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dspotbugs.skip=true
422 count=$(${GREP} -c '\[ERROR\]' "${logfile}")
423 if [[ ${count} -gt 0 ]]; then
424 add_vote_table -1 refguide "${repostatus} has
${count} errors when building the reference guide.
"
425 add_footer_table refguide "@@BASE@@
/${repostatus}-refguide.log
"
429 if ! mv target/site "${PATCH_DIR}/${repostatus}-site"; then
430 add_vote_table -1 refguide "${repostatus} failed to produce a site directory.
"
431 add_footer_table refguide "@@BASE@@
/${repostatus}-refguide.log
"
435 if [[ ! -f "${PATCH_DIR}/${repostatus}-site/book.html
" ]]; then
436 add_vote_table -1 refguide "${repostatus} failed to produce the html version of the reference guide.
"
437 add_footer_table refguide "@@BASE@@
/${repostatus}-refguide.log
"
441 if [[ "${PATCH_BRANCH}" = branch-1* ]]; then
442 pdf_output="book.pdf
"
444 pdf_output="apache_hbase_reference_guide.pdf
"
447 if [[ ! -f "${PATCH_DIR}/${repostatus}-site/${pdf_output}" ]]; then
448 add_vote_table -1 refguide "${repostatus} failed to produce the pdf version of the reference guide.
"
449 add_footer_table refguide "@@BASE@@
/${repostatus}-refguide.log
"
453 add_vote_table 0 refguide "${repostatus} has no errors when building the reference guide. See footer
for rendered docs
, which you should manually inspect.
"
454 if [[ -n "${ASF_NIGHTLIES_GENERAL_CHECK_BASE}" ]]; then
455 add_footer_table refguide "${ASF_NIGHTLIES_GENERAL_CHECK_BASE}/${repostatus}-site/book.html
"
457 add_footer_table refguide "@@BASE@@
/${repostatus}-site/book.html
"
462 add_test_type shadedjars
465 function shadedjars_initialize
467 yetus_debug "initializing shaded client checks.
"
468 maven_add_install shadedjars
471 ## @description only run the test if java changes.
473 ## @stability evolving
475 function shadedjars_filefilter
479 if [[ ${filename} =~ \.java$ ]] || [[ ${filename} =~ pom.xml$ ]]; then
484 ## @description test the shaded client artifacts
486 ## @stability evolving
488 function shadedjars_rebuild
491 local logfile="${PATCH_DIR}/${repostatus}-shadedjars.txt
"
493 if ! verify_needed_test shadedjars; then
497 big_console_header "Checking shaded client builds on
${repostatus}"
501 local -a maven_args=('clean' 'verify' '-fae' '--batch-mode'
502 '-pl' 'hbase-shaded/hbase-shaded-check-invariants' '-am'
503 '-Dtest=NoUnitTests' '-DHBasePatchProcess' '-Prelease'
504 '-Dmaven.javadoc.skip=true' '-Dcheckstyle.skip=true' '-Dspotbugs.skip=true')
505 # If we have HADOOP_PROFILE specified and we're on branch-2.x, pass along
506 # the hadoop.profile system property. Ensures that Hadoop2 and Hadoop3
507 # logic is not both activated within Maven.
508 if [[ -n "${HADOOP_PROFILE}" ]] && [[ "${PATCH_BRANCH}" = branch-2* ]] ; then
509 maven_args+=("-Dhadoop.profile
=${HADOOP_PROFILE}")
512 # disabled because "maven_executor
" needs to return both command and args
513 # shellcheck disable=2046
514 echo_and_redirect "${logfile}" $(maven_executor) "${maven_args[@]}"
516 count=$(${GREP} -c '\[ERROR\]' "${logfile}")
517 if [[ ${count} -gt 0 ]]; then
518 add_vote_table -1 shadedjars "${repostatus} has
${count} errors when building our shaded downstream artifacts.
"
519 add_footer_table shadedjars "@@BASE@@
/${repostatus}-shadedjars.txt
"
523 add_vote_table +1 shadedjars "${repostatus} has no errors when building our shaded downstream artifacts.
"
527 ###################################################
529 add_test_type hadoopcheck
531 ## @description hadoopcheck file filter
533 ## @stability evolving
535 function hadoopcheck_filefilter
539 if [[ ${filename} =~ \.java$ ]] || [[ ${filename} =~ pom\.xml$ ]]; then
544 ## @description Parse args to detect if QUICK_HADOOPCHECK mode is enabled.
546 ## @stability evolving
547 function hadoopcheck_parse_args
554 delete_parameter "${i}"
555 QUICK_HADOOPCHECK=true
561 ## @description Adds QUICK_HADOOPCHECK env variable to DOCKER_EXTRAARGS.
563 ## @stability evolving
564 function hadoopcheck_docker_support
566 DOCKER_EXTRAARGS=("${DOCKER_EXTRAARGS[@]}" "--env=QUICK_HADOOPCHECK
=${QUICK_HADOOPCHECK}")
569 ## @description hadoopcheck test
571 ## @stability evolving
573 function hadoopcheck_rebuild
580 local hbase_hadoop2_versions
581 local hbase_hadoop3_versions
583 if [[ "${repostatus}" = branch ]]; then
587 if ! verify_needed_test hadoopcheck; then
591 big_console_header "Compiling against various Hadoop versions
"
595 # All supported Hadoop versions that we want to test the compilation with
596 # See the Hadoop section on prereqs in the HBase Reference Guide
597 if [[ "${PATCH_BRANCH}" = branch-1.4 ]]; then
598 yetus_info "Setting Hadoop
2 versions to
test based on branch-1.4 rules.
"
599 if [[ "${QUICK_HADOOPCHECK}" == "true
" ]]; then
600 hbase_hadoop2_versions="2.7.7"
602 hbase_hadoop2_versions="2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7"
604 elif [[ "${PATCH_BRANCH}" = branch-1 ]]; then
605 yetus_info "Setting Hadoop
2 versions to
test based on branch-1 rules.
"
606 if [[ "${QUICK_HADOOPCHECK}" == "true
" ]]; then
607 hbase_hadoop2_versions="2.10.0"
609 hbase_hadoop2_versions="2.10.0"
611 elif [[ "${PATCH_BRANCH}" = branch-2.0 ]]; then
612 yetus_info "Setting Hadoop
2 versions to
test based on branch-2.0 rules.
"
613 if [[ "${QUICK_HADOOPCHECK}" == "true
" ]]; then
614 hbase_hadoop2_versions="2.6.5 2.7.7 2.8.5"
616 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"
618 elif [[ "${PATCH_BRANCH}" = branch-2.1 ]]; then
619 yetus_info "Setting Hadoop
2 versions to
test based on branch-2.1 rules.
"
620 if [[ "${QUICK_HADOOPCHECK}" == "true
" ]]; then
621 hbase_hadoop2_versions="2.7.7 2.8.5"
623 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"
625 elif [[ "${PATCH_BRANCH}" = branch-2.2 ]]; then
626 yetus_info "Setting Hadoop
2 versions to
test based on branch-2.2 rules.
"
627 if [[ "${QUICK_HADOOPCHECK}" == "true
" ]]; then
628 hbase_hadoop2_versions="2.8.5 2.9.2 2.10.0"
630 hbase_hadoop2_versions="2.8.5 2.9.2 2.10.0"
632 elif [[ "${PATCH_BRANCH}" = branch-2.* ]]; then
633 yetus_info "Setting Hadoop
2 versions to
test based on branch-2.3
+ rules.
"
634 if [[ "${QUICK_HADOOPCHECK}" == "true
" ]]; then
635 hbase_hadoop2_versions="2.10.1"
637 hbase_hadoop2_versions="2.10.0 2.10.1"
640 yetus_info "Setting Hadoop
2 versions to null on master
/feature branch rules since we
do not support hadoop
2 for hbase
3.x any
more.
"
641 hbase_hadoop2_versions=""
643 if [[ "${PATCH_BRANCH}" = branch-1* ]]; then
644 yetus_info "Setting Hadoop
3 versions to
test based on branch-1.x rules.
"
645 hbase_hadoop3_versions=""
646 elif [[ "${PATCH_BRANCH}" = branch-2.0 ]] || [[ "${PATCH_BRANCH}" = branch-2.1 ]]; then
647 yetus_info "Setting Hadoop
3 versions to
test based on branch-2.0
/branch-2.1 rules
"
648 if [[ "${QUICK_HADOOPCHECK}" == "true
" ]]; then
649 hbase_hadoop3_versions="3.0.3 3.1.2"
651 hbase_hadoop3_versions="3.0.3 3.1.1 3.1.2"
653 elif [[ "${PATCH_BRANCH}" = branch-2.2 ]] || [[ "${PATCH_BRANCH}" = branch-2.3 ]]; then
654 yetus_info "Setting Hadoop
3 versions to
test based on branch-2.2
/branch-2.3 rules
"
655 if [[ "${QUICK_HADOOPCHECK}" == "true
" ]]; then
656 hbase_hadoop3_versions="3.1.2 3.2.2"
658 hbase_hadoop3_versions="3.1.1 3.1.2 3.2.0 3.2.1 3.2.2"
661 yetus_info "Setting Hadoop
3 versions to
test based on branch-2.4
+/master
/feature branch rules
"
662 if [[ "${QUICK_HADOOPCHECK}" == "true
" ]]; then
663 hbase_hadoop3_versions="3.1.2 3.2.2 3.3.1"
665 hbase_hadoop3_versions="3.1.1 3.1.2 3.2.0 3.2.1 3.2.2 3.3.0 3.3.1"
669 export MAVEN_OPTS="${MAVEN_OPTS}"
670 for hadoopver in ${hbase_hadoop2_versions}; do
671 logfile="${PATCH_DIR}/patch-javac-
${hadoopver}.txt
"
672 # disabled because "maven_executor
" needs to return both command and args
673 # shellcheck disable=2046
674 echo_and_redirect "${logfile}" \
675 $(maven_executor) clean install \
676 -DskipTests -DHBasePatchProcess \
677 -Dhadoop-two.version="${hadoopver}"
678 count=$(${GREP} -c '\[ERROR\]' "${logfile}")
679 if [[ ${count} -gt 0 ]]; then
680 add_vote_table -1 hadoopcheck "${BUILDMODEMSG} causes ${count} errors with Hadoop v${hadoopver}.
"
681 add_footer_table hadoopcheck "@@BASE@@
/patch-javac-
${hadoopver}.txt
"
687 if [[ "${PATCH_BRANCH}" = branch-2* ]]; then
688 hadoop_profile="-Dhadoop.profile
=3.0"
690 for hadoopver in ${hbase_hadoop3_versions}; do
691 logfile="${PATCH_DIR}/patch-javac-
${hadoopver}.txt
"
692 # disabled because "maven_executor
" needs to return both command and args
693 # shellcheck disable=2046
694 echo_and_redirect "${logfile}" \
695 $(maven_executor) clean install \
696 -DskipTests -DHBasePatchProcess \
697 -Dhadoop-three.version="${hadoopver}" \
699 count=$(${GREP} -c '\[ERROR\]' "${logfile}")
700 if [[ ${count} -gt 0 ]]; then
701 add_vote_table -1 hadoopcheck "${BUILDMODEMSG} causes ${count} errors with Hadoop v${hadoopver}.
"
702 add_footer_table hadoopcheck "@@BASE@@
/patch-javac-
${hadoopver}.txt
"
707 if [[ ${result} -gt 0 ]]; then
711 if [[ -n "${hbase_hadoop3_versions}" ]]; then
712 if [[ -n "${hbase_hadoop2_versions}" ]]; then
713 add_vote_table +1 hadoopcheck "Patch does not cause any errors with Hadoop
${hbase_hadoop2_versions} or
${hbase_hadoop3_versions}.
"
715 add_vote_table +1 hadoopcheck "Patch does not cause any errors with Hadoop
${hbase_hadoop3_versions}.
"
718 add_vote_table +1 hadoopcheck "Patch does not cause any errors with Hadoop
${hbase_hadoop2_versions}.
"
721 logfile="${PATCH_DIR}/patch-install-after-hadoopcheck.txt
"
722 echo_and_redirect "${logfile}" \
723 $(maven_executor) clean install \
724 -DskipTests -DHBasePatchProcess
729 ######################################
731 # TODO if we need the protoc check, we probably need to check building all the modules that rely on hbase-protocol
732 add_test_type hbaseprotoc
734 function hbaseprotoc_initialize
736 # So long as there are inter-module dependencies on the protoc modules, we
737 # need to run a full `mvn install` before a patch can be tested.
738 yetus_debug "initializing HBase Protoc plugin.
"
739 maven_add_install hbaseprotoc
742 ## @description hbaseprotoc file filter
744 ## @stability evolving
746 function hbaseprotoc_filefilter
750 if [[ ${filename} =~ \.proto$ ]]; then
755 ## @description check hbase proto compilation
757 ## @stability evolving
759 function hbaseprotoc_rebuild
761 declare repostatus=$1
769 if [[ "${repostatus}" = branch ]]; then
773 if ! verify_needed_test hbaseprotoc; then
777 big_console_header "HBase protoc plugin
: ${BUILDMODE}"
781 personality_modules patch hbaseprotoc
782 # Need to run 'install' instead of 'compile' because shading plugin
783 # is hooked-up to 'install'; else hbase-protocol-shaded is left with
784 # half of its process done.
785 modules_workers patch hbaseprotoc install -DskipTests -X -DHBasePatchProcess
787 # shellcheck disable=SC2153
788 until [[ $i -eq "${#MODULE[@]}" ]]; do
789 if [[ ${MODULE_STATUS[${i}]} == -1 ]]; then
795 fn=$(module_file_fragment "${module}")
796 logfile="${PATCH_DIR}/patch-hbaseprotoc-
${fn}.txt
"
798 count=$(${GREP} -c '\[ERROR\]' "${logfile}")
800 if [[ ${count} -gt 0 ]]; then
801 module_status ${i} -1 "patch-hbaseprotoc-
${fn}.txt
" "Patch generated
"\
802 "${count} new protoc errors
in ${module}.
"
808 modules_messages patch hbaseprotoc true
809 if [[ ${result} -gt 0 ]]; then
815 ######################################
817 add_test_type hbaseanti
819 ## @description hbaseanti file filter
821 ## @stability evolving
823 function hbaseanti_filefilter
827 if [[ ${filename} =~ \.java$ ]]; then
832 ## @description hbaseanti patch file check
834 ## @stability evolving
836 function hbaseanti_patchfile
842 if [[ "${BUILDMODE}" = full ]]; then
846 if ! verify_needed_test hbaseanti; then
850 big_console_header "Checking
for known anti-patterns
"
854 warnings=$(${GREP} -c 'new TreeMap<byte.*()' "${patchfile}")
855 if [[ ${warnings} -gt 0 ]]; then
856 add_vote_table -1 hbaseanti "" "The
patch appears to have anti-pattern where BYTES_COMPARATOR was omitted.
"
860 if [[ ${result} -gt 0 ]]; then
864 add_vote_table +1 hbaseanti "" "Patch does not have any anti-patterns.
"
868 ## @description process the javac output for generating WARNING/ERROR
870 ## @stability evolving
871 ## @param input filename
872 ## @param output filename
873 # Override the default javac_logfilter so that we can do a sort before outputing the WARNING/ERROR.
874 # This is because that the output order of the error prone warnings is not stable, so the diff
875 # method will report unexpected errors if we do not sort it. Notice that a simple sort will cause
876 # line number being sorted by lexicographical so the output maybe a bit strange to human but it is
877 # really hard to sort by file name first and then line number and column number in shell...
878 function hbase_javac_logfilter
883 ${GREP} -E '\[(ERROR|WARNING)\] /.*\.java:' "${input}" | sort > "${output}"
886 ## This is named so that yetus will check us right after running tests.
887 ## Essentially, we check for normal failures and then we look for zombies.
888 #function hbase_unit_logfilter
890 # declare testtype="unit"
894 # declare process_output
896 # declare zombie_count=0
897 # declare zombie_process
899 # yetus_debug "in hbase-specific unit logfilter."
901 # # pass-through to whatever is counting actual failures
902 # if declare -f ${BUILDTOOL}_${testtype}_logfilter >/dev/null; then
903 # "${BUILDTOOL}_${testtype}_logfilter" "${input}" "${output}"
904 # elif declare -f ${testtype}_logfilter >/dev/null; then
905 # "${testtype}_logfilter" "${input}" "${output}"
909 # if [ -n "${BUILD_ID}" ]; then
910 # yetus_debug "Checking for zombie test processes."
911 # processes=$(jps -v | "${GREP}" surefirebooter | "${GREP}" -e "hbase.build.id=${BUILD_ID}")
912 # if [ -n "${processes}" ] && [ "$(echo "${processes}" | wc -l)" -gt 0 ]; then
913 # yetus_warn "Found some suspicious process(es). Waiting a bit to see if they're just slow to stop."
914 # yetus_debug "${processes}"
916 # #shellcheck disable=SC2016
917 # for pid in $(echo "${processes}"| ${AWK} '{print $1}'); do
918 # # Test our zombie still running (and that it still an hbase build item)
919 # process_output=$(ps -p "${pid}" | tail +2 | "${GREP}" -e "hbase.build.id=${BUILD_ID}")
920 # if [[ -n "${process_output}" ]]; then
921 # yetus_error "Zombie: ${process_output}"
922 # ((zombie_count = zombie_count + 1))
923 # zombie_process=$(jstack "${pid}" | "${GREP}" -e "\.Test" | "${GREP}" -e "\.java"| head -3)
924 # zombies="${zombies} ${zombie_process}"
928 # if [ "${zombie_count}" -ne 0 ]; then
929 # add_vote_table -1 zombies "There are ${zombie_count} zombie test(s)"
930 # populate_test_table "zombie unit tests" "${zombies}"
932 # yetus_info "Zombie check complete. All test runs exited normally."
936 # add_vote_table -0 zombies "There is no BUILD_ID env variable; can't check for zombies."