How to use bugpoint?

Hi all, I am trying to use bugpoint for reducing a testcase. I have never used it before, this is my first time. Here is my script

res=`opt -<passname> --disable-output $@ 2>&1`
marker=${res:0:2}
if [ "$marker" = "FP" ]; then
  >&2 echo "error"
  exit 1
fi
exit 0

I start with before.ll file, which reports “error” with this script.
bugpoint --compile-custom --compile-command=./script.sh before.ll
After running this, the following files are generated

bugpoint-reduced-blocks.bc
bugpoint-reduced-conditionals.bc
bugpoint-reduced-instructions.bc
bugpoint-reduced-named-md.bc
bugpoint-reduced-simplified.bc

But out of these only the second one reports errors with the script - bugpoint-reduced-conditionals.bc. Am I using this wrong? Or is this expected behavior? I thought atleast bugpoint-reduced-simplified.bc should be the erroneous one - instead it has just one function with one instruction - unreachable.

Also, how would I do this using llvm-reduce? Right now, it fails with the error

Error running interesting-ness test: posix_spawn failed: Exec format error

Have you tested the script outside of bugpoint to make sure it works the way you want? If bugpoint-reduced-simplified.bc only has a single instruction, then my guess is that your script is always exiting with success.

Make sure your test script has the shebang line

Hi, thanks for the reply. There is some problem with the opt binary itself (it was opt 11). Nevertheless, I just wanted to make sure I am using it right. Thanks for confirming that. I will look into this once we have an updated implementation of the pass and then I might have a well formed question, if any.

Make sure your test script has the shebang line

Sure, will do.