From 349d95d0ce933d6670d5326ab560ccef420b814e Mon Sep 17 00:00:00 2001 From: Shivaram Venkataraman Date: Sun, 21 Aug 2016 13:43:15 -0700 Subject: [PATCH 1/5] Add CRAN documentation checks to run-tests.sh --- R/check-cran.sh | 2 +- R/run-tests.sh | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/R/check-cran.sh b/R/check-cran.sh index 5c90fd07f28e4..8cbec038a686e 100755 --- a/R/check-cran.sh +++ b/R/check-cran.sh @@ -47,6 +47,6 @@ $FWDIR/create-docs.sh VERSION=`grep Version $FWDIR/pkg/DESCRIPTION | awk '{print $NF}'` -"$R_SCRIPT_PATH/"R CMD check --as-cran SparkR_"$VERSION".tar.gz +"$R_SCRIPT_PATH/"R CMD check $CRAN_CHECK_OPTIONS --as-cran SparkR_"$VERSION".tar.gz popd > /dev/null diff --git a/R/run-tests.sh b/R/run-tests.sh index 9dcf0ace7d97e..5a422f28de4e7 100755 --- a/R/run-tests.sh +++ b/R/run-tests.sh @@ -26,6 +26,14 @@ rm -f $LOGFILE 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 FAILED=$((PIPESTATUS[0]||$FAILED)) +# Also run the documentation tests for CRAN +CRAN_CHECK_LOG_FILE=$FWDIR/cran-check.out +rm -f $CRAN_CHECK_LOG_FILE +CRAN_CHECK_OPTIONS="--no-tests --no-manual" $FWDIR/check-cran.sh 2>&1 | tee -a $CRAN_CHECK_LOG_FILE +FAILED=$((PIPESTATUS[0]||$FAILED)) + +HAS_CRAN_WARNING="$(grep -c WARNING $CRAN_CHECK_LOG_FILE)" + if [[ $FAILED != 0 ]]; then cat $LOGFILE echo -en "\033[31m" # Red @@ -33,7 +41,15 @@ if [[ $FAILED != 0 ]]; then echo -en "\033[0m" # No color exit -1 else - echo -en "\033[32m" # Green - echo "Tests passed." - echo -en "\033[0m" # No color + if [[ $HAS_CRAN_WARNING != 0 ]]; then + cat $CRAN_CHECK_LOG_FILE + echo -en "\033[31m" # Red + echo "Had CRAN check warnings; see logs." + echo -en "\033[0m" # No color + exit -1 + else + echo -en "\033[32m" # Green + echo "Tests passed." + echo -en "\033[0m" # No color + fi fi From 96216ac20d4a77810ce957c15fabb9266028fe98 Mon Sep 17 00:00:00 2001 From: Shivaram Venkataraman Date: Mon, 22 Aug 2016 12:46:23 -0700 Subject: [PATCH 2/5] Remove e1071 to make Jenkins work for now --- R/pkg/DESCRIPTION | 1 - 1 file changed, 1 deletion(-) diff --git a/R/pkg/DESCRIPTION b/R/pkg/DESCRIPTION index 357ab007931f5..6e73243cd67de 100644 --- a/R/pkg/DESCRIPTION +++ b/R/pkg/DESCRIPTION @@ -10,7 +10,6 @@ Depends: methods Suggests: testthat, - e1071, survival Description: The SparkR package provides an R frontend for Apache Spark. License: Apache License (== 2.0) From 9de5e5974b5d596865adeba912c4c7c3f26809e0 Mon Sep 17 00:00:00 2001 From: Shivaram Venkataraman Date: Mon, 22 Aug 2016 14:00:44 -0700 Subject: [PATCH 3/5] Revert change to DESCRIPTION --- R/pkg/DESCRIPTION | 1 + 1 file changed, 1 insertion(+) diff --git a/R/pkg/DESCRIPTION b/R/pkg/DESCRIPTION index 6e73243cd67de..357ab007931f5 100644 --- a/R/pkg/DESCRIPTION +++ b/R/pkg/DESCRIPTION @@ -10,6 +10,7 @@ Depends: methods Suggests: testthat, + e1071, survival Description: The SparkR package provides an R frontend for Apache Spark. License: Apache License (== 2.0) From 5df8936651fb3a51fdc785740cdd27afd1c51171 Mon Sep 17 00:00:00 2001 From: Shivaram Venkataraman Date: Mon, 22 Aug 2016 14:01:11 -0700 Subject: [PATCH 4/5] ALso check for errors, notes. Refactor options --- R/check-cran.sh | 18 +++++++++++++++--- R/run-tests.sh | 12 ++++++++---- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/R/check-cran.sh b/R/check-cran.sh index 8cbec038a686e..bb331466ae931 100755 --- a/R/check-cran.sh +++ b/R/check-cran.sh @@ -43,10 +43,22 @@ $FWDIR/create-docs.sh "$R_SCRIPT_PATH/"R CMD build $FWDIR/pkg # Run check as-cran. -# TODO(shivaram): Remove the skip tests once we figure out the install mechanism - VERSION=`grep Version $FWDIR/pkg/DESCRIPTION | awk '{print $NF}'` -"$R_SCRIPT_PATH/"R CMD check $CRAN_CHECK_OPTIONS --as-cran SparkR_"$VERSION".tar.gz +CRAN_CHECK_OPTIONS="--as-cran" + +if [ -n "$NO_TESTS" ] +then + CRAN_CHECK_OPTIONS=$CRAN_CHECK_OPTIONS" --no-tests" +fi + +if [ -n "$NO_MANUAL" ] +then + CRAN_CHECK_OPTIONS=$CRAN_CHECK_OPTIONS" --no-manual" +fi + +echo "Running CRAN check with $CRAN_CHECK_OPTIONS options" + +"$R_SCRIPT_PATH/"R CMD check $CRAN_CHECK_OPTIONS SparkR_"$VERSION".tar.gz popd > /dev/null diff --git a/R/run-tests.sh b/R/run-tests.sh index 5a422f28de4e7..eb5cc4c2ed0a6 100755 --- a/R/run-tests.sh +++ b/R/run-tests.sh @@ -29,10 +29,13 @@ FAILED=$((PIPESTATUS[0]||$FAILED)) # Also run the documentation tests for CRAN CRAN_CHECK_LOG_FILE=$FWDIR/cran-check.out rm -f $CRAN_CHECK_LOG_FILE -CRAN_CHECK_OPTIONS="--no-tests --no-manual" $FWDIR/check-cran.sh 2>&1 | tee -a $CRAN_CHECK_LOG_FILE + +NO_TESTS=1 NO_MANUAL=1 $FWDIR/check-cran.sh 2>&1 | tee -a $CRAN_CHECK_LOG_FILE FAILED=$((PIPESTATUS[0]||$FAILED)) -HAS_CRAN_WARNING="$(grep -c WARNING $CRAN_CHECK_LOG_FILE)" +NUM_CRAN_WARNING="$(grep -c WARNING$ $CRAN_CHECK_LOG_FILE)" +NUM_CRAN_ERROR="$(grep -c ERROR$ $CRAN_CHECK_LOG_FILE)" +NUM_CRAN_NOTES="$(grep -c NOTE$ $CRAN_CHECK_LOG_FILE)" if [[ $FAILED != 0 ]]; then cat $LOGFILE @@ -41,10 +44,11 @@ if [[ $FAILED != 0 ]]; then echo -en "\033[0m" # No color exit -1 else - if [[ $HAS_CRAN_WARNING != 0 ]]; then + # We have 2 existing NOTEs for new maintainer, attach() + if [[ $NUM_CRAN_WARNING != 0 || $NUM_CRAN_ERROR != 0 || $NUM_CRAN_NOTES != 2 ]]; then cat $CRAN_CHECK_LOG_FILE echo -en "\033[31m" # Red - echo "Had CRAN check warnings; see logs." + echo "Had CRAN check errors; see logs." echo -en "\033[0m" # No color exit -1 else From 2bde2b41f3d69a76acb09bca046ca21bfdbd7b28 Mon Sep 17 00:00:00 2001 From: Shivaram Venkataraman Date: Mon, 22 Aug 2016 15:04:37 -0700 Subject: [PATCH 5/5] Handle extra NOTE in Jenkins --- R/run-tests.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/R/run-tests.sh b/R/run-tests.sh index eb5cc4c2ed0a6..1a1e8ab9ffe18 100755 --- a/R/run-tests.sh +++ b/R/run-tests.sh @@ -45,7 +45,8 @@ if [[ $FAILED != 0 ]]; then exit -1 else # We have 2 existing NOTEs for new maintainer, attach() - if [[ $NUM_CRAN_WARNING != 0 || $NUM_CRAN_ERROR != 0 || $NUM_CRAN_NOTES != 2 ]]; then + # We have one more NOTE in Jenkins due to "No repository set" + if [[ $NUM_CRAN_WARNING != 0 || $NUM_CRAN_ERROR != 0 || $NUM_CRAN_NOTES -gt 3 ]]; then cat $CRAN_CHECK_LOG_FILE echo -en "\033[31m" # Red echo "Had CRAN check errors; see logs."