[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
Fri Jul 15 12:04:43 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG44d9def78bb5: [llvm-cov] Add error message for missing profdata on report and export… (authored by zequanwu).

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.445090.patch
Type: text/x-patch
Size: 1833 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220715/3392f535/attachment.bin>


More information about the llvm-commits mailing list