@@ -73,6 +73,9 @@ class PatchtestParser(object):
action='store_true',
help='Enable logging to a file matching the target patch name with ".testresult" appended')
+ parser.add_argument('--error-on-failure',
+ action='store_true',
+ help='Return non-zero exit status if a test fails')
return parser
@@ -183,6 +183,7 @@ def print_result_message(preresult, postresult):
print("----------------------------------------------------------------------\n")
def main():
+ ret = 0
tmp_patch = False
patch_path = PatchtestParser.patch_path
log_results = PatchtestParser.log_results
@@ -214,13 +215,16 @@ def main():
try:
if log_path:
- run(patch, log_path)
+ ret = run(patch, log_path)
else:
- run(patch)
+ ret = run(patch)
finally:
if tmp_patch:
os.remove(patch)
+ if PatchtestParser.error_on_failure and ret != 0:
+ return ret
+
if __name__ == '__main__':
ret = 1