// RUN: FileCheck -check-prefix=REL-INDEX -input-file %t.dir/index.txt %s
// REL-INDEX-NOT: %t.dir
+
+// Check that we get the right error when writing to an invalid path:
+
+// RUN: not llvm-cov show %S/Inputs/double_dots.covmapping -instr-profile=%t.profdata -o /dev/null 2>&1 | FileCheck %s -check-prefix=ERROR-MESSAGE
+// ERROR-MESSAGE: error: Not a directory: Could not create index file!
std::string Str = (Warning ? "warning" : "error");
Str += ": ";
if (!Whence.empty())
- Str += Whence;
+ Str += Whence.str() + ": ";
Str += Message.str() + "\n";
return Str;
}
if (!Filters.empty()) {
auto OSOrErr = Printer->createViewFile("functions", /*InToplevel=*/true);
if (Error E = OSOrErr.takeError()) {
- error(toString(std::move(E)));
+ error("Could not create view file!", toString(std::move(E)));
return 1;
}
auto OS = std::move(OSOrErr.get());
// Create an index out of the source files.
if (ViewOpts.hasOutputDirectory()) {
if (Error E = Printer->createIndexFile(SourceFiles)) {
- error(toString(std::move(E)));
+ error("Could not create index file!", toString(std::move(E)));
return 1;
}
}
auto OSOrErr = Printer->createViewFile(SourceFile, /*InToplevel=*/false);
if (Error E = OSOrErr.takeError()) {
- deferError(toString(std::move(E)));
+ deferError("Could not create view file!", toString(std::move(E)));
return;
}
auto OS = std::move(OSOrErr.get());