From d17c7cc538124e83419ef9e7641b6147cd9d5eef Mon Sep 17 00:00:00 2001 From: Tan Jinhua Date: Thu, 31 Mar 2022 14:43:47 +0800 Subject: [PATCH] [llvm-cov] Add test cases for coverage_watermark Add test cases for coverage_watermark in llvm-cov, also refer to https://reviews.llvm.org/D116876 Differential Revision: https://reviews.llvm.org/D122785 --- llvm/test/tools/llvm-cov/coverage_watermark.test | 41 ++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 llvm/test/tools/llvm-cov/coverage_watermark.test diff --git a/llvm/test/tools/llvm-cov/coverage_watermark.test b/llvm/test/tools/llvm-cov/coverage_watermark.test new file mode 100644 index 0000000..1c0408d --- /dev/null +++ b/llvm/test/tools/llvm-cov/coverage_watermark.test @@ -0,0 +1,41 @@ +RUN: not llvm-cov show --instr-profile=/dev/null -coverage-watermark=foo /dev/null 2>&1 | FileCheck --check-prefix=INVALID-ARG %s +INVALID-ARG: error: -coverage-watermark: invalid argument 'foo', must be in format 'high,low' + +RUN: not llvm-cov show --instr-profile=/dev/null -coverage-watermark=a,2 /dev/null 2>&1 | FileCheck --check-prefix=INVALID-HIGH %s +INVALID-HIGH: error: -coverage-watermark: invalid number 'a', invalid value for 'high' + +RUN: not llvm-cov show --instr-profile=/dev/null -coverage-watermark=10,b /dev/null 2>&1 | FileCheck --check-prefix=INVALID-LOW %s +INVALID-LOW: error: -coverage-watermark: invalid number 'b', invalid value for 'low' + +RUN: not llvm-cov show --instr-profile=/dev/null -coverage-watermark=10,20 /dev/null 2>&1 | FileCheck --check-prefix=INVALID-ARRANGE %s +INVALID-ARRANGE: error: -coverage-watermark: invalid number range '10,20', must be both high and low should be between 0-100, and high > low + +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: +ORIGIN: 100.00% (3/3) +ORIGIN: +ORIGIN: 75.00% (9/12) +ORIGIN: +ORIGIN: 66.67% (4/6) + +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: FileCheck -check-prefix=DOWNGRADE1 %s -input-file %t.html.dir/index.html + +DOWNGRADE1: +DOWNGRADE1: 100.00% (3/3) +DOWNGRADE1: +DOWNGRADE1: 75.00% (9/12) +DOWNGRADE1: +DOWNGRADE1: 66.67% (4/6) + +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 + +DOWNGRADE2: +DOWNGRADE2: 100.00% (3/3) +DOWNGRADE2: +DOWNGRADE2: 75.00% (9/12) +DOWNGRADE2: +DOWNGRADE2: 66.67% (4/6) -- 2.7.4