Skip to content

Commit

Permalink
Log all errors from gcov execution (#889)
Browse files Browse the repository at this point in the history
Log all errors if an exception occur while searching for a correct
working directory.
  • Loading branch information
Spacetown committed Feb 20, 2024
1 parent c054100 commit 7ae6f8a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Expand Up @@ -18,6 +18,7 @@ New features and notable changes:
Bug fixes and small improvements:

- Add support for files with more than 9999 lines. (:issue:`883`, fixes :issue:`882`)
- Do not suppress gcov errors if exception occur. (:issue:`889`)

Documentation:

Expand Down
9 changes: 5 additions & 4 deletions gcovr/formats/gcov/read.py
Expand Up @@ -51,7 +51,7 @@
r"(?:[Cc](?:annot|ould not) open (?:source|graph) file|: No such file or directory)"
)
output_error_re = re.compile(
r"(?:[Cc](?:annot|ould not) open output file|Operation not permitted|Permission denied)"
r"(?:[Cc](?:annot|ould not) open output file|Operation not permitted|Permission denied|Read-only file system)"
)
unknown_cla_re = re.compile(r"Unknown command line argument")

Expand Down Expand Up @@ -723,15 +723,16 @@ def run_gcov_and_process_files(
if os.path.exists(filepath):
os.remove(filepath)

except Exception:
LOGGER.error(
except Exception as exc:
done = False
error(
f"Trouble processing {abs_filename!r} with working directory {chdir!r}.\n"
f"Stdout of gcov was >>{out}<< End of stdout\n"
f"Stderr of gcov was >>{err}<< End of stderr\n"
f"Exception was >>{str(exc)}<< End of stderr\n"
f"Current processed gcov file was {fname!r}.\n"
"Use option --verbose to get extended information."
)
raise

return done

Expand Down

0 comments on commit 7ae6f8a

Please sign in to comment.