Add assert_precondition helper and PRECONDITION_FAILED subtest status#16689
Add assert_precondition helper and PRECONDITION_FAILED subtest status#16689lukebjerring wants to merge 13 commits intoweb-platform-tests:masterfrom
Conversation
|
I think that I lost the review flag. If I still had it I would approve. |
|
This needs a testharness unittest, and a test in |
|
@jgraham I've fixed a bug and added two tests (infrastructure & resource tests). |
|
My only major concern about this is that it makes it impossible to tell the difference between "this test was disabled by the implementation e.g. for stability issues" and "this test was skipped because the feature is unsupported". That difference seems meaningful to me since you might want to audit tests that are disabled for instability, |
|
@jgraham - as agreed, switched the (subtest) status name to (Reasons: Using |
|
@jgraham - I'm seeing the mozlog error we'd expect:
|
| } | ||
| }, function(err) { | ||
| var supported = !err.toString().includes('not supported'); | ||
| assert_precondition(supported, algorithm.name + ' not implemented'); |
There was a problem hiding this comment.
I'll move the bikeshedding here, since I guess this PR will have the docs and testharness.js changes. What will the resulting message in the report be?
resources/testharness.js
Outdated
| expose(PreconditionFailedError, "PreconditionFailedError"); | ||
|
|
||
| PreconditionFailedError.prototype = Object.create(AssertionError.prototype); | ||
| PreconditionFailedError.prototype.constructor = PreconditionFailedError; |
There was a problem hiding this comment.
For some reason, new PreconditionFailedError('foo') instanceof AssertionError is false.
There was a problem hiding this comment.
The style of inheritence used here looks unfamiliar to me, is it used elsewhere in testharness.js and is instanceof correct in those cases?
There was a problem hiding this comment.
It's es5 "inheritance" and yes, AssertionError uses it for inheriting Error
There was a problem hiding this comment.
It's overriding Foo.prototype.constructor that looks unfamiliar. Maybe this pattern just isn't right, or is new AssertionError('foo') instanceof Error true?
There was a problem hiding this comment.
So, the issue was that the whole thing is in a closure. It uses expose to add the definitions to the global_scope. As a result, the references need to exist before calling expose, otherwise they'll refer to a local of the same name, and the globally resolved AssertionError is a different reference, thus instanceof is false. Fixed by declaring the types in the right order.
|
@jgraham @foolip I've run out of time to get this implemented past the testharness.js layer. Current state of this PR is that a PRECONDITION_FAILED result is successfully produced when loading the test running on |
|
@jgraham where is mozlog maintained? I presume this is a pretty simple fix and that most of the work is in the review and release step... |
|
It's in mozilla-central: https://searchfox.org/mozilla-central/source/testing/mozbase/mozlog/ |
|
I've filed https://bugzilla.mozilla.org/show_bug.cgi?id=1589056 to track this in mozlog. |
|
A review is up at https://phabricator.services.mozilla.com/D49450 |
|
I've filed #19844 to track this to completion, closing this PR. |
This depends on mozlog 5.0 for the new PRECONDITION_FAILED status: https://bugzilla.mozilla.org/show_bug.cgi?id=1589056 Implements web-platform-tests/rfcs#16. Includes parts of #16689. Fixes #19844.
This depends on mozlog 5.0 for the new PRECONDITION_FAILED status: https://bugzilla.mozilla.org/show_bug.cgi?id=1589056 Implements web-platform-tests/rfcs#16. Includes parts of #16689. Fixes #19844.
This depends on mozlog 5.0 for the new PRECONDITION_FAILED status: https://bugzilla.mozilla.org/show_bug.cgi?id=1589056 Implements web-platform-tests/rfcs#16. Includes parts of #16689. Fixes #19844.
This depends on mozlog 5.0 for the new PRECONDITION_FAILED status: https://bugzilla.mozilla.org/show_bug.cgi?id=1589056 Implements web-platform-tests/rfcs#16. Includes parts of #16689. Fixes #19844.
This depends on mozlog 5.0 for the new PRECONDITION_FAILED status: https://bugzilla.mozilla.org/show_bug.cgi?id=1589056 Implements web-platform-tests/rfcs#16. Includes parts of #16689. Fixes #19844.
This depends on mozlog 5.0 for the new PRECONDITION_FAILED status: https://bugzilla.mozilla.org/show_bug.cgi?id=1589056 Implements web-platform-tests/rfcs#16. Includes parts of #16689. Fixes #19844.
This depends on mozlog 5.0 for the new PRECONDITION_FAILED status: https://bugzilla.mozilla.org/show_bug.cgi?id=1589056 Implements web-platform-tests/rfcs#16. Includes parts of #16689. Fixes #19844.
This depends on mozlog 5.0 for the new PRECONDITION_FAILED status: https://bugzilla.mozilla.org/show_bug.cgi?id=1589056 Implements web-platform-tests/rfcs#16. Includes parts of #16689. Fixes #19844.
…ndition`, a=testonly Automatic update from web-platform-tests [testharness.js] introduce `assert_precondition` This depends on mozlog 5.0 for the new PRECONDITION_FAILED status: https://bugzilla.mozilla.org/show_bug.cgi?id=1589056 Implements web-platform-tests/rfcs#16. Includes parts of web-platform-tests/wpt#16689. Fixes web-platform-tests/wpt#19844. -- [vibration] use `assert_precondition` to avoid spurious pass This demonstrates the use of `assert_precondition` for subtests. -- wpt-commits: 17543bc30bdf65838e9ec8e3b3b6fd210dced66e, a90e89fb031b0b357305ac9d874968d8451b1181 wpt-pr: 19993
…ndition`, a=testonly Automatic update from web-platform-tests [testharness.js] introduce `assert_precondition` This depends on mozlog 5.0 for the new PRECONDITION_FAILED status: https://bugzilla.mozilla.org/show_bug.cgi?id=1589056 Implements web-platform-tests/rfcs#16. Includes parts of web-platform-tests/wpt#16689. Fixes web-platform-tests/wpt#19844. -- [vibration] use `assert_precondition` to avoid spurious pass This demonstrates the use of `assert_precondition` for subtests. -- wpt-commits: 17543bc30bdf65838e9ec8e3b3b6fd210dced66e, a90e89fb031b0b357305ac9d874968d8451b1181 wpt-pr: 19993
…ndition`, a=testonly Automatic update from web-platform-tests [testharness.js] introduce `assert_precondition` This depends on mozlog 5.0 for the new PRECONDITION_FAILED status: https://bugzilla.mozilla.org/show_bug.cgi?id=1589056 Implements web-platform-tests/rfcs#16. Includes parts of web-platform-tests/wpt#16689. Fixes web-platform-tests/wpt#19844. -- [vibration] use `assert_precondition` to avoid spurious pass This demonstrates the use of `assert_precondition` for subtests. -- wpt-commits: 17543bc30bdf65838e9ec8e3b3b6fd210dced66e, a90e89fb031b0b357305ac9d874968d8451b1181 wpt-pr: 19993 UltraBlame original commit: 9b458e91114235eb43711dbac7a3acfe30c83fce
…ndition`, a=testonly Automatic update from web-platform-tests [testharness.js] introduce `assert_precondition` This depends on mozlog 5.0 for the new PRECONDITION_FAILED status: https://bugzilla.mozilla.org/show_bug.cgi?id=1589056 Implements web-platform-tests/rfcs#16. Includes parts of web-platform-tests/wpt#16689. Fixes web-platform-tests/wpt#19844. -- [vibration] use `assert_precondition` to avoid spurious pass This demonstrates the use of `assert_precondition` for subtests. -- wpt-commits: 17543bc30bdf65838e9ec8e3b3b6fd210dced66e, a90e89fb031b0b357305ac9d874968d8451b1181 wpt-pr: 19993 UltraBlame original commit: 9b458e91114235eb43711dbac7a3acfe30c83fce
…ndition`, a=testonly Automatic update from web-platform-tests [testharness.js] introduce `assert_precondition` This depends on mozlog 5.0 for the new PRECONDITION_FAILED status: https://bugzilla.mozilla.org/show_bug.cgi?id=1589056 Implements web-platform-tests/rfcs#16. Includes parts of web-platform-tests/wpt#16689. Fixes web-platform-tests/wpt#19844. -- [vibration] use `assert_precondition` to avoid spurious pass This demonstrates the use of `assert_precondition` for subtests. -- wpt-commits: 17543bc30bdf65838e9ec8e3b3b6fd210dced66e, a90e89fb031b0b357305ac9d874968d8451b1181 wpt-pr: 19993 UltraBlame original commit: 9b458e91114235eb43711dbac7a3acfe30c83fce
…ndition`, a=testonly Automatic update from web-platform-tests [testharness.js] introduce `assert_precondition` This depends on mozlog 5.0 for the new PRECONDITION_FAILED status: https://bugzilla.mozilla.org/show_bug.cgi?id=1589056 Implements web-platform-tests/rfcs#16. Includes parts of web-platform-tests/wpt#16689. Fixes web-platform-tests/wpt#19844. -- [vibration] use `assert_precondition` to avoid spurious pass This demonstrates the use of `assert_precondition` for subtests. -- wpt-commits: 17543bc30bdf65838e9ec8e3b3b6fd210dced66e, a90e89fb031b0b357305ac9d874968d8451b1181 wpt-pr: 19993

Prototyping/exploring web-platform-tests/rfcs#16