Skip to content

icc code coverage support - #247

Merged
jimhester merged 28 commits into
r-lib:masterfrom
chinqw:patch-1
Jun 26, 2017
Merged

jimhester merged 28 commits into
r-lib:masterfrom
chinqw:patch-1

Conversation

@chinqw

@chinqw chinqw commented Jan 25, 2017

Copy link
Copy Markdown
Contributor

No description provided.

@jimhester jimhester left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread DESCRIPTION Outdated
parallel,
memoise
License: MIT + file LICENSE
License: MIT + file LICENSE + Oracle Contribution License

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be License: MIT + file LICENSE | GPL-3

Comment thread Oracle Contribution under GPL-3 Outdated
@@ -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:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this license information should go in inst/COPYING.

Comment thread R/compiled.R
class = "coverage")
})
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code should go in R/icc.R.

Comment thread R/compiled.R Outdated
# parse icc compiler code coverage output
parse_icov <- function(lines, package_path = "") {

source_file <- trimws(lines[1L])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread R/compiled.R Outdated
capture(name = "idcol", digits), "\t", any_spaces,
capture(name = "coverage", digits))

showCfunctions <- getOption("covr.showCfunctions", FALSE)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should follow the conventions in the rest of the package and be snake_case.

Comment thread R/covr.R Outdated
rex::rex(start, "CC = ",
capture(name = "compiler", anything),
" ", anything))$compiler
compiler <- compiler[!is.na(compiler)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should error if no compiler is found.

Comment thread R/covr.R Outdated
" ", anything))$compiler
compiler <- compiler[!is.na(compiler)]

res <- try(system(paste(compiler, "--version"), intern=TRUE), silent=TRUE)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tryCatch(
  system2(compiler, "--version"),
  error = function(e) {
    warning("cannot recognize a supported compiler")
})

Comment thread R/covr.R Outdated
return("gcc")
else if (length(grep("icc ", res)) > 0L)
return("icc")
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about clang? Typically it is aliased as gcc, but it can also be explicitly specified.

Comment thread R/compiled.R Outdated

icov_inputs <- list.files(path, pattern = rex::rex(".dyn", end),
recursive = TRUE, full.names = TRUE)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there are no icov inputs we can probably return early here.

Comment thread R/compiled.R Outdated
icov_inputs <- list.files(path, pattern = rex::rex(".dyn", end),
recursive = TRUE, full.names = TRUE)

icov_profmerge <- getOption("covr.icov_prof", "")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return if this is not set?

@chinqw chinqw left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@chinqw

chinqw commented Mar 29, 2017

Copy link
Copy Markdown
Contributor Author

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.

@chinqw

chinqw commented Mar 29, 2017

Copy link
Copy Markdown
Contributor Author

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.

@chinqw chinqw closed this Mar 29, 2017
@chinqw chinqw reopened this Mar 29, 2017
@jimhester jimhester mentioned this pull request Mar 31, 2017
20 tasks done
@jimhester jimhester closed this Apr 28, 2017
@jimhester jimhester reopened this Apr 28, 2017
@CLAassistant

CLAassistant commented Apr 28, 2017 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@jimhester

Copy link
Copy Markdown
Member

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-io

codecov-io commented Jun 11, 2017 •

Copy link
Copy Markdown

Codecov Report

Merging #247 into master will decrease coverage by 5.94%.
The diff coverage is 23.84%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
R/icc.R 0% <0%> (ø)
R/zzz.R 0% <0%> (ø) ⬆️
R/covr.R 88.93% <69.23%> (-2.62%) ⬇️
R/compiled.R 94.02% <94.73%> (+0.09%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 580c2fc...7be54d6. Read the comment docs.

@chinqw

chinqw commented Jun 11, 2017

Copy link
Copy Markdown
Contributor Author

oracle license statement has been removed. Changes are sync'ed with master branch.

@jimhester jimhester left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Comment thread R/covr.R Outdated
relative = relative_path)
} else {
# use icc compiler
coverage <- structure(c(coverage, run_icov(pkg$path, quiet = quiet)),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Comment thread R/covr.R Outdated
}

# check if gcc or icc is used
get_compiler <- function() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
}

@chinqw

chinqw commented Jun 17, 2017

Copy link
Copy Markdown
Contributor Author

suggested changes are done.

@jimhester
jimhester merged commit 7be54d6 into r-lib:master Jun 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants