Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rust-cov / cargo-cov for llvm-cov #97

Merged
merged 3 commits into from
Nov 17, 2020
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
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [v0.3.3] - 2020-11-17
Copy link
Contributor

@therealprof therealprof Nov 17, 2020

Choose a reason for hiding this comment

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

Missing the v0.3.3 change link at the bottom of the CHANGELOG.md for the release.

Sorry for missing that earlier.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, didn't see that, but I'll fix it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done


### Added

- rust-cov / `cargo cov` - proxy for `llvm-cov` used in combination with
`profdata` for Rust LLVM InstrProf-based source code coverage analysis.

## [v0.3.2] - 2020-10-13

### Fixed
Expand Down Expand Up @@ -152,7 +159,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

Initial release

[Unreleased]: https://github.com/rust-embedded/cargo-binutils/compare/v0.3.2...HEAD
[Unreleased]: https://github.com/rust-embedded/cargo-binutils/compare/v0.3.3...HEAD
[v0.3.3]: https://github.com/rust-embedded/cargo-binutils/compare/v0.3.2...v0.3.3
[v0.3.2]: https://github.com/rust-embedded/cargo-binutils/compare/v0.3.1...v0.3.2
[v0.3.1]: https://github.com/rust-embedded/cargo-binutils/compare/v0.3.0...v0.3.1
[v0.3.0]: https://github.com/rust-embedded/cargo-binutils/compare/v0.2.0...v0.3.0
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ license = "MIT OR Apache-2.0"
name = "cargo-binutils"
readme = "README.md"
repository = "https://github.com/rust-embedded/cargo-binutils/"
version = "0.3.2"
version = "0.3.3"

[dependencies]
cargo_metadata = "0.11"
Expand Down
3 changes: 3 additions & 0 deletions src/bin/cargo-cov.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
cargo_binutils::Tool::Cov.cargo_exec(None)
}
3 changes: 3 additions & 0 deletions src/bin/rust-cov.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
cargo_binutils::Tool::Cov.rust_exec()
}
6 changes: 4 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ pub fn run(tool: Tool, matches: ArgMatches) -> Result<i32> {

match tool {
// Tools that don't need a build
Tool::Ar | Tool::Lld | Tool::Profdata => {}
Tool::Ar | Tool::Cov | Tool::Lld | Tool::Profdata => {}
// for some tools we change the CWD (current working directory) and
// make the artifact path relative. This makes the path that the
// tool will print easier to read. e.g. `libfoo.rlib` instead of
Expand Down Expand Up @@ -383,7 +383,9 @@ pub fn run(tool: Tool, matches: ArgMatches) -> Result<i32> {

// post process output
let processed_output = match tool {
Tool::Ar | Tool::Lld | Tool::Objcopy | Tool::Profdata | Tool::Strip => output.stdout.into(),
Tool::Ar | Tool::Cov | Tool::Lld | Tool::Objcopy | Tool::Profdata | Tool::Strip => {
output.stdout.into()
}
Tool::Nm | Tool::Objdump | Tool::Readobj => postprocess::demangle(&output.stdout),
Tool::Size => postprocess::size(&output.stdout),
};
Expand Down
4 changes: 3 additions & 1 deletion src/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::rustc::rustlib;
#[derive(Clone, Copy, PartialEq)]
pub enum Tool {
Ar,
Cov,
Lld,
Nm,
Objcopy,
Expand All @@ -24,6 +25,7 @@ impl Tool {
pub fn name(self) -> &'static str {
match self {
Tool::Ar => "ar",
Tool::Cov => "cov",
Tool::Lld => "lld",
Tool::Nm => "nm",
Tool::Objcopy => "objcopy",
Expand Down Expand Up @@ -95,7 +97,7 @@ impl Tool {
// Whether this tool requires the project to be previously built
pub fn needs_build(self) -> bool {
match self {
Tool::Ar | Tool::Lld | Tool::Profdata => false,
Tool::Ar | Tool::Cov | Tool::Lld | Tool::Profdata => false,
Tool::Nm | Tool::Objcopy | Tool::Objdump | Tool::Readobj | Tool::Size | Tool::Strip => {
true
}
Expand Down