HBASE-15466 test personality should recognize docs-only patch.

* add a new test to build the refguide specifically instead of site
* check for changes to src/main/asciidoc or src/main/xslt and run that test and 
only that test
* check for changes to the hbase-default.xml file and build the refguide if 
found (but maybe other tests too)
* fallback to relying on the yetus default for other changes
* fix some missing start_clock entries that cause longer-than-actual reported 
test time.

Signed-off-by: Mike Drob <md...@apache.org>


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

Branch: refs/heads/HBASE-19064
Commit: ee87de9bfd37499cd850c5ac214f327d616db2fe
Parents: bc35de5
Author: Sean Busbey <bus...@apache.org>
Authored: Thu Apr 5 15:22:41 2018 -0500
Committer: Sean Busbey <bus...@apache.org>
Committed: Mon Apr 9 10:37:28 2018 -0500

----------------------------------------------------------------------
 dev-support/hbase-personality.sh | 92 +++++++++++++++++++++++++++++++++++
 1 file changed, 92 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/ee87de9b/dev-support/hbase-personality.sh
----------------------------------------------------------------------
diff --git a/dev-support/hbase-personality.sh b/dev-support/hbase-personality.sh
index b67777a..d34f761 100755
--- a/dev-support/hbase-personality.sh
+++ b/dev-support/hbase-personality.sh
@@ -180,6 +180,26 @@ function personality_modules
   done
 }
 
+## @description places where we override the built in assumptions about what 
tests to run
+## @audience    private
+## @stability   evolving
+## @param       filename of changed file
+function personality_file_tests
+{
+  local filename=$1
+  # If the change is to the refguide, then we don't need any builtin yetus 
tests
+  # the refguide test (below) will suffice for coverage.
+  if [[ ${filename} =~ src/main/asciidoc ]] ||
+     [[ ${filename} =~ src/main/xslt ]]; then
+    yetus_debug "Skipping builtin yetus checks for ${filename}. refguide test 
should pick it up."
+  # fallback to checking which tests based on what yetus would do by default
+  elif declare -f "${BUILDTOOL}_builtin_personality_file_tests" >/dev/null; 
then
+    "${BUILDTOOL}_builtin_personality_file_tests" "${filename}"
+  elif declare -f builtin_personality_file_tests >/dev/null; then
+    builtin_personality_file_tests "${filename}"
+  fi
+}
+
 ## @description  Uses relevant include/exclude env variable to fetch list of 
included/excluded
 #                tests and sets given variable to arguments to be passes to 
maven command.
 ## @audience     private
@@ -225,6 +245,74 @@ function get_include_exclude_tests_arg
 
 ###################################################
 
+add_test_type refguide
+
+function refguide_initialize
+{
+  maven_add_install refguide
+}
+
+function refguide_filefilter
+{
+  local filename=$1
+
+  if [[ ${filename} =~ src/main/asciidoc ]] ||
+     [[ ${filename} =~ src/main/xslt ]] ||
+     [[ ${filename} =~ hbase-common/src/main/resources/hbase-default.xml ]]; 
then
+    add_test refguide
+  fi
+}
+
+function refguide_rebuild
+{
+  local repostatus=$1
+  local logfile="${PATCH_DIR}/${repostatus}-refguide.log"
+  declare -i count
+
+  if ! verify_needed_test refguide; then
+    return 0
+  fi
+
+  big_console_header "Checking we can create the ref guide on ${repostatus}"
+
+  start_clock
+
+  echo_and_redirect "${logfile}" \
+    "${MAVEN}" "${MAVEN_ARGS[@]}" clean site --batch-mode \
+      -pl . \
+      -Dtest=NoUnitTests -DHBasePatchProcess -Prelease \
+      -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true -Dfindbugs.skip=true
+
+  count=$(${GREP} -c '\[ERROR\]' "${logfile}")
+  if [[ ${count} -gt 0 ]]; then
+    add_vote_table -1 refguide "${repostatus} has ${count} errors when 
building the reference guide."
+    add_footer_table refguide "@@BASE@@/${repostatus}-refguide.log"
+    return 1
+  fi
+
+  if ! mv target/site "${PATCH_DIR}/${repostatus}-site"; then
+    add_vote_table -1 refguide "${repostatus} failed to produce a site 
directory."
+    add_footer_table refguide "@@BASE@@/${repostatus}-refguide.log"
+    return 1
+  fi
+
+  if [[ ! -f "${PATCH_DIR}/${repostatus}-site/book.html" ]]; then
+    add_vote_table -1 refguide "${repostatus} failed to produce the html 
version of the reference guide."
+    add_footer_table refguide "@@BASE@@/${repostatus}-refguide.log"
+    return 1
+  fi
+
+  if [[ ! -f 
"${PATCH_DIR}/${repostatus}-site/apache_hbase_reference_guide.pdf" ]]; then
+    add_vote_table -1 refguide "${repostatus} failed to produce the pdf 
version of the reference guide."
+    add_footer_table refguide "@@BASE@@/${repostatus}-refguide.log"
+    return 1
+  fi
+
+  add_vote_table 0 refguide "${repostatus} has no errors when building the 
reference guide. See footer for rendered docs, which you should manually 
inspect."
+  add_footer_table refguide "@@BASE@@/${repostatus}-site/book.html"
+  return 0
+}
+
 add_test_type shadedjars
 
 
@@ -262,6 +350,8 @@ function shadedjars_rebuild
 
   big_console_header "Checking shaded client builds on ${repostatus}"
 
+  start_clock
+
   echo_and_redirect "${logfile}" \
     "${MAVEN}" "${MAVEN_ARGS[@]}" clean verify -fae --batch-mode \
       -pl hbase-shaded/hbase-shaded-check-invariants -am \
@@ -343,6 +433,8 @@ function hadoopcheck_rebuild
 
   big_console_header "Compiling against various Hadoop versions"
 
+  start_clock
+
   # All supported Hadoop versions that we want to test the compilation with
   # See the Hadoop section on prereqs in the HBase Reference Guide
   hbase_common_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"

Reply via email to