From fbf71441df448b045c1785df4b555ab4d10aaf09 Mon Sep 17 00:00:00 2001 From: Yichen Wang Date: Mon, 17 Jul 2017 17:26:07 -0700 Subject: [PATCH] Return error code when test case failed Change-Id: I24442d37787bd7dd4dcc780f42a44d216c149d6e --- Dockerfile | 2 ++ vmtp/vmtp.py | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/Dockerfile b/Dockerfile index e7a7dbe..788bac5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,5 +15,7 @@ RUN apt-get update && apt-get install -y \ python-pip \ && rm -rf /var/lib/apt/lists/* +RUN pip install pip --upgrade +RUN pip install pbr setuptools RUN pip install vmtp diff --git a/vmtp/vmtp.py b/vmtp/vmtp.py index 195565a..3d9c2e6 100755 --- a/vmtp/vmtp.py +++ b/vmtp/vmtp.py @@ -51,6 +51,7 @@ from prettytable import PrettyTable import sshutils flow_num = 0 +return_code = 0 class FlowPrinter(object): @staticmethod def print_desc(desc): @@ -701,6 +702,10 @@ def print_report(results): "Skipped Scenarios": "%d" % (cnt_skipped)} FILELOG.info(json.dumps(ls_summary, sort_keys=True)) + if cnt_failed: + global return_code + return_code = 1 + def normalize_paths(cfg): ''' Normalize the various paths to config files, tools, ssh priv and pub key @@ -1211,6 +1216,7 @@ def main(): opts = parse_opts_from_cli() log.setup('vmtp', debug=opts.debug, logfile=opts.logfile) run_vmtp(opts) + sys.exit(return_code) if __name__ == '__main__': main()