Skip to content

Commit

Permalink
cc now by default not run tests (#4185)
Browse files Browse the repository at this point in the history
  • Loading branch information
jangorecki authored Feb 20, 2020
1 parent cd4464f commit b1b1832
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .dev/CRAN_Release.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ grep asCharacter *.c | grep -v PROTECT | grep -v SET_VECTOR_ELT | grep -v setAtt

cd ..
R
cc(clean=TRUE, CC="gcc-8") # to compile with -pedandic -Wall, latest gcc as CRAN: https://cran.r-project.org/web/checks/check_flavors.html
cc(test=TRUE, clean=TRUE, CC="gcc-8") # to compile with -pedandic -Wall, latest gcc as CRAN: https://cran.r-project.org/web/checks/check_flavors.html
saf = options()$stringsAsFactors
options(stringsAsFactors=!saf) # check tests (that might be run by user) are insensitive to option, #2718
test.data.table()
Expand Down
18 changes: 9 additions & 9 deletions .dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@
Developer helper script providing `cc` function. If one starts R session in `data.table` project root directory `.dev/cc.R` file should be automatically sourced (due to local `.Rprofile` file) making `cc()` (and `dd()`) function available straightaway.

```r
cc(test=TRUE, clean=FALSE, debug=FALSE, omp=!debug, cc_dir, path=Sys.getenv("PROJ_PATH"), CC="gcc")
cc(test=FALSE, clean=FALSE, debug=FALSE, omp=!debug, cc_dir, path=Sys.getenv("PROJ_PATH"), CC="gcc")
```

Use `cc` to re-compile all C sources and attach all `data.table` R functions (including non-exported ones).
By default `cc(test=TRUE)` will also run main test script `"tests.Rraw"`, so one may want to use `cc(F)` to re-compile and attach newly modified code but not run any test script. As of now running main tests with `cc()` requires to uninstall package to avoid S4 classes namespace issues (see [#3808](https://github.com/Rdatatable/data.table/issues/3808)).
Use `cc()` to re-compile all C sources and attach all `data.table` R functions (including non-exported ones).
One might want to re-compile and run main test script `"tests.Rraw"` automatically, then `cc(test=TRUE)` should be used. As of now running main tests with `cc(T)` requires to uninstall package to avoid S4 classes namespace issues (see [#3808](https://github.com/Rdatatable/data.table/issues/3808)).
When working on a bigger feature, one may want to put new unit tests into dedicated test file, then `cc("feature.Rraw")` can be used to run only chosen test script.

Usage of `cc()` from `R`:
```r
# run test
# re-compile and attach
cc()
# change some files, run test
# change some files, re-compile and re-attach
cc()
# compile, reload but not test
cc(F)
# clean, compile, reload but not test
# compile, reload and run main test script
cc(T)
# clean, compile, reload
cc(F, T)
# clean, compile using specific compiler version, reload but not test
# clean, compile using specific compiler version, reload
cc(F, T, CC="gcc-8")
```

Expand Down
15 changes: 8 additions & 7 deletions .dev/cc.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
# > cc()
# # change some files
# > cc()
# # compile, reload but not test
# > cc(F)
# # clean, compile, reload but not test
# # run your tests
# # to compile, reload and run main test script
# > cc(T)
# # clean, compile, reload
# > cc(F, T)
# # clean, compile using specific version, reload but not test
# # clean, compile using specific version, reload
# > cc(F, T, CC="gcc-8")
#
# To debug C level :
Expand All @@ -23,7 +24,7 @@

options(datatable.print.class = TRUE)

sourceDir <- function(path=getwd(), trace = TRUE, ...) {
sourceDir = function(path=getwd(), trace = TRUE, ...) {
# copied verbatim from example(source) in base R
for (nm in list.files(path, pattern = "\\.[RrSsQq]$")) {
if(trace) cat(nm," ")
Expand All @@ -32,7 +33,7 @@ sourceDir <- function(path=getwd(), trace = TRUE, ...) {
if(trace) cat("\n")
}

cc = function(test=TRUE, clean=FALSE, debug=FALSE, omp=!debug, cc_dir, path=Sys.getenv("PROJ_PATH"), CC="gcc") {
cc = function(test=FALSE, clean=FALSE, debug=FALSE, omp=!debug, cc_dir, path=Sys.getenv("PROJ_PATH"), CC="gcc") {
if (!missing(cc_dir)) {
warning("'cc_dir' arg is deprecated, use 'path' argument or 'PROJ_PATH' env var instead")
path = cc_dir
Expand Down Expand Up @@ -87,5 +88,5 @@ cc = function(test=TRUE, clean=FALSE, debug=FALSE, omp=!debug, cc_dir, path=Sys.
invisible()
}

dd = function(omp=FALSE)cc(FALSE,debug=TRUE,omp=omp,clean=TRUE)
dd = function(omp=FALSE)cc(test=FALSE,debug=TRUE,omp=omp,clean=TRUE)

0 comments on commit b1b1832

Please sign in to comment.