[llvm-cov] Error-out when an unsupported format is used (PR32087)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296487 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Vedant Kumar 2017-02-28 16:57:28 +00:00
parent 79e90c5570
commit 09f10e7e60
2 changed files with 10 additions and 1 deletions

View File

@ -1,5 +1,7 @@
// RUN: llvm-cov show %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %S/Inputs/elf_binary_comdat.profdata -filename-equivalence /dev/null | FileCheck %s -allow-empty -check-prefix=FAKE-FILE-STDOUT
// RUN: llvm-cov show %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %S/Inputs/elf_binary_comdat.profdata -filename-equivalence /dev/null 2>&1 | FileCheck %s -check-prefix=FAKE-FILE-STDERR
// RUN: not llvm-cov report %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %S/Inputs/elf_binary_comdat.profdata -format=html
// RUN: not llvm-cov export %S/Inputs/prevent_false_instantiations.covmapping -instr-profile %S/Inputs/elf_binary_comdat.profdata -format=html
// FAKE-FILE-STDOUT-NOT: warning: The file '{{.*}}' isn't covered.
// FAKE-FILE-STDERR: warning: The file '{{.*}}' isn't covered.

View File

@ -818,8 +818,10 @@ int CodeCoverageTool::report(int argc, const char **argv,
if (Err)
return Err;
if (ViewOpts.Format == CoverageViewOptions::OutputFormat::HTML)
if (ViewOpts.Format == CoverageViewOptions::OutputFormat::HTML) {
error("HTML output for summary reports is not yet supported.");
return 1;
}
auto Coverage = load();
if (!Coverage)
@ -840,6 +842,11 @@ int CodeCoverageTool::export_(int argc, const char **argv,
if (Err)
return Err;
if (ViewOpts.Format != CoverageViewOptions::OutputFormat::Text) {
error("Coverage data can only be exported as textual JSON.");
return 1;
}
auto Coverage = load();
if (!Coverage) {
error("Could not load coverage information");