Skip to content

Add assert_precondition helper and PRECONDITION_FAILED subtest status#16689

Closed
lukebjerring wants to merge 13 commits intoweb-platform-tests:masterfrom
lukebjerring:skip
Closed

Add assert_precondition helper and PRECONDITION_FAILED subtest status#16689
lukebjerring wants to merge 13 commits intoweb-platform-tests:masterfrom
lukebjerring:skip

Conversation

@lukebjerring
Copy link
Contributor

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

@jimsch jimsch marked this pull request as ready for review May 8, 2019 20:31
@jimsch
Copy link
Contributor

jimsch commented May 8, 2019

I think that I lost the review flag. If I still had it I would approve.

@jgraham
Copy link
Contributor

jgraham commented May 13, 2019

This needs a testharness unittest, and a test in infrastructure/. I would expect the latter to ERROR until we get changes in mozlog (and maybe wptrunner) to handle the new status. Since we're using mozlog from PyPI this will also block on getting a new mozlog release.

@wpt-pr-bot wpt-pr-bot added the wptrunner The automated test runner, commonly called through ./wpt run label Jun 7, 2019
@wpt-pr-bot wpt-pr-bot requested a review from jugglinmike June 7, 2019 21:58
@Hexcles
Copy link
Member

Hexcles commented Jun 7, 2019

@jgraham I've fixed a bug and added two tests (infrastructure & resource tests).

@jgraham
Copy link
Contributor

jgraham commented Jul 16, 2019

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,

@lukebjerring lukebjerring changed the title Add test.skip helper and SKIP subtest status Add test.skip helper and PRECONDITION_FAILED subtest status Aug 15, 2019
@lukebjerring
Copy link
Contributor Author

@jgraham - as agreed, switched the (subtest) status name to PRECONDITION_FAILED.

(Reasons: Using SKIP would be ambiguous with already-supported test-level skippage/disable behaviour, and renaming existing SKIP to something else would be a major headache).

@wpt-pr-bot wpt-pr-bot requested a review from foolip August 28, 2019 17:59
@lukebjerring lukebjerring changed the title Add test.skip helper and PRECONDITION_FAILED subtest status Add assert_precondition helper and PRECONDITION_FAILED subtest status Aug 28, 2019
@lukebjerring
Copy link
Contributor Author

lukebjerring commented Aug 30, 2019

@jgraham - I'm seeing the mozlog error we'd expect:

ValueError: Failed to convert value PRECONDITION_FAILED of type str for field status to type SubStatus

https://tools.taskcluster.net/groups/RGFPhLFqRGqvPXAaRXcmGA/tasks/TzNbxq2bTrWslrAGvcfsuA/runs/0/logs/public%2Flogs%2Flive.log#L846

Luke Bjerring and others added 2 commits September 19, 2019 16:25
}
}, function(err) {
var supported = !err.toString().includes('not supported');
assert_precondition(supported, algorithm.name + ' not implemented');
Copy link
Member

Choose a reason for hiding this comment

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

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, can actually answer this now that I've fixed it. It's the message in the second param to assert_precondition, e.g.

image

(bad alignment notwithstanding)

expose(PreconditionFailedError, "PreconditionFailedError");

PreconditionFailedError.prototype = Object.create(AssertionError.prototype);
PreconditionFailedError.prototype.constructor = PreconditionFailedError;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For some reason, new PreconditionFailedError('foo') instanceof AssertionError is false.

Copy link
Member

Choose a reason for hiding this comment

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

The style of inheritence used here looks unfamiliar to me, is it used elsewhere in testharness.js and is instanceof correct in those cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's es5 "inheritance" and yes, AssertionError uses it for inheriting Error

Copy link
Member

Choose a reason for hiding this comment

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

It's overriding Foo.prototype.constructor that looks unfamiliar. Maybe this pattern just isn't right, or is new AssertionError('foo') instanceof Error true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

@lukebjerring
Copy link
Contributor Author

@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 ./wpt serve, but that status is unrecognized (so unrecorded) by the wpt runner / mozlog side.

@foolip
Copy link
Member

foolip commented Oct 10, 2019

@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...

@jgraham
Copy link
Contributor

jgraham commented Oct 16, 2019

@foolip
Copy link
Member

foolip commented Oct 16, 2019

I've filed https://bugzilla.mozilla.org/show_bug.cgi?id=1589056 to track this in mozlog.

@foolip
Copy link
Member

foolip commented Oct 17, 2019

A review is up at https://phabricator.services.mozilla.com/D49450

@foolip
Copy link
Member

foolip commented Oct 23, 2019

I've filed #19844 to track this to completion, closing this PR.

@foolip foolip closed this Oct 23, 2019
@foolip foolip deleted the skip branch October 25, 2019 12:53
foolip added a commit that referenced this pull request Oct 30, 2019
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.
foolip added a commit that referenced this pull request Oct 30, 2019
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.
foolip added a commit that referenced this pull request Oct 30, 2019
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.
foolip added a commit that referenced this pull request Nov 2, 2019
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.
foolip added a commit that referenced this pull request Nov 6, 2019
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.
foolip added a commit that referenced this pull request Nov 6, 2019
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.
foolip added a commit that referenced this pull request Nov 8, 2019
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.
foolip added a commit that referenced this pull request Nov 8, 2019
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.
@foolip
Copy link
Member

foolip commented Nov 8, 2019

Parts of this was landed in #19993 and the test changes are in #20173 + #20176.

moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Nov 29, 2019
…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
xeonchen pushed a commit to xeonchen/gecko that referenced this pull request Nov 29, 2019
…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
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Nov 30, 2019
…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
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Nov 30, 2019
…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
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Nov 30, 2019
…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
bhearsum pushed a commit to mozilla-releng/staging-firefox that referenced this pull request May 1, 2025
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants