This is a small compatibility improvement with gnu nm and makes llvm-nm more
useful as a testing tool.
llvm-svn: 185546
--- /dev/null
+Test that llvm-nm returns an error because of the unknown file type, but
+keeps processing subsequent files.
+
+Note: We use a temporary file since the tests don't run with pipefail.
+
+RUN: touch %t
+RUN: not llvm-nm %p/Inputs/trivial-object-test.elf-i386 %t \
+RUN: %p/Inputs/trivial-object-test.elf-i386 > %t.log
+RUN: FileCheck %s < %t.log
+
+CHECK: U SomeOtherFunction
+CHECK: 00000000 T main
+CHECK: U puts
+
+CHECK: U SomeOtherFunction
+CHECK: 00000000 T main
+CHECK: U puts
bool MultipleFiles = false;
+ bool HadError = false;
+
std::string ToolName;
}
static bool error(error_code ec, Twine path = Twine()) {
if (ec) {
error(ec.message(), path);
+ HadError = true;
return true;
}
return false;
} else {
errs() << ToolName << ": " << Filename << ": "
<< "unrecognizable file type\n";
+ HadError = true;
return;
}
}
std::for_each(InputFilenames.begin(), InputFilenames.end(),
DumpSymbolNamesFromFile);
+
+ if (HadError)
+ return 1;
+
return 0;
}