[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [XTF PATCH v2 3/4] xtf-runner: provide a set of exit codes for different results



Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 xtf-runner | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xtf-runner b/xtf-runner
index c938f28..1c96750 100755
--- a/xtf-runner
+++ b/xtf-runner
@@ -21,6 +21,16 @@ except ImportError:
 # Note that warning is not a result on its own.
 all_results = ('SUCCESS', 'SKIP', 'ERROR', 'FAILURE')
 
+# Return the exit code for different states.  Avoid using 1 and 2 because
+# python interpreter uses them -- see document for sys.exit.
+def exit_code(state):
+    """ Convert a test result to an xtf-runner exit code. """
+    return { "SUCCESS": 0,
+             "SKIP":    3,
+             "ERROR":   4,
+             "FAILURE": 5,
+    }.get(state, 4)
+
 # All test categories and configurations
 all_categories   = ("special", "functional", "xsa", "utility")
 pv_environments  = ("pv64", "pv32pae")
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.