[PATCH] D102891: [llvm-reduce] Exit when input module is malformed
Langston Barrett via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 25 08:39:17 PDT 2021
langston-barrett updated this revision to Diff 347690.
langston-barrett added a comment.
Update test to not depend on platform-specific error message
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102891/new/
https://reviews.llvm.org/D102891
Files:
llvm/test/tools/llvm-reduce/fail-file-open.test
llvm/tools/llvm-reduce/llvm-reduce.cpp
Index: llvm/tools/llvm-reduce/llvm-reduce.cpp
===================================================================
--- llvm/tools/llvm-reduce/llvm-reduce.cpp
+++ llvm/tools/llvm-reduce/llvm-reduce.cpp
@@ -116,6 +116,10 @@
std::unique_ptr<Module> OriginalProgram =
parseInputFile(InputFilename, Context);
+ if (!OriginalProgram) {
+ return 1;
+ }
+
// Initialize test environment
TestRunner Tester(TestFilename, TestArguments);
Tester.setProgram(std::move(OriginalProgram));
Index: llvm/test/tools/llvm-reduce/fail-file-open.test
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-reduce/fail-file-open.test
@@ -0,0 +1,5 @@
+# RUN: not llvm-reduce --test=echo %s.NotAFileInTestingDir 2>&1 | FileCheck %s
+
+This file will not be read. An invalid file path is fed to llvm-reduce.
+
+# CHECK: llvm-reduce: {{.*}}.NotAFileInTestingDir: error:
\ No newline at end of file
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102891.347690.patch
Type: text/x-patch
Size: 948 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210525/49bc9148/attachment.bin>
More information about the llvm-commits
mailing list