-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Fix flipped argument state #12005
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
Fix flipped argument state #12005
Conversation
66ce0da
to
56c3d8d
Compare
@gottesmm Would you mind giving this a quick once-over before I merge? |
@@ -194,6 +194,7 @@ def _apply_default_arguments(args): | |||
|
|||
# If none of tests specified skip swift stdlib test on all platforms | |||
if not args.test and not args.validation_test and not args.long_test: | |||
print('not testing') |
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.
Whoops, left in a print statement. I'll remove that.
@Rostepher give me a little bit. I am in some meetings today = (. |
@gottesmm No problem, just let me know when you've had a chance to look at it. Thanks! |
@swift-ci please smoke test |
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.
A few remarks. Also can you split out the sorting/etc into a different commit. This should be just about fixing the specific bug. If you want to change the order/layout of things please do that in a different commit so that I can review only the important things via the diff.
if parsed and defaulting to False otherwise. | ||
""" | ||
|
||
pass |
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.
Question. Is pass supposed to be on this line according to flake8? I thought it was supposed to be right after the """
@@ -260,7 +293,7 @@ class UnsupportedOption(_BaseOption): | |||
"""Option that is not supported.""" | |||
|
|||
def __init__(self, *args, **kwargs): | |||
kwargs['dest'] = kwargs.pop('dest', None) | |||
kwargs['dest'] = kwargs.get('dest', None) |
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.
I still hate this. Can you just do this:
if 'dest' not in kwargs:
kwargs['dest'] = None
@@ -270,7 +303,9 @@ class IgnoreOption(_BaseOption): | |||
generated. | |||
""" | |||
|
|||
pass | |||
def __init__(self, *args, **kwargs): | |||
kwargs['dest'] = kwargs.get('dest', None) |
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.
Same here.
pass | ||
|
||
|
||
class EnableOption(_BaseOption): |
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.
Can you leave any shuffling to a different commit. This is going to be difficult to review.
With my review, I stopped due to the moving around of code. Please fix that and then I will relook. |
710a5a2
to
9b672e8
Compare
@swift-ci test |
Build failed |
Build failed |
@swift-ci test Linux |
Build failed |
9b672e8
to
3d33634
Compare
@swift-ci please smoke test |
@swift-ci please test |
…d Disable variants, properly handling optional boolean arguments and inverting the state for disabled options. Previously when an option such as '--skip-build-benchmarks' was passed with a boolean the destination would take on the value without inverting the state, which was causing some build configuration errors.
3d33634
to
edb4daf
Compare
@swift-ci please smoke test |
@gottesmm Would you mind taking a look over this fix again. I've removed the test changes for now. I'll add those in a follow-up PR, I'd rather get this merged first to avoid any unexpected regressions. |
LGTM |
Purpose
This PR resolves issue SR-5911. My previous PR #11952 changed the internal 'destinations' for all the
--skip-build-*
and--skip-test-*
flags from the formskip_build_*
andskip_test_*
to the affirmativebuild_*
andtest_*
. When swapping those states I failed to account for the more advanced optional boolean behavior on each of these skip flags. It is possible for many flags to accept an optional boolean state to toggle them on or off manually, with skip flags it can be rather confusing since--skip-build-benchmarks True
means that we should not build benchmarks. Before this fix the optional boolean was being directly set on these new inverted destinations, thus--skip-build-benchmarks True
was setting the destinationbuild_benchmarks
toTrue
rather than the expectedFalse
.In addition to fixing the erroneous behavior I've also taken the liberty to revamp the testing suite again making a more clear distinction between flags that accept optional booleans, those that only toggle the stateTrue
orFalse
and those that store constant values. The test suite now covers all these cases and has more strict testing for their edge cases.A small note for reviewers, there's a lot of noise in the testing suite dealing with parsing arguments. To accurately test that each flag accepts the expected argument values and acts accordingly it was necessary to be able to parse flags without applying the defaults. Thus there's now the methodsparse_args
andparse_default_args
on the main test case class.rdar://34526897