This is a follow up to r247518.
As a general note, I think we could do a much better job testing for
error conditions in tools. I already anticipated in a previous mail,
but while implementing this I noticed that the code coverage we have
for error checking is pretty low. I can arbitrarily remove checks from
several tools and the suite still passes.
Differential Revision: http://reviews.llvm.org/D12846
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247582
91177308-0d34-0410-b5e6-
96231b3b80d8
--- /dev/null
+# RUN: not llvm-mc %t.blah -o %t2 2>&1 | FileCheck --check-prefix=ENOENT %s
+# ENOENT: {{.*}}.blah: {{[Nn]}}o such file or directory
// construct the Triple object.
Triple TheTriple(TripleName);
- if (InputFilename != "-" && !sys::fs::exists(InputFilename)) {
- errs() << ProgName << ": '" << InputFilename << "': "
- << "No such file\n";
- return 1;
- }
ErrorOr<std::unique_ptr<MemoryBuffer>> BufferPtr =
MemoryBuffer::getFileOrSTDIN(InputFilename);
if (std::error_code EC = BufferPtr.getError()) {
- errs() << ProgName << ": " << EC.message() << '\n';
+ errs() << InputFilename << ": " << EC.message() << '\n';
return 1;
}
MemoryBuffer *Buffer = BufferPtr->get();