Skip to content

Use blessings when possible for WPT UI - #8551

Merged
bors-servo merged 1 commit into
servo:masterfrom
mrobinson:blessings
Nov 17, 2015
Merged

bors-servo merged 1 commit into
servo:masterfrom
mrobinson:blessings

Conversation

@mrobinson

Copy link
Copy Markdown
Member

Use blessings when it is possible for the WPT UI and fall back to using
raw control characters. This also fixes a bug where the UI didn't work
correctly in iTerm.app. Remove the one line version of the UI, since it
is no longer used as the iTerm fallback.

Review on Reviewable

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Nov 16, 2015
@mrobinson

Copy link
Copy Markdown
Member Author

@jdm or @jgraham r?

Comment thread tests/wpt/grouping_formatter.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we make this except ImportError just so we silence+catch all exceptions in case one occurs from something else?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The idea here was that if the import failed, if creating the Terminal failed, or if the __getattr__ call in blessings fails (which just calls into curses), we should always fall back. If you like I can split the work into two try/except blocks and print an error in the second one.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

try and except with no condition is never a good idea; even except Exception: is better because it won't catch KeyboardInterrupt. In this case I agree that splitting into two blocks is a better idea.

@jgraham

jgraham commented Nov 17, 2015

Copy link
Copy Markdown
Contributor

Reviewed 1 of 1 files at r1.
Review status: all files reviewed at latest revision, 1 unresolved discussion.


Comments from the review on Reviewable.io

@mrobinson

Copy link
Copy Markdown
Member Author

Review status: all files reviewed at latest revision, 1 unresolved discussion.


tests/wpt/grouping_formatter.py, line 33 [r1] (raw file):
Done.


Comments from the review on Reviewable.io

@jgraham

jgraham commented Nov 17, 2015

Copy link
Copy Markdown
Contributor

Reviewed 1 of 1 files at r2.
Review status: all files reviewed at latest revision, 3 unresolved discussions.


tests/wpt/grouping_formatter.py, line 53 [r2] (raw file):
Factor out the default values here and below


tests/wpt/grouping_formatter.py, line 58 [r2] (raw file):
use Exception as exception (or I prefer Exception as e)


Comments from the review on Reviewable.io

Comment thread tests/wpt/grouping_formatter.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This probably needs a \n since write doesn't add one

@jgraham

jgraham commented Nov 17, 2015

Copy link
Copy Markdown
Contributor

Review status: all files reviewed at latest revision, 4 unresolved discussions.


tests/wpt/grouping_formatter.py, line 60 [r2] (raw file):
Actually I'm not sure this line doesn't do more harm than good since it causes a warning message that can't go through the mozlog infrastructure. I'd be inclined just to delete it.


Comments from the review on Reviewable.io

@mrobinson

Copy link
Copy Markdown
Member Author

Review status: all files reviewed at latest revision, 4 unresolved discussions.


tests/wpt/grouping_formatter.py, line 60 [r2] (raw file):
I think it's still useful since it allows us to improve the script if there are problems finding the appropriate control codes. If it's deleted, I believe that the two try/except blocks should be merged. There isn't any point in isolated ImportError when we respond to all exceptions in the same way.


Comments from the review on Reviewable.io

Use blessings when it is possible for the WPT UI and fall back to using
raw control characters. This also fixes a bug where the UI didn't work
correctly in iTerm.app. Remove the one line version of the UI, since it
is no longer used as the iTerm fallback.
@mrobinson

Copy link
Copy Markdown
Member Author

Review status: all files reviewed at latest revision, 4 unresolved discussions.


tests/wpt/grouping_formatter.py, line 53 [r2] (raw file):
Done.


tests/wpt/grouping_formatter.py, line 58 [r2] (raw file):
Done.


Comments from the review on Reviewable.io

@jgraham

jgraham commented Nov 17, 2015

Copy link
Copy Markdown
Contributor

Reviewed 1 of 1 files at r3.
Review status: all files reviewed at latest revision, 2 unresolved discussions.


tests/wpt/grouping_formatter.py, line 60 [r2] (raw file):
I guess it's probably OK like this, but it's not ideal.


Comments from the review on Reviewable.io

@mrobinson

Copy link
Copy Markdown
Member Author

Review status: all files reviewed at latest revision, 2 unresolved discussions.


tests/wpt/grouping_formatter.py, line 60 [r2] (raw file):
If you have a better approach for sending the error through machformatter, I'll be happy to implement it. I considered recording it and logging it after the logger was initialized, but that seemed a bit convoluted.


Comments from the review on Reviewable.io

@jgraham

jgraham commented Nov 17, 2015

Copy link
Copy Markdown
Contributor

@bors-servo: r+

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 7225e36 has been approved by jgraham

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Nov 17, 2015
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 7225e36 with merge d7c98f8...

bors-servo pushed a commit that referenced this pull request Nov 17, 2015
Use blessings when possible for WPT UI

Use blessings when it is possible for the WPT UI and fall back to using
raw control characters. This also fixes a bug where the UI didn't work
correctly in iTerm.app. Remove the one line version of the UI, since it
is no longer used as the iTerm fallback.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8551)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, gonk, linux-dev, linux-rel, mac-dev-ref-unit, mac-rel-css, mac-rel-wpt

@bors-servo
bors-servo merged commit 7225e36 into servo:master Nov 17, 2015
@mrobinson
mrobinson deleted the blessings branch November 17, 2015 18:36

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

clear_eol and move_up are in the wrong order :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Excellent detective work @salty-horse 👍

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Nice catch!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@salty-horse You going to open a PR to fix it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Will do. Can I put my other suggestion in a separate commit in the same PR?

bors-servo pushed a commit that referenced this pull request Dec 7, 2015
Fix redraw of WPT UI output, and slightly improve line counting

See discussion in PR #8551.

Redraw of the first test name was broken due to a mix-up between two ANSI escape codes.
I also took the opportunity to change the way line count is calculated. It's a bit cleaner that way (the new operation is ~%20 faster, but that's unnoticeable).

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8861)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants