-
-
Notifications
You must be signed in to change notification settings - Fork 753
Conversation
eff255b
to
81deaa4
Compare
@rspec/rspec -- There are a number of TODOs above, but someone could go ahead and start reviewing this anytime. What's already there is pretty stable and what's left is largely additive. |
34b672c
to
788036e
Compare
|
||
def debug(level, msg) | ||
puts "#{' ' * level}Minimizer: #{msg}" if ENV['DEBUG_RSPEC_BISECT'] | ||
end |
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.
Is this intended for "release" usage? or just whilst this is WIP?
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.
Is this intended for "release" usage? or just whilst this is WIP?
Kinda both, actually. It was originally inspired by a similar feature in minitest-bisect:
It helped me get it working right. I think it also has value to keep something like this in place, though. Without it, if bisect's not working for a user, there's not much we can do to understand why. Having a verbose/debug mode will allow them to give us a print out that will hopefully allow us to understand where it went wrong. Bundler has something similar -- see rubygems/bundler#2248.
That said, this is a crappy WIP implementation of such debugging output. I'm thinking the debug output should be moved into the formatter (or perhaps be an alternate formatter). And perhaps we shouldn't necessarily use an ENV var to activate it, although I don't necessarily want to add a public API for it either -- it's more just something we can ask users to enable when they report bisect bugs.
Thoughts?
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.
Well I think we should at least use notify(:message, "#{' ' * level}Minimizer: #{msg}")
, given the formatter has something designed for this sort of usage... I'm not totally opposed to the usage of the ENV variable if it's intended for "semi private" debugging use...
OK, @JonRowe, I pushed some improvements to the debug output. Check it out and let me know what you think. |
b04b4e9
to
f91d4a1
Compare
OK, I think I've taken this as far as I'm going to take it. Would be great to get a full review from @rspec/rspec folks. Anyone? One open question/issue: the some of the bisect specs (particularly those in
Notice that the bisect specs dominate the slow list! I'd really like to avoid having slow specs, but I'm not quite sure what to do. A few ideas:
|
...and the build is finally green. (That wasn't easy). |
end | ||
|
||
slice_size /= 2 | ||
combo_count *= 2 |
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.
Oddly I'd never considered that this would work, nice!
Actually I wonder if that would be better... It'd also involve less of the std lib... (we could even use a custom text output rather than a standard formatter to control communication) |
(Moving this comment from above because it's hidden since I pushed a fix to the docstring you commented on)
Flakey specs are likely to be poorly written and have global side effects. The question is what we should do about them. The bisect feature is trying to find a command that will cause the same set of failures as you started with. For each spec run, it compares what failed against the original set of failures to see if it was able to get that set of failures again. If so, it means the examples that were not included in the current run can be removed from the set of remaining ids to consider. Originally, we used a simple We could perhaps do something else with flapping failures (suggestions?) but if they aren't flapping based on an ordering dependency then it's not what bisect is good at working with anyway. The important thing in my mind is that we don't allow a flapping example or two to interfere with bisect being able to find a minimal repro command to get the same set of failures as the original run. Thoughts? |
Avoiding the useful bits of the stdlib has never been (and is still not) one of the goals of RSpec. As a courtesy to users we don way the tradeoffs involved in bringing in new stdlib bits, but as explained above, our use drb and open3 for bisect shouldn't be a concern at all -- the bisect logic (and those dependencies) will never be loaded in the same process as the user's code (unless they user is specifically requiring DRb is working really well for bisect, I think. |
Interesting. Seems like a good approach for what you were trying to accomplish but clearly wouldn't work here. |
127.0.0.1 is ipv4, whereas localhost should work for ipv4 and ipv6.
This allows it to be loaded by the bisect runner but if it’s loaded by other things it’ll notify by causing the “minimizes stdlibs” spec to fail.
Thanks for the review feedback, everyone. I think I've responded to all the feedback above (and/or pushed updates to address it). |
JRuby seems to intermittently fail with "Errno::EBADF: Bad file descriptor - Bad file descriptor"...but I have no idea what we can do about that other than retry the build :(. |
Yeah thats a regular flake |
Ship it! Makes sense re DRb, I didn't realise the two-way communication piece. Ditto re flakey specs, your reasoning is good, thanks for spelling it out for me :) |
@xaviershay thanks for the thorough review. Before merging this, I was wondering if you had any ideas to address this concern I mentioned above? Some of the bisect specs (particularly those in
Notice that the bisect specs dominate the slow list! I'd really like to avoid having slow specs, but I'm not quite sure what to do. A few ideas:
|
I wasn't sure that ENV vars would be propagated to spawned process properly, but no logic was required to make that work. I tried backticks and `system` as well and those also do the right thing. Given that, there's no need to keep this slow spec around. Revert "Add spec demonstrating that ENV vars are propagated properly." This reverts commit 45ed50c.
normalize_durations(formatter_output.string) | ||
end | ||
|
||
it 'finds the minimum rerun command and exits' do |
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.
In respect to your last comment, this could be a cucumber scenario (as it'd be useful documentation of the output).
- This surfaces the output to the user so they know what to expect based on reading the relish docs. - This greatly reduces the runtime of our spec suite, from ~11.8 seconds to ~6.9 seconds.
OK, I updated the specs/cukes based on @JonRowe's suggestions (which were good). I also decided to switch from |
LGTM |
@myronmarston Thanks for this! I just upgraded to 3.3 and feel like a kid in a candy shop right now 🍬 💯 |
@tmertens -- you're welcome! |
@myronmarston This is awesome! Thanks! |
This adds a new
--bisect
flag for #1767.TODOs:
rspec --bisect
process to the test suite runs.puts
orwarn
statements in the test suite, it will print output in the middle of the bisect progress output. We should silence it.NoMethodError
in adescribe
block or whatever), we don't surface that to the user.shuffle
in there...), we should detect that and bail with a clear error about the problem.--format progress
when running the suite but not-fp
. This should be fixed.ctrl-c
, they can still benefit from the work we've done up to that point.