hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [1/3] hadoop git commit: HADOOP-12113. update test-patch branch to latest code (continued) (aw)
Date Sat, 27 Jun 2015 07:09:54 GMT
Repository: hadoop
Updated Branches:
  refs/heads/HADOOP-12111 09a2e360f -> 63c7e9238


http://git-wip-us.apache.org/repos/asf/hadoop/blob/37578379/dev-support/test-patch.d/jira.sh
----------------------------------------------------------------------
diff --git a/dev-support/test-patch.d/jira.sh b/dev-support/test-patch.d/jira.sh
new file mode 100644
index 0000000..f95ca6f
--- /dev/null
+++ b/dev-support/test-patch.d/jira.sh
@@ -0,0 +1,190 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+JIRACLI=${JIRA:-jira}
+
+add_bugsystem jira
+
+function jira_usage
+{
+  echo "JIRA Options:"
+  echo "--jira-cmd=<cmd>       The 'jira' command to use (default 'jira')"
+  echo "--jira-password=<pw>   The password for the 'jira' command"
+  echo "--jira-user=<user>     The user for the 'jira' command"
+}
+
+function jira_parse_args
+{
+  local i
+
+  for i in "$@"; do
+    case ${i} in
+      --jira-cmd=*)
+        JIRACLI=${i#*=}
+      ;;
+      --jira-password=*)
+        JIRA_PASSWD=${i#*=}
+      ;;
+      --jira-user=*)
+        JIRA_USER=${i#*=}
+      ;;
+    esac
+  done
+}
+
+## @description Write the contents of a file to JIRA
+## @params filename
+## @stability stable
+## @audience public
+## @returns ${JIRACLI} exit code
+function jira_write_comment
+{
+  local -r commentfile=${1}
+  shift
+
+  local retval=0
+
+
+  if [[ -n ${JIRA_PASSWD}
+     && -n ${JIRA_USER} ]]; then
+    # shellcheck disable=SC2086
+    ${JIRACLI} --comment "$(cat ${commentfile})" \
+               -s https://issues.apache.org/jira \
+               -a addcomment -u ${JIRA_USER} \
+               -p "${JIRA_PASSWD}" \
+               --issue "${ISSUE}"
+    retval=$?
+    ${JIRACLI} -s https://issues.apache.org/jira \
+               -a logout -u "${JIRA_USER}" \
+               -p "${JIRA_PASSWD}"
+  fi
+  return ${retval}
+}
+
+## @description  Print out the finished details to the JIRA issue
+## @audience     private
+## @stability    evolving
+## @replaceable  no
+## @param        runresult
+function jira_finalreport
+{
+  local result=$1
+  local i
+  local commentfile=${PATCH_DIR}/commentfile
+  local comment
+  local vote
+  local ourstring
+  local ela
+  local subs
+  local color
+  local comment
+
+  rm "${commentfile}" 2>/dev/null
+
+  if [[ ${JENKINS} != "true" ]] ; then
+    return 0
+  fi
+
+  big_console_header "Adding comment to JIRA"
+
+  add_footer_table "Console output" "${BUILD_URL}console"
+
+  if [[ ${result} == 0 ]]; then
+    add_header_line "| (/) *{color:green}+1 overall{color}* |"
+  else
+    add_header_line "| (x) *{color:red}-1 overall{color}* |"
+  fi
+
+  { echo "\\\\" ; echo "\\\\"; } >>  "${commentfile}"
+
+  i=0
+  until [[ $i -eq ${#TP_HEADER[@]} ]]; do
+    printf "%s\n" "${TP_HEADER[${i}]}" >> "${commentfile}"
+    ((i=i+1))
+  done
+
+  { echo "\\\\" ; echo "\\\\"; } >>  "${commentfile}"
+
+  echo "|| Vote || Subsystem || Runtime || Comment ||" >> "${commentfile}"
+
+  i=0
+  until [[ $i -eq ${#TP_VOTE_TABLE[@]} ]]; do
+    ourstring=$(echo "${TP_VOTE_TABLE[${i}]}" | tr -s ' ')
+    vote=$(echo "${ourstring}" | cut -f2 -d\| | tr -d ' ')
+    subs=$(echo "${ourstring}"  | cut -f3 -d\|)
+    ela=$(echo "${ourstring}" | cut -f4 -d\|)
+    comment=$(echo "${ourstring}"  | cut -f5 -d\|)
+
+    # summary line
+    if [[ -z ${vote}
+      && -n ${ela} ]]; then
+      color="black"
+    elif [[ -z ${vote} ]]; then
+      # keep same color
+      true
+    else
+      # new vote line
+      case ${vote} in
+        1|"+1")
+          color="green"
+        ;;
+        -1)
+          color="red"
+        ;;
+        0)
+          color="blue"
+        ;;
+        *)
+          color="black"
+        ;;
+      esac
+    fi
+
+    printf "| {color:%s}%s{color} | {color:%s}%s{color} | {color:%s}%s{color} | {color:%s}%s{color}
|\n" \
+      "${color}" "${vote}" \
+      "${color}" "${subs}" \
+      "${color}" "${ela}" \
+      "${color}" "${comment}" \
+      >> "${commentfile}"
+    ((i=i+1))
+  done
+
+  if [[ ${#TP_TEST_TABLE[@]} -gt 0 ]]; then
+    { echo "\\\\" ; echo "\\\\"; } >>  "${commentfile}"
+
+    echo "|| Reason || Tests ||" >>  "${commentfile}"
+    i=0
+    until [[ $i -eq ${#TP_TEST_TABLE[@]} ]]; do
+      printf "%s\n" "${TP_TEST_TABLE[${i}]}" >> "${commentfile}"
+      ((i=i+1))
+    done
+  fi
+
+  { echo "\\\\" ; echo "\\\\"; } >>  "${commentfile}"
+
+  echo "|| Subsystem || Report/Notes ||" >> "${commentfile}"
+  i=0
+  until [[ $i -eq ${#TP_FOOTER_TABLE[@]} ]]; do
+    comment=$(echo "${TP_FOOTER_TABLE[${i}]}" |
+              ${SED} -e "s,@@BASE@@,${BUILD_URL}artifact/patchprocess,g")
+    printf "%s\n" "${comment}" >> "${commentfile}"
+    ((i=i+1))
+  done
+
+  printf "\n\nThis message was automatically generated.\n\n" >> "${commentfile}"
+
+  jira_write_comment "${commentfile}"
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/37578379/dev-support/test-patch.d/xml.sh
----------------------------------------------------------------------
diff --git a/dev-support/test-patch.d/xml.sh b/dev-support/test-patch.d/xml.sh
new file mode 100644
index 0000000..b33c7cd
--- /dev/null
+++ b/dev-support/test-patch.d/xml.sh
@@ -0,0 +1,70 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+add_plugin xml
+
+function xml_filefilter
+{
+  local filename=$1
+
+  if [[ ${filename} =~ \.xml$ ]]; then
+    add_test xml
+  fi
+}
+
+function xml_postapply
+{
+  local js
+  local i
+  local count
+
+  verify_needed_test xml
+  if [[ $? == 0 ]]; then
+    return 0
+  fi
+
+  big_console_header "Checking if XML files are well-formed"
+
+  js="${JAVA_HOME}/bin/jrunscript"
+  if [[ ! -x ${js} ]]; then
+    yetus_error "${js} does not exist"
+    return 0
+  fi
+
+  start_clock
+
+  pushd "${BASEDIR}" >/dev/null
+  for i in ${CHANGED_FILES}; do
+    if [[ ! ${i} =~ \.xml$ ]]; then
+      continue
+    fi
+    ${js} -e "XMLDocument(arguments[0])" "${i}" >> "${PATCH_DIR}/xml.txt" 2>&1
+    if [[ $? != 0 ]]; then
+      ((count=count+1))
+    fi
+  done
+
+  if [[ ${count} -gt 0 ]]; then
+    add_vote_table -1 xml "The patch has ${count} ill-formed XML file(s)."
+    add_footer_table xml "@@BASE@@/xml.txt"
+    popd >/dev/null
+    return 1
+  fi
+
+  popd >/dev/null
+  add_vote_table +1 xml "The patch has no ill-formed XML file."
+  return 0
+}


Mime
View raw message