test/post_process.py: Don't print coverage info to separate file.

We already have the post process log readily available. Put the
info there to avoid hiding the coverage errors in an obscure second
file.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: I2fe9f79403ca1accccc207155f8d0dafd4c24f8e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1790
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Seth Howell 2020-04-09 19:03:54 -07:00 committed by Tomasz Zawadzki
parent f1dede62a3
commit 237ef4c600

View File

@ -34,47 +34,46 @@ def generateTestCompletionTables(output_dir, completion_table):
def generateCoverageReport(output_dir, repo_dir): def generateCoverageReport(output_dir, repo_dir):
with open(os.path.join(output_dir, 'coverage.log'), 'w+') as log_file: coveragePath = os.path.join(output_dir, '**', 'cov_total.info')
coveragePath = os.path.join(output_dir, '**', 'cov_total.info') covfiles = [os.path.abspath(p) for p in glob.glob(coveragePath, recursive=True)]
covfiles = [os.path.abspath(p) for p in glob.glob(coveragePath, recursive=True)] for f in covfiles:
for f in covfiles: print(f)
print(f, file=log_file) if len(covfiles) == 0:
if len(covfiles) == 0: return
return lcov_opts = [
lcov_opts = [ '--rc lcov_branch_coverage=1',
'--rc lcov_branch_coverage=1', '--rc lcov_function_coverage=1',
'--rc lcov_function_coverage=1', '--rc genhtml_branch_coverage=1',
'--rc genhtml_branch_coverage=1', '--rc genhtml_function_coverage=1',
'--rc genhtml_function_coverage=1', '--rc genhtml_legend=1',
'--rc genhtml_legend=1', '--rc geninfo_all_blocks=1',
'--rc geninfo_all_blocks=1', ]
] cov_total = os.path.abspath(os.path.join(output_dir, 'cov_total.info'))
cov_total = os.path.abspath(os.path.join(output_dir, 'cov_total.info')) coverage = os.path.join(output_dir, 'coverage')
coverage = os.path.join(output_dir, 'coverage') lcov = 'lcov' + ' ' + ' '.join(lcov_opts) + ' -q -a ' + ' -a '.join(covfiles) + ' -o ' + cov_total
lcov = 'lcov' + ' ' + ' '.join(lcov_opts) + ' -q -a ' + ' -a '.join(covfiles) + ' -o ' + cov_total genhtml = 'genhtml' + ' ' + ' '.join(lcov_opts) + ' -q ' + cov_total + ' --legend' + ' -t "Combined" --show-details -o ' + coverage
genhtml = 'genhtml' + ' ' + ' '.join(lcov_opts) + ' -q ' + cov_total + ' --legend' + ' -t "Combined" --show-details -o ' + coverage try:
try: subprocess.check_call([lcov], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
subprocess.check_call([lcov], shell=True, stdout=log_file, stderr=log_file) except subprocess.CalledProcessError as e:
except subprocess.CalledProcessError as e: print("lcov failed")
print("lcov failed", file=log_file) print(e)
print(e, file=log_file) return
return cov_total_file = open(cov_total, 'r')
cov_total_file = open(cov_total, 'r') replacement = "SF:" + repo_dir
replacement = "SF:" + repo_dir file_contents = cov_total_file.readlines()
file_contents = cov_total_file.readlines() cov_total_file.close()
cov_total_file.close() os.remove(cov_total)
os.remove(cov_total) with open(cov_total, 'w+') as file:
with open(cov_total, 'w+') as file: for Line in file_contents:
for Line in file_contents: Line = re.sub("^SF:.*/repo", replacement, Line)
Line = re.sub("^SF:.*/repo", replacement, Line) file.write(Line + '\n')
file.write(Line + '\n') try:
try: subprocess.check_call([genhtml], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
subprocess.check_call([genhtml], shell=True, stdout=log_file, stderr=log_file) except subprocess.CalledProcessError as e:
except subprocess.CalledProcessError as e: print("genhtml failed")
print("genhtml failed", file=log_file) print(e)
print(e, file=log_file) for f in covfiles:
for f in covfiles: os.remove(f)
os.remove(f)
def collectOne(output_dir, dir_name): def collectOne(output_dir, dir_name):