[PATCH] D129791: [llvm-cov] Add error message for missing profdata on report and export subcommands.
Zequan Wu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 14 11:45:45 PDT 2022
zequanwu updated this revision to Diff 444751.
zequanwu added a comment.
fix test.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129791/new/
https://reviews.llvm.org/D129791
Files:
llvm/test/tools/llvm-cov/misssing-profdata.test
llvm/tools/llvm-cov/CodeCoverage.cpp
Index: llvm/tools/llvm-cov/CodeCoverage.cpp
===================================================================
--- llvm/tools/llvm-cov/CodeCoverage.cpp
+++ llvm/tools/llvm-cov/CodeCoverage.cpp
@@ -1053,7 +1053,7 @@
sys::fs::file_status Status;
if (std::error_code EC = sys::fs::status(PGOFilename, Status)) {
- error("Could not read profile data!", EC.message());
+ error("Could not read profile data!" + EC.message(), PGOFilename);
return 1;
}
@@ -1170,6 +1170,12 @@
return 1;
}
+ sys::fs::file_status Status;
+ if (std::error_code EC = sys::fs::status(PGOFilename, Status)) {
+ error("Could not read profile data!" + EC.message(), PGOFilename);
+ return 1;
+ }
+
auto Coverage = load();
if (!Coverage)
return 1;
@@ -1219,6 +1225,12 @@
return 1;
}
+ sys::fs::file_status Status;
+ if (std::error_code EC = sys::fs::status(PGOFilename, Status)) {
+ error("Could not read profile data!" + EC.message(), PGOFilename);
+ return 1;
+ }
+
auto Coverage = load();
if (!Coverage) {
error("Could not load coverage information");
Index: llvm/test/tools/llvm-cov/misssing-profdata.test
===================================================================
--- llvm/test/tools/llvm-cov/misssing-profdata.test
+++ llvm/test/tools/llvm-cov/misssing-profdata.test
@@ -1,2 +1,5 @@
-RUN: not llvm-cov show -instr-profile=%t.nonexistent %t.nonexistent 2>&1 | FileCheck %s
-CHECK: Could not read profile data
+RUN: not llvm-cov show -instr-profile=%t.nonexistent.profdata %t.nonexistent 2>&1 | FileCheck %s
+RUN: not llvm-cov export -instr-profile=%t.nonexistent.profdata %t.nonexistent 2>&1 | FileCheck %s
+RUN: not llvm-cov report -instr-profile=%t.nonexistent.profdata %t.nonexistent 2>&1 | FileCheck %s
+
+CHECK: nonexistent.profdata: Could not read profile data!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129791.444751.patch
Type: text/x-patch
Size: 1833 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220714/96b55a53/attachment.bin>
More information about the llvm-commits
mailing list