diff --git a/llvm/test/tools/llvm-cov/coverage_watermark.test b/llvm/test/tools/llvm-cov/coverage_watermark.test index 1c0408dd0078c..5c48b4f0fb4bf 100644 --- a/llvm/test/tools/llvm-cov/coverage_watermark.test +++ b/llvm/test/tools/llvm-cov/coverage_watermark.test @@ -13,29 +13,47 @@ INVALID-ARRANGE: error: -coverage-watermark: invalid number range '10,20', must RUN: llvm-cov show %S/Inputs/templateInstantiations.covmapping -instr-profile %S/Inputs/templateInstantiations.profdata -format html -show-region-summary -show-instantiation-summary -o %t.html.dir -path-equivalence=/tmp,%S %S/showTemplateInstantiations.cpp RUN: FileCheck -check-prefix=ORIGIN %s -input-file %t.html.dir/index.html +ORIGIN: Totals +ORIGIN: +ORIGIN: 100.00% (2/2) ORIGIN: ORIGIN: 100.00% (3/3) ORIGIN: ORIGIN: 75.00% (9/12) ORIGIN: ORIGIN: 66.67% (4/6) +ORIGIN: +ORIGIN: - (0/0) +ORIGIN: -RUN: llvm-cov show %S/Inputs/templateInstantiations.covmapping -instr-profile %S/Inputs/templateInstantiations.profdata -format html -show-region-summary -show-instantiation-summary -o %t.html.dir -path-equivalence=/tmp,%S -coverage-watermark 80,60 %S/showTemplateInstantiations.cpp +RUN: llvm-cov show %S/Inputs/templateInstantiations.covmapping -instr-profile %S/Inputs/templateInstantiations.profdata -format html -show-region-summary -show-instantiation-summary -o %t.html.dir -path-equivalence=/tmp,%S -coverage-watermark 80,70 %S/showTemplateInstantiations.cpp RUN: FileCheck -check-prefix=DOWNGRADE1 %s -input-file %t.html.dir/index.html +DOWNGRADE:1 Totals +DOWNGRADE1: +DOWNGRADE1: 100.00% (2/2) DOWNGRADE1: DOWNGRADE1: 100.00% (3/3) DOWNGRADE1: DOWNGRADE1: 75.00% (9/12) DOWNGRADE1: DOWNGRADE1: 66.67% (4/6) +DOWNGRADE1: +DOWNGRADE1: - (0/0) +DOWNGRADE1: RUN: llvm-cov show %S/Inputs/templateInstantiations.covmapping -instr-profile %S/Inputs/templateInstantiations.profdata -format html -show-region-summary -show-instantiation-summary -o %t.html.dir -path-equivalence=/tmp,%S -coverage-watermark 70,50 %S/showTemplateInstantiations.cpp RUN: FileCheck -check-prefix=DOWNGRADE2 %s -input-file %t.html.dir/index.html +DOWNGRADE:1 Totals +DOWNGRADE2: +DOWNGRADE2: 100.00% (2/2) DOWNGRADE2: DOWNGRADE2: 100.00% (3/3) DOWNGRADE2: DOWNGRADE2: 75.00% (9/12) DOWNGRADE2: DOWNGRADE2: 66.67% (4/6) +DOWNGRADE1: +DOWNGRADE1: - (0/0) +DOWNGRADE1: diff --git a/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp b/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp index b43e9e64231e0..abc4c49ecae98 100644 --- a/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp +++ b/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp @@ -130,10 +130,14 @@ table { .light-row { background: #ffffff; border: 1px solid #dbdbdb; + border-left: none; + border-right: none; } .light-row-bold { background: #ffffff; border: 1px solid #dbdbdb; + border-left: none; + border-right: none; font-weight: bold; } .column-entry { @@ -147,21 +151,28 @@ table { text-align: left; background-color: #ffffd0; } -.column-entry-yellow:hover { +.column-entry-yellow:hover, tr:hover .column-entry-yellow { background-color: #fffff0; } .column-entry-red { text-align: left; background-color: #ffd0d0; } -.column-entry-red:hover { +.column-entry-red:hover, tr:hover .column-entry-red { background-color: #fff0f0; } +.column-entry-gray { + text-align: left; + background-color: #fbfbfb; +} +.column-entry-gray:hover, tr:hover .column-entry-gray { + background-color: #f0f0f0; +} .column-entry-green { text-align: left; background-color: #d0ffd0; } -.column-entry-green:hover { +.column-entry-green:hover, tr:hover .column-entry-green { background-color: #f0fff0; } .line-number { @@ -232,6 +243,9 @@ td:last-child { tr:hover { background-color: #f0f0f0; } +tr:last-child { + border-bottom: none; +} )"; const char *EndHeader = ""; @@ -309,7 +323,9 @@ void emitTableRow(raw_ostream &OS, const CoverageViewOptions &Opts, RSO << '(' << Hit << '/' << Total << ')'; } const char *CellClass = "column-entry-yellow"; - if (Pctg >= Opts.HighCovWatermark) + if (!Total) + CellClass = "column-entry-gray"; + else if (Pctg >= Opts.HighCovWatermark) CellClass = "column-entry-green"; else if (Pctg < Opts.LowCovWatermark) CellClass = "column-entry-red";