Propagate error code when test cases are failed

To make cli driver useful, return meaningful code.