post_process: fix pylint W1732,W1705,W1722
Fix pylint findings: - R1732 consider-using-with - R1705 no-else-return - R1722 consider-using-sys-exit Signed-off-by: Pawel Piatek <pawelx.piatek@intel.com> Change-Id: If409c34f2ab8712e3fb1ac25b1c297d7e75c38fb Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12139 Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Karol Latecki <karol.latecki@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
9842b62c63
commit
04b16168cf
@ -4,6 +4,7 @@ import shutil
|
|||||||
import subprocess
|
import subprocess
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import glob
|
import glob
|
||||||
import re
|
import re
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
@ -73,10 +74,11 @@ def generateCoverageReport(output_dir, repo_dir):
|
|||||||
print("lcov failed")
|
print("lcov failed")
|
||||||
print(e)
|
print(e)
|
||||||
return
|
return
|
||||||
cov_total_file = open(cov_total, 'r')
|
|
||||||
|
with open(cov_total, 'r') as cov_total_file:
|
||||||
|
file_contents = cov_total_file.readlines()
|
||||||
|
|
||||||
replacement = "SF:" + repo_dir
|
replacement = "SF:" + repo_dir
|
||||||
file_contents = cov_total_file.readlines()
|
|
||||||
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:
|
||||||
@ -144,9 +146,9 @@ def getSkippedTests(repo_dir):
|
|||||||
skipped_test_file = os.path.join(repo_dir, "test", "common", "skipped_tests.txt")
|
skipped_test_file = os.path.join(repo_dir, "test", "common", "skipped_tests.txt")
|
||||||
if not os.path.exists(skipped_test_file):
|
if not os.path.exists(skipped_test_file):
|
||||||
return []
|
return []
|
||||||
else:
|
|
||||||
with open(skipped_test_file, "r") as skipped_test_data:
|
with open(skipped_test_file, "r") as skipped_test_data:
|
||||||
return [x.strip() for x in skipped_test_data.readlines() if "#" not in x and x.strip() != '']
|
return [x.strip() for x in skipped_test_data.readlines() if "#" not in x and x.strip() != '']
|
||||||
|
|
||||||
|
|
||||||
def confirmPerPatchTests(test_list, skiplist):
|
def confirmPerPatchTests(test_list, skiplist):
|
||||||
@ -155,7 +157,7 @@ def confirmPerPatchTests(test_list, skiplist):
|
|||||||
if len(missing_tests) > 0:
|
if len(missing_tests) > 0:
|
||||||
print("Not all tests were run. Failing the build.")
|
print("Not all tests were run. Failing the build.")
|
||||||
print(missing_tests)
|
print(missing_tests)
|
||||||
exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def aggregateCompletedTests(output_dir, repo_dir, skip_confirm=False):
|
def aggregateCompletedTests(output_dir, repo_dir, skip_confirm=False):
|
||||||
@ -189,6 +191,8 @@ def aggregateCompletedTests(output_dir, repo_dir, skip_confirm=False):
|
|||||||
if not skip_confirm:
|
if not skip_confirm:
|
||||||
confirmPerPatchTests(test_list, skipped_tests)
|
confirmPerPatchTests(test_list, skipped_tests)
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
def main(output_dir, repo_dir, skip_confirm=False):
|
def main(output_dir, repo_dir, skip_confirm=False):
|
||||||
print("-----Begin Post Process Script------")
|
print("-----Begin Post Process Script------")
|
||||||
|
Loading…
Reference in New Issue
Block a user