Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 099ec62

Browse files
committed
[bugpoint] Report non-existent opt binary
Bugpoint will keep going even if the opt binary it's given doesn't exist. It should at least alert the user, so it's clear why reductions are failing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324713 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 2f8f367 commit 099ec62

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

test/BugPoint/unsymbolized.ll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
; RUN: echo "exit(1)" >> %t.py
55
; RUN: not bugpoint -load %llvmshlibdir/BugpointPasses%shlibext %s -output-prefix %t -bugpoint-crashcalls -opt-command="%python" -opt-args %t.py | FileCheck %s
66
; RUN: not --crash opt -load %llvmshlibdir/BugpointPasses%shlibext %s -bugpoint-crashcalls -disable-symbolication 2>&1 | FileCheck --check-prefix=CRASH %s
7+
; RUN: not bugpoint -load %llvmshlibdir/BugpointPasses%shlibext %s -output-prefix %t -bugpoint-crashcalls -opt-command=%t.non.existent.opt.binary -opt-args %t.py 2>&1 | FileCheck %s --check-prefix=BAD-OPT
78

89
; Test that bugpoint disables symbolication on the opt tool to reduce runtime overhead when opt crashes
910
; CHECK: args = {{.*}}'-disable-symbolication'
@@ -15,6 +16,7 @@
1516
; now.
1617
; CRASH-NOT: Signals.inc
1718

19+
; BAD-OPT: Specified `opt' binary does not exist: {{.*}}non.existent.opt.binary
1820
define void @f() {
1921
call void @f()
2022
ret void

tools/bugpoint/OptimizerDriver.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ bool BugDriver::runPasses(Module *Program,
177177
errs() << "Cannot find `opt' in PATH!\n";
178178
return 1;
179179
}
180+
if (!sys::fs::exists(tool)) {
181+
errs() << "Specified `opt' binary does not exist: " << tool << "\n";
182+
return 1;
183+
}
180184

181185
std::string Prog;
182186
if (UseValgrind) {

0 commit comments

Comments
 (0)