dawn added a comment. Ah! expect takes a 'error' argument :) This works: self.expect("expression blabla", error=True, startstr = "error") Repository: rL LLVM http://reviews.llvm.org/D11447