Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ On each Pull Request opened in GitHub we run Travis CI and Appveyor to provide p

Test jobs:
- `test-rel-lin` - `r-release` on Linux, most comprehensive test environment, `-O3 -flto -fno-common -Wunused-result`, extra check for no compilation warnings, includes testing [_with other packages_](./../inst/tests/other.Rraw) ([extended suggests](./../inst/tests/tests-DESCRIPTION))
- `test-rel-cran-lin` - `--as-cran` on Linux, `-g0`, extra check for `Status: OK` in `R CMD check`
- `test-rel-cran-lin` - `--as-cran` on Linux, `-g0`, extra check for final status of `R CMD check` where we allow one NOTE (_size of tarball_).
- `test-dev-cran-lin` - `r-devel` and `--as-cran` on Linux, `--enable-strict-barrier --disable-long-double`
- `test-rel-vanilla-lin` - `r-release` on Linux, no suggested deps, no OpenMP, `-O0`, tracks memory usage during tests
- `test-310-cran-lin` - R 3.1.0 on Linux
- `test-344-cran-lin` - R 3.4.4 on Linux
- `test-350-cran-lin` - R 3.5.0 on Linux, no `r-recommended`
- `test-rel-win` - `r-release` on Windows
- `test-dev-win` - `r-devel` on Windows
- `test-rel-osx` - MacOSX build not yet deployed, see [#3326](https://github.com/Rdatatable/data.table/issues/3326) for status
Expand Down
66 changes: 33 additions & 33 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ mirror-packages: # download all recursive dependencies of data.table suggests an
- mkdir -p bus/$CI_BUILD_NAME/cran/src/contrib
# mirror R dependencies: source, win.binary
- Rscript -e 'mirror.packages(dcf.dependencies(c("DESCRIPTION","inst/tests/tests-DESCRIPTION"), "all"), repos=c(Sys.getenv("CRAN_MIRROR"), dcf.repos("inst/tests/tests-DESCRIPTION")), repodir="bus/mirror-packages/cran")'
- rm bus/$CI_BUILD_NAME/cran/src/contrib/PACKAGES.rds # fallback to PACKAGES dcf so available.packages 3.4.4 works
- Rscript -e 'sapply(simplify=FALSE, setNames(nm=Sys.getenv(c("R_BIN_VERSION","R_DEVEL_BIN_VERSION"))), function(binary.ver) mirror.packages(type="win.binary", dcf.dependencies("DESCRIPTION", "all"), repos=Sys.getenv("CRAN_MIRROR"), repodir="bus/mirror-packages/cran", binary.ver=binary.ver))'
<<: *artifacts

Expand All @@ -51,19 +52,17 @@ build: # build data.table sources as tar.gz archive
- mkdir -p bus/$CI_BUILD_NAME/cran/src/contrib
- mv $(ls -1t data.table_*.tar.gz | head -n 1) bus/$CI_BUILD_NAME/cran/src/contrib/.
- Rscript -e 'tools::write_PACKAGES(contrib.url("bus/build/cran"), fields="Revision", addFiles=TRUE)'
- rm bus/$CI_BUILD_NAME/cran/src/contrib/PACKAGES.rds # fallback to PACKAGES dcf so available.packages 3.4.4 works
<<: *artifacts

.test-copy-src: &copy-src
- &copy-src
cp $(ls -1t bus/build/cran/src/contrib/data.table_*.tar.gz | head -n 1) .
- cp $(ls -1t bus/build/cran/src/contrib/data.table_*.tar.gz | head -n 1) .

.test-move-src: &move-src
- &move-src
mkdir -p bus/$CI_BUILD_NAME && mv $(ls -1t data.table_*.tar.gz | head -n 1) bus/$CI_BUILD_NAME
- mkdir -p bus/$CI_BUILD_NAME && mv $(ls -1t data.table_*.tar.gz | head -n 1) bus/$CI_BUILD_NAME

.test-cleanup-src: &cleanup-src
- &cleanup-src
rm $(ls -1t data.table_*.tar.gz | head -n 1)
- rm $(ls -1t data.table_*.tar.gz | head -n 1)

.test-template: &test
stage: test
Expand All @@ -77,6 +76,20 @@ build: # build data.table sources as tar.gz archive
tags:
- linux

.test-cran-lin-template: &test-cran-lin
<<: *test-lin
variables:
_R_CHECK_CRAN_INCOMING_: "TRUE"
_R_CHECK_CRAN_INCOMING_REMOTE_: "FALSE"
script:
- Rscript -e 'source(".ci/ci.R"); install.packages(dcf.dependencies("DESCRIPTION", which="most"), quiet=TRUE)'
- *copy-src
- rm -r bus
- *move-src
- cd bus/$CI_BUILD_NAME
- R CMD check --as-cran --no-manual $(ls -1t data.table_*.tar.gz | head -n 1)
- *cleanup-src

.test-win-template: &test-win
<<: *test
tags:
Expand Down Expand Up @@ -131,7 +144,7 @@ test-rel-vanilla-lin: # minimal installation, no suggested deps, no vignettes or
- R CMD check --no-manual --ignore-vignettes $(ls -1t data.table_*.tar.gz | head -n 1)
- *cleanup-src

test-rel-cran-lin: # currently released R on Linux
test-rel-cran-lin: # currently released R on Linux, extra NOTEs check and build pdf manual thus not from cran-lin template
<<: *test-lin
image: registry.gitlab.com/jangorecki/dockerfiles/r-builder
variables:
Expand All @@ -153,35 +166,20 @@ test-rel-cran-lin: # currently released R on Linux
Rscript -e 'l<-readLines("data.table.Rcheck/00check.log"); if (!identical(l[length(l)], "Status: 1 NOTE")) stop("Last line of ", shQuote("00check.log"), " is not ", shQuote("Status: 1 NOTE"), "(size of tarball) but ", shQuote(toString(l[length(l)]))) else q("no")'

test-dev-cran-lin: # R-devel on Linux, --enable-strict-barrier --disable-long-double
<<: *test-lin
<<: *test-cran-lin
image: registry.gitlab.com/jangorecki/dockerfiles/r-devel
allow_failure: false
variables:
_R_CHECK_CRAN_INCOMING_: "TRUE"
_R_CHECK_CRAN_INCOMING_REMOTE_: "FALSE"
script:
- Rscript -e 'source(".ci/ci.R"); install.packages(dcf.dependencies("DESCRIPTION", which="most"), quiet=TRUE)'
- *copy-src
- rm -r bus
- *move-src
- cd bus/$CI_BUILD_NAME
- R CMD check --as-cran $(ls -1t data.table_*.tar.gz | head -n 1)
- *cleanup-src

test-310-cran-lin: # test stated R dependency (3.1.0) using Linux
<<: *test-lin
test-310-cran-lin: # test stated R dependency 3.1.0
<<: *test-cran-lin
image: registry.gitlab.com/jangorecki/dockerfiles/r-3.1.0
variables:
_R_CHECK_CRAN_INCOMING_: "TRUE"
_R_CHECK_CRAN_INCOMING_REMOTE_: "FALSE"
script:
- Rscript -e 'source(".ci/ci.R"); install.packages(dcf.dependencies("DESCRIPTION", which="most"), quiet=TRUE)'
- *copy-src
- rm -r bus
- *move-src
- cd bus/$CI_BUILD_NAME
- R CMD check --as-cran $(ls -1t data.table_*.tar.gz | head -n 1)
- *cleanup-src

test-344-cran-lin: # test last R non-altrep version
<<: *test-cran-lin
image: registry.gitlab.com/jangorecki/dockerfiles/r-3.4.4

test-350-cran-lin: # test first R altrep version
<<: *test-cran-lin
image: registry.gitlab.com/jangorecki/dockerfiles/r-3.5.0

test-rel-win: # windows test and build binaries
<<: *test-win
Expand Down Expand Up @@ -250,6 +248,8 @@ integration: # merging all artifacts to produce single R repository and summarie
- test-dev-cran-lin
- test-rel-vanilla-lin
- test-310-cran-lin
- test-344-cran-lin
- test-350-cran-lin
- test-rel-win
- test-dev-win
#- test-rel-osx
Expand Down
8 changes: 7 additions & 1 deletion R/test.data.table.R
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ gc_mem = function() {
# nocov end
}

test = function(num,x,y=TRUE,error=NULL,warning=NULL,message=NULL,output=NULL,notOutput=NULL) {
test = function(num,x,y=TRUE,error=NULL,warning=NULL,message=NULL,output=NULL,notOutput=NULL,ignore.warning=NULL) {
# Usage:
# i) tests that x equals y when both x and y are supplied, the most common usage
# ii) tests that x is TRUE when y isn't supplied
Expand Down Expand Up @@ -338,6 +338,12 @@ test = function(num,x,y=TRUE,error=NULL,warning=NULL,message=NULL,output=NULL,no
if (!fail) for (type in c("warning","error","message")) {
observed = actual[[type]]
expected = get(type)
if (type=="warning" && length(observed) && !is.null(ignore.warning)) {
# if a warning containing this string occurs, ignore it. First need for #4182 where warning about 'timedatectl' only
# occurs in R 3.4, and maybe only on docker too not for users running test.data.table().
stopifnot(length(ignore.warning)==1L, is.character(ignore.warning), !is.na(ignore.warning), nchar(ignore.warning)>=1L)
observed = grep(ignore.warning, observed, value=TRUE, invert=TRUE)
}
if (length(expected) != length(observed)) {
# nocov start
cat("Test ",numStr," produced ",length(observed)," ",type,"s but expected ",length(expected),"\n",sep="")
Expand Down
9 changes: 8 additions & 1 deletion inst/tests/tests.Rraw
Original file line number Diff line number Diff line change
Expand Up @@ -11184,7 +11184,14 @@ test(1764.2, format(structure(NA_integer_, class = "ITime")), NA_character_)
# IDateTime error when tzone is NULL, #1973
x = as.POSIXct('2017-03-17', tz="UTC")
attr(x, 'tzone') = NULL
test(1765, print(IDateTime(x)), output=".*idate.*itime.*1: 2017-03-1[67]")
test(1765.1, print(IDateTime(x)), output=".*idate.*itime.*1: 2017-03-1[67]",
ignore.warning="timedatectl") # R 3.4's Sys.timezone() raises this warning in docker, #4182

# test test's ignore.warning
test(1765.2, {warning("foo"); 4L}, 4L, ignore.warning="foo")
test(1765.3, {warning("foo"); 4L}, 4L, ignore.warning="Foo", warning="foo")
test(1765.4, {warning("foobar1"); warning("foobar2"); warning("FOO"); 4L}, 4L, ignore.warning="bar", warning="FOO")
test(1765.5, {warning("foobar1"); warning("foobar2"); warning("FOO"); 4L}, 4L, ignore.warning="2", warning=c("foobar1","FOO"))

# print(null.data.table()) should not output NULL as well, #1852
# use capture.output() in this case rather than output= to ensure NULL is not output
Expand Down
3 changes: 2 additions & 1 deletion man/test.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
\usage{
test(num, x, y = TRUE,
error = NULL, warning = NULL, message = NULL,
output = NULL, notOutput = NULL)
output = NULL, notOutput = NULL, ignore.warning = NULL)
}
\arguments{
\item{num}{ A unique identifier for a test, helpful in identifying the source of failure when testing is not working. Currently, we use a manually-incremented system with tests formatted as \code{n.m}, where essentially \code{n} indexes an issue and \code{m} indexes aspects of that issue. For the most part, your new PR should only have one value of \code{n} (scroll to the end of \code{inst/tests/tests.Rraw} to see the next available ID) and then index the tests within your PR by increasing \code{m}. Note -- \code{n.m} is interpreted as a number, so \code{123.4} and \code{123.40} are actually the same -- please \code{0}-pad as appropriate. Test identifiers are checked to be in increasing order at runtime to prevent duplicates being possible. }
Expand All @@ -18,6 +18,7 @@ test(num, x, y = TRUE,
\item{message}{ Same as \code{warning} but expects \code{message} exception. }
\item{output}{ If you are testing the printing/console output behaviour; e.g. with \code{verbose=TRUE} or \code{options(datatable.verbose=TRUE)}. Again, regex-compatible and case sensitive. }
\item{notOutput}{ Or if you are testing that a feature does \emph{not} print particular console output. Case insensitive (unlike output) so that the test does not incorrectly pass just because the string is not found due to case. }
\item{ignore.warning}{ A single character string. Any warnings emitted by \code{x} that contain this string are dropped. Remaining warnings are compared to the expected \code{warning} as normal. }
}
\note{
\code{NA_real_} and \code{NaN} are treated as equal, use \code{identical} if distinction is needed. See examples below.
Expand Down