Skip to content

tests: handle onAbort as well as onExit in browser_reporting.js - #13631

Merged
sbc100 merged 1 commit into
mainfrom
fix_btest_assert
Mar 11, 2021
Merged

sbc100 merged 1 commit into
mainfrom
fix_btest_assert

Conversation

@sbc100

@sbc100 sbc100 commented Mar 10, 2021 •

Copy link
Copy Markdown
Collaborator

This fixes the problem that assert/abort was not being reporting during
btest_exit.

As a followup we probably want also want make sure we handle all JS
and C++ exceptions in some way too, but this is still a good fix on its
own.

Fixes: #13628

@sbc100
sbc100 requested review from RReverser and kripken March 10, 2021 01:20
@sbc100
sbc100 force-pushed the fix_btest_assert branch from a330e18 to 4e412e7 Compare March 10, 2021 01:22
@RReverser

Copy link
Copy Markdown
Collaborator

This is great!

As a followup we probably want also want to handle all JS exceptions in
some way too, but this is still a good fix on its own.

Btw, what happens to C++ exceptions at the moment - I know they throw on the JS side, but do they become regular JS exceptions or also go via abort?

@sbc100

sbc100 commented Mar 10, 2021

Copy link
Copy Markdown
Collaborator Author

This is great!

As a followup we probably want also want to handle all JS exceptions in
some way too, but this is still a good fix on its own.

Btw, what happens to C++ exceptions at the moment - I know they throw on the JS side, but do they become regular JS exceptions or also go via abort?

Good question, I'm not sure about that. I think it would be good if both C++ and JS exceptions also reported SIGABORT in the onExit handler for the purposed of btest_exit. We can look into that as a followup.

@sbc100
sbc100 force-pushed the fix_btest_assert branch 2 times, most recently from 5b16bcc to c813d22 Compare March 10, 2021 03:04
@kripken

kripken commented Mar 10, 2021

Copy link
Copy Markdown
Member

Sorry, looks like the code here is included in another PR (#13632) and I read that one first, and commented there already, but the comment is relevant more for this one.

@sbc100

sbc100 commented Mar 10, 2021

Copy link
Copy Markdown
Collaborator Author

Sorry, looks like the code here is included in another PR (#13632) and I read that one first, and commented there already, but the comment is relevant more for this one.

"""
This is an increase in default code size as by default we do receive onExit. That's unfortunate as we should try to have fewer of these things rather than more. But i can't find a way around that, if we want to fix this - we can't gate it on ASSERTIONS or anything like that.

Do you think this is strongly worth fixing in general? If the main reason is the test suite issue, I think we can fix that by adding Module.onAbort alongside Module.onExit which we already have in runner.py. That would avoid a code size increase.
"""

Ok I'll give the onAbort approach at try.

@sbc100
sbc100 force-pushed the fix_btest_assert branch from c813d22 to 2a41e85 Compare March 10, 2021 19:25
@sbc100 sbc100 changed the title Call onExit callback on abort tests: handle onAbort as onExit in browser_reporting.js Mar 10, 2021
@sbc100
sbc100 force-pushed the fix_btest_assert branch from 2a41e85 to f1725db Compare March 10, 2021 20:15
@sbc100 sbc100 changed the title tests: handle onAbort as onExit in browser_reporting.js tests: handle onAbort as well as onExit in browser_reporting.js Mar 10, 2021
@sbc100
sbc100 force-pushed the fix_btest_assert branch from f1725db to 93bdb3e Compare March 10, 2021 21:21
@RReverser

Copy link
Copy Markdown
Collaborator

I'm missing some context, why is it a code size increase in its previous form?

Comment thread src/preamble.js Resolved
Comment thread tests/pthread/main_thread_wait.cpp Resolved
@kripken

kripken commented Mar 10, 2021

Copy link
Copy Markdown
Member

I'm missing some context, why is it a code size increase in its previous form?

It added a little code to check for onAbort existing, and calling it if it does. That code didn't exist before.

@sbc100
sbc100 force-pushed the fix_btest_assert branch from 93bdb3e to 4b4792f Compare March 10, 2021 21:43
sbc100 added a commit that referenced this pull request Mar 10, 2021
I can't say I understand this test well enough to know how it was
passing before but this seems like it is clearly a typo.

Without this change the test happens to occationally generate
abort(CompileError bad magic number) error at least some of the time.
These abort() don't see to cause the test to fail but I have another
chnage the makes the test runner more sensitive to abort() exceptions
propogating all the way out: #13631

Fixing this typo seems to make these aborts go away.
@RReverser

Copy link
Copy Markdown
Collaborator

It added a little code to check for onAbort existing, and calling it if it does. That code didn't exist before.

Ah, right. I assumed you mean code size increase at a different scale :)

@kripken kripken left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The changes to preamble.js look unrelated? (if not, how do they relate?)

Comment thread tests/pthread/main_thread_wait.cpp Resolved
@sbc100

sbc100 commented Mar 11, 2021

Copy link
Copy Markdown
Collaborator Author

The changes to preamble.js look unrelated? (if not, how do they relate?)

There are 2 changes to preamble. The extra return prevents onObort from firing then WASM=2 mode redirects from wasm to JS (we don't want this to count as an actual abort.

The change from 1 to 134 for the EXITSTATUS of abort is unrelated but also I think a better choice. 134 is what linux and other unixs will return on abort() and it avoids confusion with valid exit codes (or which 1 is certainly one). This was an essential part of the earlier version. If you prefer, since its unneeded for this particular change, I can revert.

@kripken kripken left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm % comments

Comment thread src/preamble.js Resolved
Comment thread tests/browser_reporting.js Resolved
Comment thread tests/test_browser.py Resolved
sbc100 added a commit that referenced this pull request Mar 11, 2021
I can't say I understand this test well enough to know how it was
passing before but this seems like it is clearly a typo.

Without this change the test happens to occasionally generate
abort(CompileError bad magic number) error at least some of the time.
These abort() don't see to cause the test to fail but I have another
change the makes the test runner more sensitive to abort() exceptions
propagating all the way out: #13631

Fixing this typo seems to make these aborts go away.
@sbc100
sbc100 force-pushed the fix_btest_assert branch from 953d024 to 6296714 Compare March 11, 2021 05:42
@sbc100
sbc100 enabled auto-merge (squash) March 11, 2021 18:03
@sbc100
sbc100 force-pushed the fix_btest_assert branch from 6296714 to 854f129 Compare March 11, 2021 18:04
This fixes the problem that assert/abort was not being reporting during
btest_exit.

As a followup we probably want also want make sure we handle all JS
and C++ exceptions in some way too, but this is still a good fix on its
own.

Fixes: #13628
@sbc100
sbc100 force-pushed the fix_btest_assert branch from 854f129 to a8a89a8 Compare March 11, 2021 18:05
@sbc100
sbc100 merged commit 4d93ede into main Mar 11, 2021
@sbc100
sbc100 deleted the fix_btest_assert branch March 11, 2021 18:45
RReverser added a commit that referenced this pull request Mar 11, 2021
Thanks to #13631, we can now test against plain assert messages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assertions don't fail browser tests

3 participants