Skip to content

Commit

Permalink
Faster R Tests (apache#314)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmanis authored and robert3005 committed Feb 12, 2018
1 parent ed7fc1c commit 7257b91
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
File renamed without changes.
24 changes: 17 additions & 7 deletions R/pkg/tests/run-all.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,23 @@ if (identical(Sys.getenv("NOT_CRAN"), "true")) {
test_package("SparkR")

if (identical(Sys.getenv("NOT_CRAN"), "true")) {
# set random seed for predictable results. mostly for base's sample() in tree and classification
set.seed(42)
# for testthat 1.0.2 later, change reporter from "summary" to default_reporter()
testthat:::run_tests("SparkR",
file.path(sparkRDir, "pkg", "tests", "fulltests"),
NULL,
"summary")
if (identical(Sys.getenv("CONDA_TESTS"), "true")) {
# set random seed for predictable results. mostly for base's sample() in tree and classification
set.seed(42)
# for testthat 1.0.2 later, change reporter from "summary" to default_reporter()
testthat:::run_tests("SparkR",
file.path(sparkRDir, "pkg", "tests", "condatests"),
NULL,
"summary")
} else {
# set random seed for predictable results. mostly for base's sample() in tree and classification
set.seed(42)
# for testthat 1.0.2 later, change reporter from "summary" to default_reporter()
testthat:::run_tests("SparkR",
file.path(sparkRDir, "pkg", "tests", "fulltests"),
NULL,
"summary")
}
}

SparkR:::uninstallDownloadedSpark()
6 changes: 5 additions & 1 deletion R/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ FAILED=0
LOGFILE=$FWDIR/unit-tests.out
rm -f $LOGFILE

SPARK_TESTING=1 NOT_CRAN=true $FWDIR/../bin/spark-submit --driver-java-options "-Dlog4j.configuration=file:$FWDIR/log4j.properties" --num-executors 1 --conf spark.hadoop.fs.defaultFS="file:///" --conf spark.conda.binaryPath=$CONDA_BIN --conf spark.conda.bootstrapPackages="r,r-essentials,r-plyr,r-testthat" --conf spark.conda.channelUrls="https://repo.continuum.io/pkgs/r,https://repo.continuum.io/pkgs/main,https://repo.continuum.io/pkgs/free,https://repo.continuum.io/pkgs/pro" $FWDIR/pkg/tests/run-all.R 2>&1 | tee -a $LOGFILE
SPARK_TESTING=1 NOT_CRAN=true $FWDIR/../bin/spark-submit --driver-java-options "-Dlog4j.configuration=file:$FWDIR/log4j.properties" --conf spark.hadoop.fs.defaultFS="file:///" $FWDIR/pkg/tests/run-all.R 2>&1 | tee -a $LOGFILE
FAILED=$((PIPESTATUS[0]||$FAILED))

SPARK_TESTING=1 NOT_CRAN=true CONDA_TESTS=true $FWDIR/../bin/spark-submit --driver-java-options "-Dlog4j.configuration=file:$FWDIR/log4j.properties" --conf spark.hadoop.fs.defaultFS="file:///" --conf spark.conda.binaryPath=$CONDA_BIN --conf spark.conda.bootstrapPackages="r,r-essentials,r-plyr,r-testthat" --conf spark.conda.channelUrls="https://repo.continuum.io/pkgs/r,https://repo.continuum.io/pkgs/main,https://repo.continuum.io/pkgs/free,https://repo.continuum.io/pkgs/pro" $FWDIR/pkg/tests/run-all.R 2>&1 | tee -a $LOGFILE
FAILED=$((PIPESTATUS[0]||$FAILED))


NUM_TEST_WARNING="$(grep -c -e 'Warnings ----------------' $LOGFILE)"

# Also run the documentation tests for CRAN
Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ machine:
- sudo apt-get update
- sudo apt-get --assume-yes install r-base r-base-dev qpdf
- sudo chmod 777 /usr/local/lib/R/site-library
- /usr/lib/R/bin/R -e "install.packages(c('knitr', 'rmarkdown', 'testthat', 'e1071', 'survival', 'devtools', 'roxygen2', 'lintr'), repos='http://cran.us.r-project.org', lib='/usr/local/lib/R/site-library')"
- /usr/lib/R/bin/R -e "install.packages(c('devtools'), repos='http://cran.us.r-project.org', lib='/usr/local/lib/R/site-library'); devtools::install_github('r-lib/testthat@v1.0.2', lib='/usr/local/lib/R/site-library'); install.packages(c('knitr', 'rmarkdown', 'e1071', 'survival', 'roxygen2', 'lintr'), repos='http://cran.us.r-project.org', lib='/usr/local/lib/R/site-library')"
- |
if [[ ! -d ${CONDA_ROOT} ]]; then
echo "Installing Miniconda...";
Expand Down

0 comments on commit 7257b91

Please sign in to comment.