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

gno test -cover ... #1121

Open
moul opened this issue Sep 14, 2023 · 0 comments · May be fixed by #2616
Open

gno test -cover ... #1121

moul opened this issue Sep 14, 2023 · 0 comments · May be fixed by #2616
Labels
bounty/L L bounties: $4000 bounty

Comments

@moul
Copy link
Member

moul commented Sep 14, 2023

Implement a basic code coverage support, and setup CI/CD to start monitoring the coverage status of internal components, through testing the examples/ and gnovm/tests directories.

Bounty Requirements

  • Within the GnoVM, a system is added which keeps a tally of the lines executed
    • Ideally this should be similar to Go's, where simple "increment" statements are added to the appropriate lines; this way the addition of the feature doesn't impact the normal execution performance of the GnoVM
    • Upon investigation, a different approach can be taken if necessary
  • In the gno test command, after each package is tested, if the -cover flag is passed, the VM prints a simple percentage of the covered lines, like the result of go test:
    ok      gno.land/p/demo/...    0.035s  coverage: 75.1% of statements
    
  • what -cover considers a statement to cover should match what Go considers
    • ie. transpiling the source of a Gno program into Go (gno transpile), then running tests, should yield the same %.

Bounty Size: L; expected maximum reward: $4,000.

Find out more on the bounty program. If you participate with intention of receiving the bounty, you must agree to the Bounty Terms and Conditions.

More bounties | Contributing guidelines

@thehowl thehowl changed the title gno test -cover... gno test -coverpkg ... Sep 14, 2023
@moul moul moved this to 🌟 Wanted for Launch in 🚀 The Launch [DEPRECATED] Sep 16, 2023
@moul moul changed the title gno test -coverpkg ... gno test -cover ... Sep 16, 2023
@moul moul moved this from 🌟 Wanted for Launch to 🔵 Not Needed for Launch in 🚀 The Launch [DEPRECATED] Sep 16, 2023
@moul moul moved this from 🔵 Not Needed for Launch to 🌟 Wanted for Launch in 🚀 The Launch [DEPRECATED] Sep 16, 2023
@moul moul added this to the 🌟 main.gno.land (wanted) milestone Sep 16, 2023
@harry-hov harry-hov self-assigned this Oct 3, 2023
thehowl pushed a commit that referenced this issue May 30, 2024
No new tests have been added yet, but existing tests in
gnovm/tests/files are now executed in the context of the package which
contains the relevant interpreter virtual machine and parser code. We
have now a better baseline to measure and complete the code coverage.

This represents more than 800 tests, which takes 10s on my macbook air
m1. Those tests are actually run twice, as I haven't yet removed the
original execution from gnovm/tests.

The testing code is substantially simplified compared to its counterpart
in gnovm/tests, but has not yet been deduplicated. This will be done in
further commits.

In `gnovm/pkg/golang`, `go test -cover` went from 34.2% to 66.7%.

Related to #1121, #1145 and probably more
<!-- please provide a detailed description of the changes made in this
pull request. -->

<details><summary>Contributors' checklist...</summary>

- [*] Added new tests, or not needed, or not feasible
- [*] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [*] Updated the official documentation or not needed
- [*] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [*] Added references to related issues and PRs
- [*] Provided any useful hints for running manual tests
- [ ] Added new benchmarks to [generated
graphs](https://gnoland.github.io/benchmarks), if any. More info
[here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).
</details>

---------

Co-authored-by: Manfred Touron <[email protected]>
omarsy pushed a commit to TERITORI/gno that referenced this issue Jun 3, 2024
No new tests have been added yet, but existing tests in
gnovm/tests/files are now executed in the context of the package which
contains the relevant interpreter virtual machine and parser code. We
have now a better baseline to measure and complete the code coverage.

This represents more than 800 tests, which takes 10s on my macbook air
m1. Those tests are actually run twice, as I haven't yet removed the
original execution from gnovm/tests.

The testing code is substantially simplified compared to its counterpart
in gnovm/tests, but has not yet been deduplicated. This will be done in
further commits.

In `gnovm/pkg/golang`, `go test -cover` went from 34.2% to 66.7%.

Related to gnolang#1121, gnolang#1145 and probably more
<!-- please provide a detailed description of the changes made in this
pull request. -->

<details><summary>Contributors' checklist...</summary>

- [*] Added new tests, or not needed, or not feasible
- [*] Provided an example (e.g. screenshot) to aid review or the PR is
self-explanatory
- [*] Updated the official documentation or not needed
- [*] No breaking changes were made, or a `BREAKING CHANGE: xxx` message
was included in the description
- [*] Added references to related issues and PRs
- [*] Provided any useful hints for running manual tests
- [ ] Added new benchmarks to [generated
graphs](https://gnoland.github.io/benchmarks), if any. More info
[here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).
</details>

---------

Co-authored-by: Manfred Touron <[email protected]>
@notJoon notJoon linked a pull request Sep 9, 2024 that will close this issue
@thehowl thehowl added bounty bounty/M M bounties: $2000 bounty/L L bounties: $4000 and removed bounty/M M bounties: $2000 labels Oct 5, 2024
This was referenced Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bounty/L L bounties: $4000 bounty
Projects
Status: 🌟 Wanted for Launch
Status: Triage
4 participants