From ae1d7b12489875a6608548542e3876a925eb4c6a Mon Sep 17 00:00:00 2001 From: Karl Klashinsky Date: Tue, 15 Dec 2015 13:32:11 -0800 Subject: [PATCH] Make sure unit-test results are handled properly. The 'coverage' functionality was not added in all branches, so prior changes to check test results in test.log vs coveragetest.log should not have been applied to this branch. Additionally, not all run_tests.sh usage was properly checking for tests passing with 'OK'. Change-Id: Iab8db088686e55d0985b729cdb490a3c0dc38ced Closes-Bug: #1507070 --- src/config/device-manager/setup.py | 5 ++++- src/config/svc-monitor/setup.py | 3 +++ src/config/vnc_openstack/setup.py | 1 - 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/config/device-manager/setup.py b/src/config/device-manager/setup.py index ec52554ad4f..e5258600518 100644 --- a/src/config/device-manager/setup.py +++ b/src/config/device-manager/setup.py @@ -2,7 +2,7 @@ # Copyright (c) 2014 Juniper Networks, Inc. All rights reserved. # from setuptools import setup, find_packages, Command -import os +import os, re class RunTestsCommand(Command): description = "Test command to run testr in virtualenv" @@ -13,6 +13,9 @@ def finalize_options(self): self.cwd = os.getcwd() def run(self): os.system('./run_tests.sh -V') + with open('test.log') as f: + if not re.search('\nOK', ''.join(f.readlines())): + os._exit(1) setup( name='device_manager', diff --git a/src/config/svc-monitor/setup.py b/src/config/svc-monitor/setup.py index b23ed306d98..fb05349f821 100644 --- a/src/config/svc-monitor/setup.py +++ b/src/config/svc-monitor/setup.py @@ -14,6 +14,9 @@ def finalize_options(self): self.cwd = os.getcwd() def run(self): os.system('./run_tests.sh -V') + with open('test.log') as f: + if not re.search('\nOK', ''.join(f.readlines())): + os._exit(1) def requirements(filename): with open(filename) as f: diff --git a/src/config/vnc_openstack/setup.py b/src/config/vnc_openstack/setup.py index 000ae6f00b6..8d18e777388 100644 --- a/src/config/vnc_openstack/setup.py +++ b/src/config/vnc_openstack/setup.py @@ -2,7 +2,6 @@ # Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. # -import os import os, sys, re from setuptools import setup, find_packages, Command