Repository navigation
icc code coverage support - #247
Conversation
jimhester
left a comment
There was a problem hiding this comment.
I did a first pass review of the PR. It would be nice to test this on travis as well before merging. https://github.com/nemequ/icc-travis has an example of using icc on travis, I can look into it further.
| parallel, | ||
| memoise | ||
| License: MIT + file LICENSE | ||
| License: MIT + file LICENSE + Oracle Contribution License |
There was a problem hiding this comment.
This should be License: MIT + file LICENSE | GPL-3
| @@ -0,0 +1,18 @@ | |||
| This software (the "Software") is contributed under the terms of the GPL-3 with additional permission for MIT under GPL-3 Section 7 as follows: | |||
There was a problem hiding this comment.
I think this license information should go in inst/COPYING.
| class = "coverage") | ||
| }) | ||
| } | ||
|
|
There was a problem hiding this comment.
This code should go in R/icc.R.
| # parse icc compiler code coverage output | ||
| parse_icov <- function(lines, package_path = "") { | ||
|
|
||
| source_file <- trimws(lines[1L]) |
There was a problem hiding this comment.
trimws is only available in (R >= 3.3.0), covr supports (R >= 3.1.0), so an alternative would need to be provided for earlier versions.
| capture(name = "idcol", digits), "\t", any_spaces, | ||
| capture(name = "coverage", digits)) | ||
|
|
||
| showCfunctions <- getOption("covr.showCfunctions", FALSE) |
There was a problem hiding this comment.
This should follow the conventions in the rest of the package and be snake_case.
| rex::rex(start, "CC = ", | ||
| capture(name = "compiler", anything), | ||
| " ", anything))$compiler | ||
| compiler <- compiler[!is.na(compiler)] |
There was a problem hiding this comment.
We should error if no compiler is found.
| " ", anything))$compiler | ||
| compiler <- compiler[!is.na(compiler)] | ||
|
|
||
| res <- try(system(paste(compiler, "--version"), intern=TRUE), silent=TRUE) |
There was a problem hiding this comment.
tryCatch(
system2(compiler, "--version"),
error = function(e) {
warning("cannot recognize a supported compiler")
})| return("gcc") | ||
| else if (length(grep("icc ", res)) > 0L) | ||
| return("icc") | ||
| } |
There was a problem hiding this comment.
What about clang? Typically it is aliased as gcc, but it can also be explicitly specified.
|
|
||
| icov_inputs <- list.files(path, pattern = rex::rex(".dyn", end), | ||
| recursive = TRUE, full.names = TRUE) | ||
|
|
There was a problem hiding this comment.
If there are no icov inputs we can probably return early here.
| icov_inputs <- list.files(path, pattern = rex::rex(".dyn", end), | ||
| recursive = TRUE, full.names = TRUE) | ||
|
|
||
| icov_profmerge <- getOption("covr.icov_prof", "") |
chinqw
left a comment
There was a problem hiding this comment.
edited the changes based upon the comments.
Will move parse_icov and run_icov to a new file icc.R in a separate pull afterwards.
|
Make changes according to the review comments and update DESCRIPTION and LICENSE files with new proposal. The new license proposal "License: MIT + file LICENSE + Portions GPLv3 with Additional Permission | GPLv3" in DESCRIPTION file seems to cause R CMD check a warning which is flagged by travis. |
|
made changes according to review comments and updated license with a new proposal. It seems that the new license proposal 'License: MIT + file LICENSE + Portions GPLv3 with Additional Permission | GPLv3' causes R CMD check a warning which is flagged by travis. |
|
I recently modified the covr license to be GPL-3 and you will need to sign the project CLA and remove the Oracle copyright clauses in order to contribute this code. |
Codecov Report
@@ Coverage Diff @@
## master #247 +/- ##
==========================================
- Coverage 80.65% 74.71% -5.95%
==========================================
Files 23 24 +1
Lines 1370 1499 +129
==========================================
+ Hits 1105 1120 +15
- Misses 265 379 +114
Continue to review full report at Codecov.
|
|
oracle license statement has been removed. Changes are sync'ed with master branch. |
jimhester
left a comment
There was a problem hiding this comment.
Thank you for removing the comments, I have a few minor suggestions around detecting the compiler used.
Also could you add a note to NEWS.md with the change and mentioning yourself and add your name as a contributor to the DESCRIPTION file (if it is not already there).
| relative = relative_path) | ||
| } else { | ||
| # use icc compiler | ||
| coverage <- structure(c(coverage, run_icov(pkg$path, quiet = quiet)), |
There was a problem hiding this comment.
Don't duplicate all of the code, just the object that differs.
res <- if (uses_icc()) {
run_icov(pkg$path, quiet = quiet)
} else {
run_gcov(pkg$path, quiet = quiet)
}
coverage <- structure(c(coverage, res), class = "coverage", package = pkg, relative = relative_path)| } | ||
|
|
||
| # check if gcc or icc is used | ||
| get_compiler <- function() { |
There was a problem hiding this comment.
I think this function should just check if icc is used and fallback to the current behavior otherwise. Also you cannot assume the R CMD config CC will have trailing spaces, using the word boundary \\b anchor is a better solution.
uses_icc <- function() {
compiler <- tryCatch(
paste(system(paste(R.home("bin"), "R --vanilla CMD config CC", sep="/"),
intern = TRUE), collapse=""),
error = function(e) "")
grepl("\\bicc\\b", compiler)
}|
suggested changes are done. |
No description provided.