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

Update Coverage for Ruby 3.2 interface changes. #3151

Closed
wants to merge 0 commits into from

Conversation

mtortonesi
Copy link
Contributor

@mtortonesi mtortonesi commented Jul 6, 2023

This patch request should fix issue #3149.

Based on #3150

Thanks to @ioquatix and @eregon.

@oracle-contributor-agreement
Copy link

Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
The following contributors of this PR have not signed the OCA:

To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application.

When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated.

If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. label Jul 6, 2023
def self.start(*arguments, **options)
# We have to track if the :lines option was provided, as that calls for a
# different result format
@lines = true if options[:lines]
Copy link
Contributor

@ioquatix ioquatix Jul 7, 2023

Choose a reason for hiding this comment

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

Suggested change
@lines = true if options[:lines]
@lines = !!options[:lines]

You will want to set or clear this every time to ensure that the state is handled correctly.

@ioquatix
Copy link
Contributor

ioquatix commented Jul 7, 2023

For covered, we also need to support:

::Coverage.result(stop: false, clear: true)

@oracle-contributor-agreement
Copy link

Thank you for signing the OCA.

@oracle-contributor-agreement oracle-contributor-agreement bot added OCA Verified All contributors have signed the Oracle Contributor Agreement. and removed OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. labels Jul 7, 2023
@mtortonesi
Copy link
Contributor Author

Dear @ioquatix, I changed the code as per your request.

Would be happy to help you with adding support for ::Coverage.result(stop: false, clear: true) but I need more information about it.

@ioquatix
Copy link
Contributor

ioquatix commented Jul 8, 2023

   def self.result(stop: true, clear: true)
     result = peek_result
     Truffle::Coverage.disable if stop || clear
     Truffle::Coverage.enable if !stop && clear

I believe something like this can work.. but it's just a guess.

@mtortonesi
Copy link
Contributor Author

mtortonesi commented Aug 8, 2023

I took another look at this and fixed a couple of bugs in my code. Now everything seems to be fine:

Example video of sus+covered on Truffleruby

@ioquatix, I also added support for the stop and clear argument in Coverage#result, following your suggestions. However, I have no idea how to test that code properly.

@eregon
Copy link
Member

eregon commented Aug 11, 2023

Thank you for this this.
What would be super helpful is if you could write specs under spec/ruby/library/coverage for all the edge cases we found in #3150.

@eregon
Copy link
Member

eregon commented Aug 11, 2023

Having these specs is needed to ensure we implement working and compatible behavior + avoid regressions.
For instance we need specs for arguments and keywords arguments given to Coverage.start.

@andrykonchin
Copy link
Member

I will add missing specs and prepare the PR to merging.

@eregon
Copy link
Member

eregon commented Jan 9, 2024

@mtortonesi Sorry it takes a while but as you can see it's a lot more complicated than the initial patch.
Ah and because this was a PR from your master, it might have been unintentionally closed as a side effect.

We'll merge the changes when they are ready, we have an internal PR with extra specs etc.

@eregon
Copy link
Member

eregon commented Jan 22, 2024

Fixed in #3389

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in-ci The PR is being tested in CI. Do not push new commits. OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants