Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added code coverage support to Godot #36572

Merged
merged 1 commit into from
Feb 27, 2020
Merged

Conversation

qarmin
Copy link
Contributor

@qarmin qarmin commented Feb 26, 2020

Code Coverage is a simple and easy method to find unreachable code and optimize functions which are called the most.

Required Tools
The only needed tools are(tested only on Linux, I'm not sure if macOS or Windows can run this):
gcc or clang
gcov
lcov
sudo apt install gcc gcov lcov clang

Usage
Go to Godot directory cd ~/godot
Compile Godot with coverage support - scons p=x11 -j6 use_coverage=yes
Run project/editor with compiled version of Godot etc. - bin/godot.x11.tools.64 --path ~/Projekty/Godot-Project
Exit project
Run lcov capture command - lcov --directory ./ --capture --output-file godot.info
Generate HTML - genhtml godot.info --ignore-errors source
Run index.html from folder

to clear results execute lcov --zerocounters

HTML file with code coverage of core/class_db.cpp when I runned The Worst Godot Project(remove .txt and open in browser) - lcov.html.txt

Report look like this:
Zrzut ekranu z 2020-02-26 19-32-06

@akien-mga akien-mga added this to the 4.0 milestone Feb 27, 2020
@akien-mga akien-mga merged commit 2ceaa6a into godotengine:master Feb 27, 2020
@akien-mga
Copy link
Member

Thanks!

@qarmin qarmin deleted the coverage branch February 25, 2021 10:19
skimmedsquare added a commit to skimmedsquare/godot that referenced this pull request Oct 28, 2021
Based on godotengine#36572 which added support for Linux
akien-mga added a commit to akien-mga/godot that referenced this pull request Aug 29, 2023
This would cause `updown.png` to be ignored in our default theme in 3.x.

These ignores were added in godotengine#36800 for godotengine#36572 (see that PR for usage
instructions).

From a quick test, using `--output-file` for `lcov` and `--output-directory`
for genhtml let us output the files in a way that won't conflict with the
Git repository (e.g. in `bin/`, or outside the Git repo).
akien-mga added a commit to akien-mga/godot that referenced this pull request Aug 29, 2023
This would cause `updown.png` to be ignored in our default theme in 3.x.

These ignores were added in godotengine#36800 for godotengine#36572 (see that PR for usage
instructions).

From a quick test, using `--output-file` for `lcov` and `--output-directory`
for genhtml let us output the files in a way that won't conflict with the
Git repository (e.g. in `bin/`, or outside the Git repo).

(cherry picked from commit 5c38e42)
akien-mga added a commit to akien-mga/godot that referenced this pull request Sep 6, 2023
This would cause `updown.png` to be ignored in our default theme in 3.x.

These ignores were added in godotengine#36800 for godotengine#36572 (see that PR for usage
instructions).

From a quick test, using `--output-file` for `lcov` and `--output-directory`
for genhtml let us output the files in a way that won't conflict with the
Git repository (e.g. in `bin/`, or outside the Git repo).

(cherry picked from commit 5c38e42)
mandryskowski pushed a commit to mandryskowski/godot that referenced this pull request Oct 11, 2023
This would cause `updown.png` to be ignored in our default theme in 3.x.

These ignores were added in godotengine#36800 for godotengine#36572 (see that PR for usage
instructions).

From a quick test, using `--output-file` for `lcov` and `--output-directory`
for genhtml let us output the files in a way that won't conflict with the
Git repository (e.g. in `bin/`, or outside the Git repo).
YuriSizov pushed a commit to YuriSizov/godot that referenced this pull request Jan 23, 2024
This would cause `updown.png` to be ignored in our default theme in 3.x.

These ignores were added in godotengine#36800 for godotengine#36572 (see that PR for usage
instructions).

From a quick test, using `--output-file` for `lcov` and `--output-directory`
for genhtml let us output the files in a way that won't conflict with the
Git repository (e.g. in `bin/`, or outside the Git repo).

(cherry picked from commit 5c38e42)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants