Skip to content

Improve consistently of test output checking. NFC - #27267

Merged
sbc100 merged 1 commit into
emscripten-core:mainfrom
sbc100:test_output
Jul 8, 2026
Merged

Improve consistently of test output checking. NFC#27267
sbc100 merged 1 commit into
emscripten-core:mainfrom
sbc100:test_output

Conversation

@sbc100

@sbc100 sbc100 commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator
  • 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.

- 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.
@sbc100
sbc100 requested a review from kripken July 8, 2026 05:10
Comment thread test/test_other.py
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')

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.

What does this actually change?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

Comment thread test/test_other.py

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')])

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.

Why is this adading a new post-js?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

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.

@sbc100
sbc100 merged commit 7d5f96d into emscripten-core:main Jul 8, 2026
39 checks passed
@sbc100
sbc100 deleted the test_output branch July 8, 2026 18:32
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.

2 participants