On failure tests-runner should do non-zero exit

Right now test runner will always exit(0).
It's helpful to have zfs-tests.sh provide different
exit values depending on if everything passed or not.
We can then use common shell cmds to run tests until failure.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Signed-off-by: Alek Pinchuk <apinchuk@datto.com>
Closes #6285
This commit is contained in:
Alek P 2017-06-30 14:14:26 -04:00 committed by Brian Behlendorf
parent b81a1c61ec
commit fe46eebe6b
1 changed files with 7 additions and 3 deletions

View File

@ -13,6 +13,7 @@
# #
# Copyright (c) 2012, 2015 by Delphix. All rights reserved. # Copyright (c) 2012, 2015 by Delphix. All rights reserved.
# Copyright (c) 2017 Datto Inc.
# #
import ConfigParser import ConfigParser
@ -702,7 +703,7 @@ class TestRun(object):
def summary(self): def summary(self):
if Result.total is 0: if Result.total is 0:
return return 2
print '\nResults Summary' print '\nResults Summary'
for key in Result.runresults.keys(): for key in Result.runresults.keys():
@ -716,6 +717,10 @@ class TestRun(object):
float(Result.total)) * 100) float(Result.total)) * 100)
print 'Log directory:\t%s' % self.outputdir print 'Log directory:\t%s' % self.outputdir
if Result.runresults['FAIL'] > 0:
return 1
return 0
def verify_file(pathname): def verify_file(pathname):
""" """
@ -871,8 +876,7 @@ def main():
testrun.complete_outputdirs() testrun.complete_outputdirs()
testrun.run(options) testrun.run(options)
testrun.summary() exit(testrun.summary())
exit(0)
if __name__ == '__main__': if __name__ == '__main__':