Skip filtering of coverage if no @coverage tags are found in a _utest.c file

This commit is contained in:
Paul Bartell 2021-03-19 17:53:29 -07:00 committed by Paul Bartell
parent 26478d721f
commit 3a48781a03

View file

@ -79,10 +79,12 @@ def main():
print("The test file path does not exist.", file=sys.stderr)
sys.exit(1)
skip_target_filtering = False
tagged_functions = get_tagged_functions_in_file(args.test)
if len(tagged_functions) == 0:
print("No target functions found in test file.")
sys.exit(1)
print("WARNING: No target functions found in test file.")
skip_target_filtering = True
print("Target functions from UT: " + str(tagged_functions), file=sys.stderr)
cov_functions_deps = get_function_deps(args.map, tagged_functions)
@ -94,7 +96,13 @@ def main():
covfile_handle = gzip.open(vars(args)["in"], "rb")
else:
covfile_handle = open(vars(args)["in"], "r")
covdata_out = filter_coverage_file(covfile_handle, cov_functions_deps)
if skip_target_filtering:
print("WARNING: Skipping coverage filtering.")
covdata_out = json.load(covfile_handle)
else:
covdata_out = filter_coverage_file(covfile_handle, cov_functions_deps)
covfile_handle.close()
filter_excluded_lines(covdata_out)