|
26 | 26 | FWDIR="$(cd `dirname $0`/..; pwd)"
|
27 | 27 | cd "$FWDIR"
|
28 | 28 |
|
| 29 | +source "$FWDIR/dev/run-tests-codes.sh" |
| 30 | + |
29 | 31 | COMMENTS_URL="https://api.github.com/repos/apache/spark/issues/$ghprbPullId/comments"
|
30 | 32 | PULL_REQUEST_URL="https://github.com/apache/spark/pull/$ghprbPullId"
|
31 | 33 |
|
| 34 | +# Important Environment Variables |
| 35 | +# --- |
| 36 | +# $ghprbActualCommit |
| 37 | +#+ This is the hash of the most recent commit in the PR. |
| 38 | +#+ The merge-base of this and master is the commit from which the PR was branched. |
| 39 | +# $sha1 |
| 40 | +#+ If the patch merges cleanly, this is a reference to the merge commit hash |
| 41 | +#+ (e.g. "origin/pr/2606/merge"). |
| 42 | +#+ If the patch does not merge cleanly, it is equal to $ghprbActualCommit. |
| 43 | +#+ The merge-base of this and master in the case of a clean merge is the most recent commit |
| 44 | +#+ against master. |
| 45 | + |
32 | 46 | COMMIT_URL="https://github.com/apache/spark/commit/${ghprbActualCommit}"
|
33 | 47 | # GitHub doesn't auto-link short hashes when submitted via the API, unfortunately. :(
|
34 | 48 | SHORT_COMMIT_HASH="${ghprbActualCommit:0:7}"
|
@@ -84,42 +98,46 @@ function post_message () {
|
84 | 98 | fi
|
85 | 99 | }
|
86 | 100 |
|
| 101 | + |
| 102 | +# We diff master...$ghprbActualCommit because that gets us changes introduced in the PR |
| 103 | +#+ and not anything else added to master since the PR was branched. |
| 104 | + |
87 | 105 | # check PR merge-ability and check for new public classes
|
88 | 106 | {
|
89 | 107 | if [ "$sha1" == "$ghprbActualCommit" ]; then
|
90 |
| - merge_note=" * This patch **does not** merge cleanly!" |
| 108 | + merge_note=" * This patch **does not merge cleanly**." |
91 | 109 | else
|
92 | 110 | merge_note=" * This patch merges cleanly."
|
| 111 | + fi |
| 112 | + |
| 113 | + source_files=$( |
| 114 | + git diff master...$ghprbActualCommit --name-only `# diff patch against master from branch point` \ |
| 115 | + | grep -v -e "\/test" `# ignore files in test directories` \ |
| 116 | + | grep -e "\.py$" -e "\.java$" -e "\.scala$" `# include only code files` \ |
| 117 | + | tr "\n" " " |
| 118 | + ) |
| 119 | + new_public_classes=$( |
| 120 | + git diff master...$ghprbActualCommit ${source_files} `# diff patch against master from branch point` \ |
| 121 | + | grep "^\+" `# filter in only added lines` \ |
| 122 | + | sed -r -e "s/^\+//g" `# remove the leading +` \ |
| 123 | + | grep -e "trait " -e "class " `# filter in lines with these key words` \ |
| 124 | + | grep -e "{" -e "(" `# filter in lines with these key words, too` \ |
| 125 | + | grep -v -e "\@\@" -e "private" `# exclude lines with these words` \ |
| 126 | + | grep -v -e "^// " -e "^/\*" -e "^ \* " `# exclude comment lines` \ |
| 127 | + | sed -r -e "s/\{.*//g" `# remove from the { onwards` \ |
| 128 | + | sed -r -e "s/\}//g" `# just in case, remove }; they mess the JSON` \ |
| 129 | + | sed -r -e "s/\"/\\\\\"/g" `# escape double quotes; they mess the JSON` \ |
| 130 | + | sed -r -e "s/^(.*)$/\`\1\`/g" `# surround with backticks for style` \ |
| 131 | + | sed -r -e "s/^/ \* /g" `# prepend ' *' to start of line` \ |
| 132 | + | sed -r -e "s/$/\\\n/g" `# append newline to end of line` \ |
| 133 | + | tr -d "\n" `# remove actual LF characters` |
| 134 | + ) |
93 | 135 |
|
94 |
| - source_files=$( |
95 |
| - git diff master... --name-only `# diff patch against master from branch point` \ |
96 |
| - | grep -v -e "\/test" `# ignore files in test directories` \ |
97 |
| - | grep -e "\.py$" -e "\.java$" -e "\.scala$" `# include only code files` \ |
98 |
| - | tr "\n" " " |
99 |
| - ) |
100 |
| - new_public_classes=$( |
101 |
| - git diff master... ${source_files} `# diff patch against master from branch point` \ |
102 |
| - | grep "^\+" `# filter in only added lines` \ |
103 |
| - | sed -r -e "s/^\+//g" `# remove the leading +` \ |
104 |
| - | grep -e "trait " -e "class " `# filter in lines with these key words` \ |
105 |
| - | grep -e "{" -e "(" `# filter in lines with these key words, too` \ |
106 |
| - | grep -v -e "\@\@" -e "private" `# exclude lines with these words` \ |
107 |
| - | grep -v -e "^// " -e "^/\*" -e "^ \* " `# exclude comment lines` \ |
108 |
| - | sed -r -e "s/\{.*//g" `# remove from the { onwards` \ |
109 |
| - | sed -r -e "s/\}//g" `# just in case, remove }; they mess the JSON` \ |
110 |
| - | sed -r -e "s/\"/\\\\\"/g" `# escape double quotes; they mess the JSON` \ |
111 |
| - | sed -r -e "s/^(.*)$/\`\1\`/g" `# surround with backticks for style` \ |
112 |
| - | sed -r -e "s/^/ \* /g" `# prepend ' *' to start of line` \ |
113 |
| - | sed -r -e "s/$/\\\n/g" `# append newline to end of line` \ |
114 |
| - | tr -d "\n" `# remove actual LF characters` |
115 |
| - ) |
116 |
| - |
117 |
| - if [ "$new_public_classes" == "" ]; then |
118 |
| - public_classes_note=" * This patch adds no public classes." |
119 |
| - else |
120 |
| - public_classes_note=" * This patch adds the following public classes _(experimental)_:" |
121 |
| - public_classes_note="${public_classes_note}\n${new_public_classes}" |
122 |
| - fi |
| 136 | + if [ -z "$new_public_classes" ]; then |
| 137 | + public_classes_note=" * This patch adds no public classes." |
| 138 | + else |
| 139 | + public_classes_note=" * This patch adds the following public classes _(experimental)_:" |
| 140 | + public_classes_note="${public_classes_note}\n${new_public_classes}" |
123 | 141 | fi
|
124 | 142 | }
|
125 | 143 |
|
@@ -147,12 +165,30 @@ function post_message () {
|
147 | 165 |
|
148 | 166 | post_message "$fail_message"
|
149 | 167 | exit $test_result
|
| 168 | + elif [ "$test_result" -eq "0" ]; then |
| 169 | + test_result_note=" * This patch **passes all tests**." |
150 | 170 | else
|
151 |
| - if [ "$test_result" -eq "0" ]; then |
152 |
| - test_result_note=" * This patch **passes** unit tests." |
| 171 | + if [ "$test_result" -eq "$BLOCK_GENERAL" ]; then |
| 172 | + failing_test="some tests" |
| 173 | + elif [ "$test_result" -eq "$BLOCK_RAT" ]; then |
| 174 | + failing_test="RAT tests" |
| 175 | + elif [ "$test_result" -eq "$BLOCK_SCALA_STYLE" ]; then |
| 176 | + failing_test="Scala style tests" |
| 177 | + elif [ "$test_result" -eq "$BLOCK_PYTHON_STYLE" ]; then |
| 178 | + failing_test="Python style tests" |
| 179 | + elif [ "$test_result" -eq "$BLOCK_BUILD" ]; then |
| 180 | + failing_test="to build" |
| 181 | + elif [ "$test_result" -eq "$BLOCK_SPARK_UNIT_TESTS" ]; then |
| 182 | + failing_test="Spark unit tests" |
| 183 | + elif [ "$test_result" -eq "$BLOCK_PYSPARK_UNIT_TESTS" ]; then |
| 184 | + failing_test="PySpark unit tests" |
| 185 | + elif [ "$test_result" -eq "$BLOCK_MIMA" ]; then |
| 186 | + failing_test="MiMa tests" |
153 | 187 | else
|
154 |
| - test_result_note=" * This patch **fails** unit tests." |
| 188 | + failing_test="some tests" |
155 | 189 | fi
|
| 190 | + |
| 191 | + test_result_note=" * This patch **fails $failing_test**." |
156 | 192 | fi
|
157 | 193 | }
|
158 | 194 |
|
|
0 commit comments