From 2fa977d473ebfb0c20d718eaa29489363fe68d7f Mon Sep 17 00:00:00 2001 From: Manuel Traut Date: Tue, 4 Dec 2018 08:45:18 +0100 Subject: optional return error-code Add an option. If enabled pyjutest returns the returncode of the command under test. If not, pyjutest stores the returnvalue of the command under test just in the junit file. This can be used to abort an underlaying test or testframework. Signed-off-by: Manuel Traut Reviewed-by: Benedikt Spranger --- pyjutest | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyjutest b/pyjutest index ee04fdd..c9735e5 100755 --- a/pyjutest +++ b/pyjutest @@ -24,6 +24,7 @@ oparser = OptionParser(usage="usage: %prog [options] \'mycmd param1 param2\'") oparser.add_option("--version", dest="version", action="store_true", default=False) oparser.add_option("--class", dest="uclass", default="sh") oparser.add_option("--name", dest="uname", default=None) +oparser.add_option("--return", dest="ret", action="store_true", default=False) (opt,args) = oparser.parse_args(sys.argv) @@ -93,3 +94,6 @@ with open('pyjutest.dat', 'wb') as dat: with open('pyjutest.xml', 'w') as xml: TestSuite.to_file(xml, tss, prettyprint=True) + +if opt.ret: + sys.exit(p.returncode) -- cgit v1.2.3