Skip to content

Commit

Permalink
Add an html output (#297)
Browse files Browse the repository at this point in the history
  • Loading branch information
calixteman authored and marco-c committed Aug 6, 2019
1 parent 6471bb9 commit 7da9c4a
Show file tree
Hide file tree
Showing 8 changed files with 978 additions and 2 deletions.
39 changes: 39 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ xml-rs = "^0.8"
smallvec = "^0.6"
rustc-hash = "^1.0"
clap = "^2.32"
fomat-macros = "^0.3"
chrono = "^0.4"


[dev-dependencies]
regex = "^1.1"
240 changes: 240 additions & 0 deletions resources/grcov.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
body {
color: #000000;
background-color: #FFFFFF;
}

.sourceCode {
display: table;
unicode-bidi: embed;
font-family: monospace;
white-space: pre;
}

.line span {
display: table-cell;
}

.line {
display: table-row;
}

.lineNum {
background-color: #EFE383;
padding-right: 1em;
}

.counterUnCov, .counterCov, .counterNoCov {
border-right: 1px solid black;
padding-right: 0.5em;
text-align: right;
}

.lineUnCov, .lineCov, .lineNoCov {
padding-left: 1em;
}

.counterCov, .lineCov {
background-color: #CAD7FE;
}

.counterNoCov, .lineNoCov {
background-color: #FF6230;
}

.header {
display: inline-block;
width: 100%;
border-top: 3px solid #6688D4;
border-bottom: 3px solid #6688D4;
}

.header a:link {
color: #284FA8;
text-decoration: underline;
}

.header a:visited {
color: #00CB40;
text-decoration: underline;
}

.header a:active {
color: #FF0040;
text-decoration: underline;
}

.view {
display: table;
float: left;
width: 20%;
}

.viewRow {
display: table-row;
}

.viewRow > span {
display: table-cell;
font-family: sans-serif;
font-weight: bold;
white-space: nowrap;
}

.viewItem
{
text-align: right;
padding-right: 6px;
vertical-align: top;
}

.viewValue
{
text-align: left;
color: #284FA8;
}

.stats {
display: table;
float: right;
width: 50%;
}

.statsRow {
display: table-row;
text-align: right;
}

.statsRow span {
display: table-cell;
border: 1px solid white;
font-family: sans-serif;
}

.statsLine, .statsFun {
font-weight: bold;
}

.linesHit, .linesTotal, .linesPercentage, .funsHit, .funsTotal, .funsPercentage {
background-color: #DAE7FE;
color: #284FA8;
white-space: nowrap;
padding-left: 12px;
padding-right: 4px;
font-weight: bold;
}

.linesPercentage, .funsPercentage {
color: black;
}

.statsHit, .statsTotal, .statsCoverage {
text-align: center;
padding-right: 6px;
padding-left: 6px;
padding-bottom: 0px;
font-family: sans-serif;
font-size: 80%;
white-space: nowrap;
}

.funHi, .lineHi {
background-color: #A7FC9D;
}

.funMed, .lineMed {
background-color: #FFEA20;
}

.funLow, .lineLow {
background-color: #FF0000;
}

.dirStats, .dirStatsHeader {
display: table;
width: 80%;
margin-left: 10%;
margin-right: 10%;
}

.lineDir {
display: table-row;
background-color: #DAE7FE;
}

.lineDir > span {
display: table-cell;
border: 1px solid white;
padding-top: 0.1em;
padding-bottom: 0.1em;
}

.dirStatsHeader {
font-family: sans-serif;
font-weight: bold;
color: #FFFFFF;
}

.dirStatsLineHeader {
display: table-row;
background-color: #6688d4;
}

.dirStatsLineHeader > span {
display: table-cell;
border: 1px solid white;
padding-top: 0.1em;
padding-bottom: 0.1em;
}

.dirBar {
display: inline-block;
width: 80%;
height: 0.8em;
border: 1px solid black;
background-color: white;
}

.percentBar {
height: 100%;
float: left;
}

.dirBarPer {
text-align: center;
}

.dirLinesPer, .dirLinesRatio, .dirFunsPer, .dirFunsRatio {
text-align: right;
padding-right: 1em;
}

.dirBarPer, .dirLinesPer, .dirLinesRatio, .dirFunsPer, .dirFunsRatio {
width: 10%;
}

.dirLinesPer, .dirFunsPer {
font-weight: bold;
}

.dirLineCovHeader, .dirNameHeader, .dirFunsHeader {
text-align: center;
}

.dirLineCovHeader {
width: 30%;
padding-left: 1em;
}

.dirFunsHeader {
width: 20%;
padding-left: 1em;
}

.dirName, .dirNameHeader {
width: 50%;
padding-left: 1em;
}

.dirStats {
font-family: sans-serif;
}
38 changes: 37 additions & 1 deletion src/defs.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crossbeam::channel::{Receiver, Sender};
use rustc_hash::FxHashMap;
use std::cell::RefCell;
use std::collections::BTreeMap;
use std::collections::{BTreeMap, BTreeSet};
use std::path::PathBuf;
use std::rc::Rc;
use std::sync::Mutex;
Expand Down Expand Up @@ -79,3 +79,39 @@ pub struct CDDirStats {
pub dirs: Vec<Rc<RefCell<CDDirStats>>>,
pub stats: CDStats,
}

#[derive(Debug)]
pub struct HtmlItem {
pub abs_path: PathBuf,
pub rel_path: PathBuf,
pub result: CovResult,
}

#[derive(Clone, Debug, Default)]
pub struct HtmlStats {
pub total_lines: usize,
pub covered_lines: usize,
pub total_funs: usize,
pub covered_funs: usize,
}

#[derive(Clone, Debug)]
pub struct HtmlFileStats {
pub file_name: String,
pub stats: HtmlStats,
}

#[derive(Clone, Debug)]
pub struct HtmlDirStats {
pub files: BTreeSet<HtmlFileStats>,
pub stats: HtmlStats,
}

#[derive(Debug, Default)]
pub struct HtmlGlobalStats {
pub dirs: BTreeMap<String, HtmlDirStats>,
pub stats: HtmlStats,
}

pub type HtmlJobReceiver = Receiver<Option<HtmlItem>>;
pub type HtmlJobSender = Sender<Option<HtmlItem>>;
Loading

0 comments on commit 7da9c4a

Please sign in to comment.