-
Notifications
You must be signed in to change notification settings - Fork 375
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
test(gnovm): fix TestPackages #964
Conversation
`TestPackages` wasn't actually reporting test failures, due to a bug in the underlying function `machine.TestMemPackage()`. `TestMemPackage` was running the found gno tests by just calling the test function with a new `testing.T`, but then it's not possible to detect if there's any failure, because `testing.T` has only private fields. The fix is to change that to a call to `testing.RunTest()` function, which is already used by `gno test`, and returns a `testing.Report` on which we can detect failures. A test has been added (see `TestMachineTestMemPackage()`) in gnovm/tests folder (because a TestStore is needed). On master, this test is failing. The next step should be to merge the 2 ways that currently exists to run gno tests, i.e. `gno test` and `go test -run TestPackages`. Potentially this could fix gnolang#896.
Note that We don't see the error in the CI because |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 💯
Thank you for the detailed in-code explanations 🙏
`TestPackages` wasn't actually reporting test failures, due to a bug in the underlying function `machine.TestMemPackage()`. `TestMemPackage` was running the gno tests by just calling the test function with a new `testing.T`, but then it's not possible to detect if there's any failure, because `testing.T` has only private fields. The fix is to change that to a call to `testing.RunTest()` function, which is already used by `gno test`, and returns a `testing.Report` on which we can detect failures. A test has been added (see `TestMachineTestMemPackage()`) in gnovm/tests folder (because a `TestStore` is needed). On master, this test is failing. ``` go test ./gnovm/tests -v -run TestMachineTestMemPackage ``` The next step should be to merge the 2 ways that currently exists to run gno tests, i.e. `gno test` and `go test -run TestPackages`. Potentially this could fix gnolang#896. ## Contributors Checklist - [x] 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 - [x] Provided any useful hints for running manual tests - [ ] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](../.benchmarks/README.md). ## Maintainers Checklist - [x] Checked that the author followed the guidelines in `CONTRIBUTING.md` - [x] Checked the conventional-commit (especially PR title and verb, presence of `BREAKING CHANGE:` in the body) - [x] Ensured that this PR is not a significant change or confirmed that the review/consideration process was appropriate for the change </details> --------- Co-authored-by: Manfred Touron <94029+moul@users.noreply.github.com>
TestPackages
wasn't actually reporting test failures, due to a bug in the underlying functionmachine.TestMemPackage()
.TestMemPackage
was running the gno tests by just calling the test function with a newtesting.T
, but then it's not possible to detect if there's any failure, becausetesting.T
has only private fields.The fix is to change that to a call to
testing.RunTest()
function, which is already used bygno test
, and returns atesting.Report
on which we can detect failures.A test has been added (see
TestMachineTestMemPackage()
) in gnovm/tests folder (because aTestStore
is needed). On master, this test is failing.The next step should be to merge the 2 ways that currently exists to run gno tests, i.e.
gno test
andgo test -run TestPackages
. Potentially this could fix #896.Contributors Checklist
BREAKING CHANGE: xxx
message was included in the descriptionMaintainers Checklist
CONTRIBUTING.md
BREAKING CHANGE:
in the body)