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
Conversation
I'll apply this to the rest of the encoding tests tomorrow if this seems OK. |
common/subset-tests.js
Outdated
if (location.search) { | ||
match = /^\?(\d+)-(\d+|last)(?:&|$)/.exec(location.search); | ||
if (match) { | ||
subTestStart = match[1]; |
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.
nit: parseFloat(match[1]) or parseInt(match[1], 10)
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.
rather than relying on string/number comparison later on. (Of course, it's all per spec, so totally optional)
common/subset-tests.js
Outdated
if (match) { | ||
subTestStart = match[1]; | ||
if (match[2] !== "last") { | ||
subTestEnd = match[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.
ditto
common/subset-tests.js
Outdated
@@ -0,0 +1,27 @@ | |||
// Only test a subset of tests with, e.g., ?1-10 in the URL |
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.
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> |
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.
Just as a style thing, I'd expect /common/ scripts to be listed under /resources/ and before the module- or test-specific scripts.
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.
Utility code is usually in common I think. I can move the <script>
though.
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.
Yeah, sorry, I just meant the script tag
common/subset-tests.js
Outdated
@@ -0,0 +1,27 @@ | |||
// Only test a subset of tests with, e.g., ?1-10 in the URL | |||
// Sample usage: | |||
// let currentSubTest = 0; |
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.
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?
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 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...
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 |
I made the parsing function support |
Looks like it must be the first one however. Should the match be /^(?|&)(\d+)-(\d+|last)(?:&|$)/ |
OK I have addressed the comments, PTAL |
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. |
5e452bd
to
6af573f
Compare
6af573f
to
cc994a7
Compare
That is now #11028
I'll look into that now. |
f461d73
to
0e57a45
Compare
variant
variant
all encoding tests
I've overhauled almost all encoding tests. This is ready for review. I might have made some copy-paste mistake somewhere. |
Could you explain the methodology behind these changes? |
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. |
Thanks, that sounds pretty great. Can you put the non-test resources in a Does this not accidentally revert the removal of |
It probably does, will fix |
@annevk PTAL |
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.
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.
Hmm, http://web-platform.test:8000/encoding/legacy-mb-japanese/iso-2022-jp/iso2022jp-encode-form-csiso2022jp.html has this difference in test names:
Is that ok? |
That seems fine, but do you know why it happens? |
master has |
Ah, this was removed because of |
The chrome and firefox builds failed, but i suppose that's because it's many slow tests. |
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}
Fixes #11015.