Skip to content

Commit df1b9f7

Browse files
ScrapCodespwendell
authored andcommitted
SPARK-1336 Reducing the output of run-tests script.
Author: Prashant Sharma <[email protected]> Author: Prashant Sharma <[email protected]> Closes #262 from ScrapCodes/SPARK-1336/ReduceVerbosity and squashes the following commits: 87dfa54 [Prashant Sharma] Further reduction in noise and made pyspark tests to fail fast. 811170f [Prashant Sharma] Reducing the ouput of run-tests script.
1 parent 2861b07 commit df1b9f7

File tree

4 files changed

+43
-11
lines changed

4 files changed

+43
-11
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,4 @@ spark-*-bin.tar.gz
4747
unit-tests.log
4848
/lib/
4949
rat-results.txt
50+
scalastyle.txt

dev/run-tests

+3-4
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,17 @@ JAVA_VERSION=$($java_cmd -version 2>&1 | sed 's/java version "\(.*\)\.\(.*\)\..*
3939
echo "========================================================================="
4040
echo "Running Apache RAT checks"
4141
echo "========================================================================="
42-
4342
dev/check-license
4443

4544
echo "========================================================================="
4645
echo "Running Scala style checks"
4746
echo "========================================================================="
48-
sbt/sbt clean scalastyle
47+
dev/scalastyle
4948

5049
echo "========================================================================="
5150
echo "Running Spark unit tests"
5251
echo "========================================================================="
53-
sbt/sbt assembly test
52+
sbt/sbt assembly test | grep -v -e "info.*Resolving" -e "warn.*Merging" -e "info.*Including"
5453

5554
echo "========================================================================="
5655
echo "Running PySpark tests"
@@ -64,5 +63,5 @@ echo "========================================================================="
6463
echo "Detecting binary incompatibilites with MiMa"
6564
echo "========================================================================="
6665
./bin/spark-class org.apache.spark.tools.GenerateMIMAIgnore
67-
sbt/sbt mima-report-binary-issues
66+
sbt/sbt mima-report-binary-issues | grep -v -e "info.*Resolving"
6867

dev/scalastyle

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# Licensed to the Apache Software Foundation (ASF) under one or more
5+
# contributor license agreements. See the NOTICE file distributed with
6+
# this work for additional information regarding copyright ownership.
7+
# The ASF licenses this file to You under the Apache License, Version 2.0
8+
# (the "License"); you may not use this file except in compliance with
9+
# the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
#
19+
20+
sbt/sbt clean scalastyle > scalastyle.txt
21+
ERRORS=$(cat scalastyle.txt | grep -e "error file")
22+
if test ! -z "$ERRORS"; then
23+
echo -e "Scalastyle checks failed at following occurrences:\n$ERRORS"
24+
exit 1
25+
else
26+
echo -e "Scalastyle checks passed.\n"
27+
fi

python/run-tests

+12-7
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,18 @@ FAILED=0
2929
rm -f unit-tests.log
3030

3131
function run_test() {
32-
SPARK_TESTING=0 $FWDIR/bin/pyspark $1 2>&1 | tee -a unit-tests.log
32+
SPARK_TESTING=0 $FWDIR/bin/pyspark $1 2>&1 | tee -a > unit-tests.log
3333
FAILED=$((PIPESTATUS[0]||$FAILED))
34+
35+
# Fail and exit on the first test failure.
36+
if [[ $FAILED != 0 ]]; then
37+
cat unit-tests.log | grep -v "^[0-9][0-9]*" # filter all lines starting with a number.
38+
echo -en "\033[31m" # Red
39+
echo "Had test failures; see logs."
40+
echo -en "\033[0m" # No color
41+
exit -1
42+
fi
43+
3444
}
3545

3646
run_test "pyspark/rdd.py"
@@ -46,12 +56,7 @@ run_test "pyspark/mllib/clustering.py"
4656
run_test "pyspark/mllib/recommendation.py"
4757
run_test "pyspark/mllib/regression.py"
4858

49-
if [[ $FAILED != 0 ]]; then
50-
echo -en "\033[31m" # Red
51-
echo "Had test failures; see logs."
52-
echo -en "\033[0m" # No color
53-
exit -1
54-
else
59+
if [[ $FAILED == 0 ]]; then
5560
echo -en "\033[32m" # Green
5661
echo "Tests passed."
5762
echo -en "\033[0m" # No color

0 commit comments

Comments
 (0)