summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Levon <john.levon@joyent.com>2019-11-14 18:33:17 +0000
committerJohn Levon <john.levon@joyent.com>2019-11-16 11:20:54 +0000
commit2491fc01733d7e4f5776b0711db713078d7cd24a (patch)
tree4f3b971f215fc3811223e3244c2db25ffdf39767
parent11ed32a0b3b424ec966d0330d0efaf049baaf8d2 (diff)
downloadillumos-gate-2491fc01733d7e4f5776b0711db713078d7cd24a.tar.gz
11814 test-runner exit code should reflect test results
Reviewed by: Robert Mustacchi <rm@fingolfin.org> Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r--usr/src/test/test-runner/cmd/run10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr/src/test/test-runner/cmd/run b/usr/src/test/test-runner/cmd/run
index 61fb66791c..cf41dac479 100644
--- a/usr/src/test/test-runner/cmd/run
+++ b/usr/src/test/test-runner/cmd/run
@@ -14,7 +14,7 @@
#
# Copyright (c) 2012, 2016 by Delphix. All rights reserved.
# Copyright (c) 2017, Chris Fraire <cfraire@me.com>.
-# Copyright 2018 Joyent, Inc.
+# Copyright 2019 Joyent, Inc.
#
import ConfigParser
@@ -39,6 +39,8 @@ 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.
@@ -84,6 +86,8 @@ class Result(object):
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)
@@ -91,6 +95,7 @@ class Result(object):
if killed:
self.result = 'KILLED'
Result.runresults['KILLED'] += 1
+ retcode = 2;
elif self.returncode is 0:
self.result = 'PASS'
Result.runresults['PASS'] += 1
@@ -100,6 +105,7 @@ class Result(object):
elif self.returncode is not 0:
self.result = 'FAIL'
Result.runresults['FAIL'] += 1
+ retcode = 1;
class Output(object):
@@ -890,7 +896,7 @@ def main():
testrun.complete_outputdirs()
testrun.run(options)
testrun.summary()
- exit(0)
+ exit(retcode)
if __name__ == '__main__':