Improve consistently of test output checking. NFC - #27267
Merged
Conversation
- Then testing using `hello_world.c` using `do_runf_out_file` rather than duplicating the expected string. - Add `done\n` to a few more tests (its good to test at least something is printed in general I think). - Move the `expected_output=None` default to the low level `_build_and_run` function.
kripken
reviewed
Jul 8, 2026
| self.set_setting('ALLOW_MEMORY_GROWTH', '1') | ||
| self.set_setting('MAXIMUM_MEMORY', '4GB') | ||
| self.do_runf('hello_world.c') | ||
| self.do_runf_out_file('hello_world.c') |
Collaborator
Author
There was a problem hiding this comment.
do_runf with empty expections does not check the output of the program. So any output at all (or none at all) will pass.
With do_runf_out_file the output has to match the hello_world.out file.
|
|
||
| def test_modularize_legacy(self): | ||
| self.do_runf('hello_world.c', cflags=['-sMODULARIZE', '-sLEGACY_VM_SUPPORT']) | ||
| self.do_runf_out_file('hello_world.c', cflags=['-sMODULARIZE', '-sLEGACY_VM_SUPPORT', '--extern-post-js', test_file('modularize_post_js.js')]) |
Member
There was a problem hiding this comment.
Why is this adading a new post-js?
Collaborator
Author
There was a problem hiding this comment.
Because without this the -sMODULARIZE code basically does nothing on startup :(
So this test was not testing anything.
This is a good reason never to have empty output expectations, since they pass when no code runs at all.
kripken
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
hello_world.cusingdo_runf_out_filerather than duplicating the expected string.done\nto a few more tests (its good to test at least something is printed in general I think).expected_output=Nonedefault to the low level_build_and_runfunction.