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

Refactor and split up with variant all encoding tests #11016

Merged
merged 8 commits into from May 31, 2018

Conversation

zcorpan
Copy link
Member

@zcorpan zcorpan commented May 15, 2018

Fixes #11015.

@zcorpan
Copy link
Member Author

zcorpan commented May 15, 2018

I'll apply this to the rest of the encoding tests tomorrow if this seems OK.

if (location.search) {
match = /^\?(\d+)-(\d+|last)(?:&|$)/.exec(location.search);
if (match) {
subTestStart = match[1];
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: parseFloat(match[1]) or parseInt(match[1], 10)

Copy link
Contributor

Choose a reason for hiding this comment

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

rather than relying on string/number comparison later on. (Of course, it's all per spec, so totally optional)

if (match) {
subTestStart = match[1];
if (match[2] !== "last") {
subTestEnd = match[2];
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

@@ -0,0 +1,27 @@
// Only test a subset of tests with, e.g., ?1-10 in the URL
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add that this works well with the <meta name="variant" ... > mechanism ?

<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="big5_index.js"></script>
<script src="big5-encoder.js"></script>
<script src="/common/subset-tests.js"></script>
Copy link
Contributor

Choose a reason for hiding this comment

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

Just as a style thing, I'd expect /common/ scripts to be listed under /resources/ and before the module- or test-specific scripts.

Copy link
Member Author

Choose a reason for hiding this comment

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

Utility code is usually in common I think. I can move the <script> though.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, sorry, I just meant the script tag

@@ -0,0 +1,27 @@
// Only test a subset of tests with, e.g., ?1-10 in the URL
// Sample usage:
// let currentSubTest = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm... so every test is going to end up with this sample usage. What do you think about altering (or adding) the API to take care of this, i.e. just exposing a function (e.g. "subsetTest") that takes a closure, which handles the counter/test for the author?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is more flexible and more straightforward to apply to existing tests, since it can vary a lot how tests are being set up. But maybe we can support both somehow...

@jimsch
Copy link
Contributor

jimsch commented May 15, 2018

If this is going to become a common function rather than restricted to a single set of code, I worry about the fact that others are going to want to be able to do both multiple types of variants and combined variants together so that you say one of and one of That means you might need to have a more complicated parsing function

@zcorpan
Copy link
Member Author

zcorpan commented May 16, 2018

I made the parsing function support & so it can be combined with something else in the query string.

@jimsch
Copy link
Contributor

jimsch commented May 16, 2018

Looks like it must be the first one however. Should the match be

/^(?|&)(\d+)-(\d+|last)(?:&|$)/

@zcorpan
Copy link
Member Author

zcorpan commented May 16, 2018

OK I have addressed the comments, PTAL

@annevk
Copy link
Member

annevk commented May 16, 2018

Should this land together with the Web Crypto changes? Definitely need a different commit message in that case.

It'd be good to document common/subset-tests.js in the documentation. So that when people read about variant (or more likely, forget how it works) they also learn about this.

@zcorpan
Copy link
Member Author

zcorpan commented May 16, 2018

Should this land together with the Web Crypto changes? Definitely need a different commit message in that case.

That is now #11028

documentation

I'll look into that now.

@zcorpan zcorpan added the flaky label May 16, 2018
@zcorpan zcorpan force-pushed the zcorpan/encoding-big5-slow branch from f461d73 to 0e57a45 Compare May 24, 2018 15:28
@zcorpan zcorpan changed the title Split up big5-encode-form-errors-extB{a,b}.html with variant Refactor and split up with variant all encoding tests May 24, 2018
@zcorpan
Copy link
Member Author

zcorpan commented May 24, 2018

I've overhauled almost all encoding tests. This is ready for review. I might have made some copy-paste mistake somewhere.

@annevk
Copy link
Member

annevk commented May 24, 2018

Could you explain the methodology behind these changes?

@zcorpan
Copy link
Member Author

zcorpan commented May 24, 2018

I noticed that there was a lot of common code so I moved it to separate js files and then modified it with the things that needed to vary between tests until I got the same passrate as on master.

@annevk
Copy link
Member

annevk commented May 25, 2018

Thanks, that sounds pretty great. Can you put the non-test resources in a resources/ directory? The other thing I hope we can do at some point is remove the need for normalizeStr, but that'll be easier with this change.

Does this not accidentally revert the removal of normalizeStr I did so far?

@zcorpan
Copy link
Member Author

zcorpan commented May 25, 2018

It probably does, will fix

@zcorpan
Copy link
Member Author

zcorpan commented May 29, 2018

@annevk PTAL

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

Thanks for doing this. I haven't verified before and after for all of these, but I believe you have, and you covered all the gotchas I could think of.

These tests still make me a little angsty given how much code is involved, but this makes it a lot better.

@zcorpan
Copy link
Member Author

zcorpan commented May 29, 2018

Hmm, http://web-platform.test:8000/encoding/legacy-mb-japanese/iso-2022-jp/iso2022jp-encode-form-csiso2022jp.html has this difference in test names:

master zcorpan/encoding-big5-slow
U+A5 ¥ %1B%28%4A%5C U+A5 ¥ %1B%28%4A%5C%1B%28%42

Is that ok?

@annevk
Copy link
Member

annevk commented May 30, 2018

That seems fine, but do you know why it happens?

@zcorpan
Copy link
Member Author

zcorpan commented May 31, 2018

master has normalizeStr(item.expected) instead of just item.expected for the test name for that test. Do you have a preference? We could leave out expected from the test name altogether.

@annevk
Copy link
Member

annevk commented May 31, 2018

Ah, this was removed because of return result.replace(/%1B%28%42$/, "");. I guess I'm fine with your result then.

@zcorpan
Copy link
Member Author

zcorpan commented May 31, 2018

The chrome and firefox builds failed, but i suppose that's because it's many slow tests.

@zcorpan zcorpan merged commit d6c29be into master May 31, 2018
@zcorpan zcorpan deleted the zcorpan/encoding-big5-slow branch May 31, 2018 14:01
aarongable pushed a commit to chromium/chromium that referenced this pull request Jun 11, 2018
The tests have been split in the upstream and should no longer time out:
web-platform-tests/wpt#11016
web-platform-tests/wpt#11292

Bug: 736056
Change-Id: I2267ffb05e8c74c5d70bd6d8a4020bb24c78bd0c
Reviewed-on: https://chromium-review.googlesource.com/1081123
Reviewed-by: Philip Jägenstedt <foolip@chromium.org>
Commit-Queue: Robert Ma <robertma@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565995}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants