Print this page
11814 test-runner exit code should reflect test results

*** 12,22 **** # # # Copyright (c) 2012, 2016 by Delphix. All rights reserved. # Copyright (c) 2017, Chris Fraire <cfraire@me.com>. ! # Copyright 2018 Joyent, Inc. # import ConfigParser import os import logging --- 12,22 ---- # # # Copyright (c) 2012, 2016 by Delphix. All rights reserved. # Copyright (c) 2017, Chris Fraire <cfraire@me.com>. ! # Copyright 2019 Joyent, Inc. # import ConfigParser import os import logging
*** 37,46 **** --- 37,48 ---- BASEDIR = '/var/tmp/test_results' KILL = '/usr/bin/kill' TRUE = '/usr/bin/true' SUDO = '/usr/bin/sudo' + retcode = 0 + # Custom class to reopen the log file in case it is forcibly closed by a test. class WatchedFileHandlerClosed(WatchedFileHandler): """Watch files, including closed files. Similar to (and inherits from) logging.handler.WatchedFileHandler, except that IOErrors are handled by reopening the stream and retrying.
*** 82,107 **** --- 84,113 ---- """ Finalize the results of this Cmd. Report SKIP for return codes 3,4 (NOTINUSE, UNSUPPORTED) as defined in ../stf/include/stf.shlib """ + global retcode + Result.total += 1 m, s = divmod(time() - self.starttime, 60) self.runtime = '%02d:%02d' % (m, s) self.returncode = proc.returncode if killed: self.result = 'KILLED' Result.runresults['KILLED'] += 1 + retcode = 2; elif self.returncode is 0: self.result = 'PASS' Result.runresults['PASS'] += 1 elif self.returncode is 3 or self.returncode is 4: self.result = 'SKIP' Result.runresults['SKIP'] += 1 elif self.returncode is not 0: self.result = 'FAIL' Result.runresults['FAIL'] += 1 + retcode = 1; class Output(object): """ This class is a slightly modified version of the 'Stream' class found
*** 888,897 **** fail('Unknown command specified') testrun.complete_outputdirs() testrun.run(options) testrun.summary() ! exit(0) if __name__ == '__main__': main() --- 894,903 ---- fail('Unknown command specified') testrun.complete_outputdirs() testrun.run(options) testrun.summary() ! exit(retcode) if __name__ == '__main__': main()