2626FWDIR=" $( cd ` dirname $0 ` /..; pwd) "
2727cd " $FWDIR "
2828
29- function get_jq () {
30- # Get jq so we can parse some JSON, man.
31- # Essential if we want to do anything with the GitHub API responses.
32- local JQ_EXECUTABLE_URL=" http://stedolan.github.io/jq/download/linux64/jq"
33-
34- echo " Fetching jq from ${JQ_EXECUTABLE_URL} "
35-
36- curl --silent --output " $FWDIR /dev/jq" " $JQ_EXECUTABLE_URL "
37- local curl_status=$?
38-
39- if [ $curl_status -ne 0 ]; then
40- echo " Failed to get jq." >&2
41- return $curl_status
42- fi
43-
44- chmod u+x " $FWDIR /dev/jq"
45- }
46-
4729COMMENTS_URL=" https://api.github.com/repos/apache/spark/issues/$ghprbPullId /comments"
4830PULL_REQUEST_URL=" https://github.com/apache/spark/pull/$ghprbPullId "
4931
32+ COMMIT_URL=" https://github.com/apache/spark/commit/${ghprbActualCommit} "
33+ # GitHub doesn't auto-link short hashes when submitted via the API, unfortunately. :(
34+ SHORT_COMMIT_HASH=" ${ghprbActualCommit: 0: 7} "
35+
36+ # NOTE: Jenkins will kill the whole build after 120 minutes.
37+ # Tests are a large part of that, but not all of it.
38+ TESTS_TIMEOUT=" 120m"
39+
5040function post_message () {
5141 local message=$1
5242 local data=" {\" body\" : \" $message \" }"
@@ -96,10 +86,6 @@ function post_message () {
9686 fi
9787}
9888
99- COMMIT_URL=" https://github.com/apache/spark/commit/${ghprbActualCommit} "
100- # GitHub doesn't auto-link short hashes when submitted via the API, unfortunately. :(
101- short_commit_hash=${ghprbActualCommit: 0: 7}
102-
10389# check PR merge-ability and check for new public classes
10490{
10591 if [ " $sha1 " == " $ghprbActualCommit " ]; then
@@ -138,7 +124,7 @@ short_commit_hash=${ghprbActualCommit:0:7}
138124{
139125 start_message=" \
140126 [QA tests have started](${BUILD_URL} consoleFull) for \
141- PR $ghprbPullId at commit [\` ${short_commit_hash } \` ](${COMMIT_URL} )."
127+ PR $ghprbPullId at commit [\` ${SHORT_COMMIT_HASH } \` ](${COMMIT_URL} )."
142128
143129 start_message=" ${start_message} \n${merge_note} "
144130 # start_message="${start_message}\n${public_classes_note}"
@@ -148,21 +134,27 @@ short_commit_hash=${ghprbActualCommit:0:7}
148134
149135# run tests
150136{
151- ./dev/run-tests
137+ timeout " ${TESTS_TIMEOUT} " ./dev/run-tests
152138 test_result=" $? "
153139
154- if [ " $test_result " -eq " 0" ]; then
155- test_result_note=" * This patch **passes** unit tests."
140+ if [ " $test_result " -eq " 124" ]; then
141+ fail_message=" **Tests timed out** after a configured wait of \` ${TESTS_TIMEOUT} \` ."
142+ post_message " $fail_message "
143+ exit $test_result
156144 else
157- test_result_note=" * This patch **fails** unit tests."
145+ if [ " $test_result " -eq " 0" ]; then
146+ test_result_note=" * This patch **passes** unit tests."
147+ else
148+ test_result_note=" * This patch **fails** unit tests."
149+ fi
158150 fi
159151}
160152
161153# post end message
162154{
163155 result_message=" \
164156 [QA tests have finished](${BUILD_URL} consoleFull) for \
165- PR $ghprbPullId at commit [\` ${short_commit_hash } \` ](${COMMIT_URL} )."
157+ PR $ghprbPullId at commit [\` ${SHORT_COMMIT_HASH } \` ](${COMMIT_URL} )."
166158
167159 result_message=" ${result_message} \n${test_result_note} "
168160 result_message=" ${result_message} \n${merge_note} "
0 commit comments