Skip to content

Commit 4efdc76

Browse files
felixcheungFelix Cheung
authored andcommitted
[SPARK-17674][SPARKR] check for warning in test output
## What changes were proposed in this pull request? testthat library we are using for testing R is redirecting warning (and disabling `options("warn" = 2)`), we need to have a way to detect any new warning and fail ## How was this patch tested? manual testing, Jenkins Author: Felix Cheung <felixcheung_m@hotmail.com> Closes #15576 from felixcheung/rtestwarning.
1 parent b3b4b95 commit 4efdc76

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

R/run-tests.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ rm -f $LOGFILE
2626
SPARK_TESTING=1 $FWDIR/../bin/spark-submit --driver-java-options "-Dlog4j.configuration=file:$FWDIR/log4j.properties" --conf spark.hadoop.fs.default.name="file:///" $FWDIR/pkg/tests/run-all.R 2>&1 | tee -a $LOGFILE
2727
FAILED=$((PIPESTATUS[0]||$FAILED))
2828

29+
NUM_TEST_WARNING="$(grep -c -e 'Warnings ----------------' $LOGFILE)"
30+
2931
# Also run the documentation tests for CRAN
3032
CRAN_CHECK_LOG_FILE=$FWDIR/cran-check.out
3133
rm -f $CRAN_CHECK_LOG_FILE
@@ -37,10 +39,10 @@ NUM_CRAN_WARNING="$(grep -c WARNING$ $CRAN_CHECK_LOG_FILE)"
3739
NUM_CRAN_ERROR="$(grep -c ERROR$ $CRAN_CHECK_LOG_FILE)"
3840
NUM_CRAN_NOTES="$(grep -c NOTE$ $CRAN_CHECK_LOG_FILE)"
3941

40-
if [[ $FAILED != 0 ]]; then
42+
if [[ $FAILED != 0 || $NUM_TEST_WARNING != 0 ]]; then
4143
cat $LOGFILE
4244
echo -en "\033[31m" # Red
43-
echo "Had test failures; see logs."
45+
echo "Had test warnings or failures; see logs."
4446
echo -en "\033[0m" # No color
4547
exit -1
4648
else

0 commit comments

Comments
 (0)