[
https://issues.apache.org/jira/browse/ZOOKEEPER-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15866471#comment-15866471
]
ASF GitHub Bot commented on ZOOKEEPER-2665:
-------------------------------------------
Github user eribeiro commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/165#discussion_r100232542
--- Diff: src/java/test/bin/test-github-pr.sh ---
@@ -0,0 +1,616 @@
+#!/usr/bin/env bash
+# Licensed 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.
+
+
+#set -x
+
+### Setup some variables.
+### GIT_COMMIT and BUILD_URL are set by Hudson if it is run by patch
process
+### Read variables from properties file
+. `dirname $0`/test-patch.properties
+
+###############################################################################
+parseArgs() {
+ case "$1" in
+ QABUILD)
+ ### Set QABUILD to true to indicate that this script is being run by
Hudson
+ QABUILD=true
+ if [[ $# != 14 ]] ; then
+ echo "ERROR: usage $0 QABUILD <PATCH_DIR> <PS_CMD> <WGET_CMD>
<JIRACLI> <GIT_CMD> <GREP_CMD> <PATCH_CMD> <FINDBUGS_HOME> <FORREST_HOME>
<WORKSPACE_BASEDIR> <JIRA_PASSWD> <JAVA5_HOME> <CURL_CMD>"
+ cleanupAndExit 0
+ fi
+ PATCH_DIR=$2
+ PS=$3
+ WGET=$4
+ JIRACLI=$5
+ GIT=$6
+ GREP=$7
+ PATCH=$8
+ FINDBUGS_HOME=$9
+ FORREST_HOME=${10}
+ BASEDIR=${11}
+ JIRA_PASSWD=${12}
+ JAVA5_HOME=${13}
+ CURL=${14}
+ if [ ! -e "$PATCH_DIR" ] ; then
+ mkdir -p $PATCH_DIR
+ fi
+
+ ## Obtain PR number and title
+ PULLREQUEST_ID=${GIT_PR_NUMBER}
+ PULLREQUEST_TITLE="${GIT_PR_TITLE}"
+
+ ## Extract jira number from PR title
+ local prefix=${PULLREQUEST_TITLE%ZOOKEEPER\-[0-9]*}
+ local noprefix=${PULLREQUEST_TITLE#$prefix}
+ local regex='\(ZOOKEEPER-.[0-9]*\)'
+ defect=$(expr "$noprefix" : ${regex})
+
+ echo "Pull request id: ${PULLREQUEST_ID}"
+ echo "Pull request title: ${PULLREQUEST_TITLE}"
+ echo "Defect number: ${defect}"
+
+ JIRA_COMMENT="GitHub Pull Request ${PULLREQUEST_NUMBER} Build
+ "
+ ;;
+ DEVELOPER)
+ ### Set QABUILD to false to indicate that this script is being run
by a developer
+ QABUILD=false
+ if [[ $# != 10 ]] ; then
+ echo "ERROR: usage $0 DEVELOPER <GIT_PR_URL> <SCRATCH_DIR>
<GIT_CMD> <GREP_CMD> <PATCH_CMD> <FINDBUGS_HOME> <FORREST_HOME>
<WORKSPACE_BASEDIR> <JAVA5_HOME>"
+ cleanupAndExit 0
+ fi
+ PATCH_DIR=$3
+ PATCH_FILE=${PATCH_DIR}/patch
+ curl -L $2.diff > ${PATCH_FILE}
+ ### PATCH_FILE contains the location of the patchfile
+ if [[ ! -e "$PATCH_FILE" ]] ; then
+ echo "Unable to locate the patch file $PATCH_FILE"
+ cleanupAndExit 0
+ fi
+ ### Check if $PATCH_DIR exists. If it does not exist, create a new
directory
+ if [[ ! -e "$PATCH_DIR" ]] ; then
+ mkdir "$PATCH_DIR"
+ if [[ $? == 0 ]] ; then
+ echo "$PATCH_DIR has been created"
+ else
+ echo "Unable to create $PATCH_DIR"
+ cleanupAndExit 0
+ fi
+ fi
+ GIT=$4
+ GREP=$5
+ PATCH=$6
+ FINDBUGS_HOME=$7
+ FORREST_HOME=$8
+ BASEDIR=$9
+ JAVA5_HOME=${10}
+ ### Obtain the patch filename to append it to the version number
+ local subject=`grep "Subject:" ${PATCH_FILE}`
+ local length=`expr match ${subject} ZOOKEEPER-[0-9]*`
+ local position=`expr index ${subject} ZOOKEEPER-`
+ defect=${${subject:$position:$length}#ZOOKEEPER-}
+ ;;
+ *)
+ echo "ERROR: usage $0 QABUILD [args] | DEVELOPER [args]"
+ cleanupAndExit 0
+ ;;
+ esac
+}
+
+###############################################################################
+checkout () {
+ echo ""
+ echo ""
+ echo
"======================================================================"
+ echo
"======================================================================"
+ echo " Testing patch for pull request ${PULLREQUEST_ID}."
+ echo
"======================================================================"
+ echo
"======================================================================"
+ echo ""
+ echo ""
+ ### When run by a developer, if the workspace contains modifications, do
not continue
+ # Ref http://stackoverflow.com/a/2659808 for details on checking dirty
status
+ ${GIT} diff-index --quiet HEAD
+ if [[ $? -ne 0 ]] ; then
+ uncommitted=`${GIT} diff --name-only HEAD`
+ uncommitted="You have the following files with uncommitted
changes:${NEWLINE}${uncommitted}"
+ fi
+ untracked="$(${GIT} ls-files --exclude-standard --others)" && test -z
"${untracked}"
+ if [[ $? -ne 0 ]] ; then
+ untracked="You have untracked and unignored
files:${NEWLINE}${untracked}"
+ fi
+
+ if [[ $QABUILD == "false" ]] ; then
+ if [[ $uncommitted || $untracked ]] ; then
+ echo "ERROR: can't run in a workspace that contains the following
modifications"
+ echo ""
+ echo "${uncommitted}"
+ echo ""
+ echo "${untracked}"
+ cleanupAndExit 1
+ fi
+ else
+ # I don't believe we need to do anything here - the jenkins job will
+ # cleanup the environment for us ("cleanup before checkout" action)
+ # on the precommit jenkins job
+ echo
+ fi
+ return $?
+}
+
+###############################################################################
+setup () {
+ ### exit if warnings are NOT defined in the properties file
+ if [ -z "$OK_FINDBUGS_WARNINGS" ] || [[ -z "$OK_JAVADOC_WARNINGS" ]] ||
[[ -z $OK_RELEASEAUDIT_WARNINGS ]]; then
+ echo "Please define the following properties in test-patch.properties
file"
+ echo "OK_FINDBUGS_WARNINGS"
+ echo "OK_RELEASEAUDIT_WARNINGS"
+ echo "OK_JAVADOC_WARNINGS"
+ cleanupAndExit 1
+ fi
+ ### get pull request diff
+ ${CURL} -L ${GIT_PR_URL}.diff > $PATCH_DIR/patch
+
+ echo ""
+ echo ""
+ echo
"======================================================================"
+ echo
"======================================================================"
+ echo " Pre-build trunk to verify trunk stability and javac warnings"
+ echo
"======================================================================"
+ echo
"======================================================================"
+ echo ""
+ echo ""
+ echo "$ANT_HOME/bin/ant -Djavac.args="-Xlint -Xmaxwarns 1000"
-Djava5.home=${JAVA5_HOME} -Dforrest.home=${FORREST_HOME}
-DZookeeperPatchProcess= clean tar > $PATCH_DIR/trunkJavacWarnings.txt 2>&1"
--- End diff --
Same here: jdk5
> Port QA github pull request build to branch 3.4 and 3.5
> -------------------------------------------------------
>
> Key: ZOOKEEPER-2665
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2665
> Project: ZooKeeper
> Issue Type: Test
> Components: build
> Reporter: Flavio Junqueira
> Fix For: 3.5.3, 3.4.11
>
>
> We have QA build for pull requests against master but not against branches
> 3.4 and 3.5. We need to port the necessary wiring to do it, it shouldn't be
> difficult.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)