config/sysinv/sysinv/sysinv/sysinv/sanity_coverage.py
Al Bailey 4477fcbb93 Sysinv tox updates. Prepare for bandit reports and test reports
The old sysinv py27 target did not use testrepository so its results
were not reported in jenkins. Now it will.
The bandit target will now output to an xml file which can be parsed and
reported in jenkins.

Note:  running tox for sysinv will reports warnings about missing
fmClientUI and missing ceph. this is acceptable as neither of those are
installed in the tox environment, and are side effects of using fm-api

Change-Id: I48c74e9a62cd6fd32ceb71e1994c55fa7e8c42cf
2018-06-29 13:25:09 -04:00

34 lines
543 B
Python

#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
from coverage import Coverage
import os
import signal
flag_file = "/etc/coverage/sysinv/flag"
cov = None
def signal_handler(signum, frame):
cov.stop()
cov.save()
def register_handler(signum=signal.SIGUSR1):
signal.signal(signum, signal_handler)
def flag_file_exists():
return os.path.isfile(flag_file)
def start():
global cov
cov = Coverage(config_file=flag_file)
register_handler()
cov.erase()
cov.start()