Skip to content

Conversation

@jefft0
Copy link
Contributor

@jefft0 jefft0 commented Jan 20, 2026

Resolve issue comment #1998 (comment) .

To show the gas used in gno test results:

  • For "*filetest.gno", runFiletest already creates a virtual machine with a gas meter. We update runFiletest to add a return value for m.GasMeter.GasConsumed()
  • When Test calls runFiletest, get and display the gas used
  • For normal "*.gno" tests, runTestFiles creates a virtual machine by calling Machine, where we add an optional param gasMeter. In runTestFiles we set this to store.NewInfiniteGasMeter() .
  • After runTestFiles uses m.Eval to evaluate the gno test, it prints the gas used
  • Update tests to expect the gas in the output like (elapsed: 0.01s, gas: 648732)

Sample output:

=== RUN   TestTreeReverseIterateByOffset
--- PASS: TestTreeReverseIterateByOffset (0.00s)
--- GAS:  218576
=== RUN   ./z_0_filetest.gno
false 2
--- PASS: ./z_0_filetest.gno (elapsed: 0.01s, gas: 648732)

(The CI check for codecov often fails for the filetest infrastructure. Suggest to ignore.)

In the future, when #4953 is merged, then we can integrate tests with this detail.

@Gno2D2
Copy link
Collaborator

Gno2D2 commented Jan 20, 2026

🛠 PR Checks Summary

All Automated Checks passed. ✅

Manual Checks (for Reviewers):
  • IGNORE the bot requirements for this PR (force green CI check)
Read More

🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.

✅ Automated Checks (for Contributors):

🟢 Maintainers must be able to edit this pull request (more info)
🟢 Pending initial approval by a review team member, or review from tech-staff

☑️ Contributor Actions:
  1. Fix any issues flagged by automated checks.
  2. Follow the Contributor Checklist to ensure your PR is ready for review.
    • Add new tests, or document why they are unnecessary.
    • Provide clear examples/screenshots, if necessary.
    • Update documentation, if required.
    • Ensure no breaking changes, or include BREAKING CHANGE notes.
    • Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
  1. Complete manual checks for the PR, including the guidelines and additional checks if applicable.
📚 Resources:
Debug
Automated Checks
Maintainers must be able to edit this pull request (more info)

If

🟢 Condition met
└── 🟢 And
    ├── 🟢 The base branch matches this pattern: ^master$
    └── 🟢 The pull request was created from a fork (head branch repo: jefft0/gno)

Then

🟢 Requirement satisfied
└── 🟢 Maintainer can modify this pull request

Pending initial approval by a review team member, or review from tech-staff

If

🟢 Condition met
└── 🟢 And
    ├── 🟢 The base branch matches this pattern: ^master$
    └── 🟢 Not (🔴 Pull request author is a member of the team: tech-staff)

Then

🟢 Requirement satisfied
└── 🟢 If
    ├── 🟢 Condition
    │   └── 🟢 Or
    │       ├── 🟢 User notJoon already reviewed PR 5076 with state APPROVED
    │       ├── 🟢 At least 1 user(s) of the team tech-staff reviewed pull request
    │       └── 🔴 This pull request is a draft
    └── 🟢 Then
        └── 🟢 Not (🔴 This label is applied to pull request: review/triage-pending)

Manual Checks
**IGNORE** the bot requirements for this PR (force green CI check)

If

🟢 Condition met
└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission

@codecov
Copy link

codecov bot commented Jan 20, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
gnovm/pkg/test/filetest.go 41.66% 7 Missing ⚠️

📢 Thoughts on this report? Let us know!

Signed-off-by: Jeff Thompson <jeff@thefirst.org>
@jefft0 jefft0 force-pushed the chore/show-gas-in-test-results branch from 38f98a5 to 1799080 Compare January 20, 2026 16:06
@jefft0 jefft0 changed the title chore: Show gas used in gno test results chore(test): Show gas used in gno test results Jan 20, 2026
@jefft0 jefft0 marked this pull request as ready for review January 20, 2026 16:56
@Gno2D2 Gno2D2 added the review/triage-pending PRs opened by external contributors that are waiting for the 1st review label Jan 20, 2026
Copy link
Member

@notJoon notJoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Gno2D2 Gno2D2 removed the review/triage-pending PRs opened by external contributors that are waiting for the 1st review label Jan 21, 2026
err = m.CheckEmpty()
if err != nil {
return "", fmt.Errorf("machine not empty after main: %w", err)
return "", m.GasMeter.GasConsumed(), fmt.Errorf("machine not empty after main: %w", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can also print it to a // Gas: directive for a filetest?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. How to make the filetest cause the "machine not empty after main" error?

jefft0 and others added 3 commits January 26, 2026 11:17
Co-authored-by: ltzmaxwell <ltz.maxwell@gmail.com>
Co-authored-by: ltzmaxwell <ltz.maxwell@gmail.com>
Signed-off-by: Jeff Thompson <jeff@thefirst.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📦 🤖 gnovm Issues or PRs gnovm related

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants