Skip to content

Conversation

juj
Copy link
Collaborator

@juj juj commented Oct 16, 2025

Add --max-failures option in test harness to generalize on the --failfast option (which is effectively a '--max-failures 0' mode).

This allows running the harness while allowing a couple of failures. I find that when using --failfast, aborting on the first error is sometimes a bit too eager, i.e. there might be a flaky test that triggers the abort, or there might be an error that causes more than one test to fail.

Examining test harness results, that interpreting a small handful of failures (1,2,3...5) is still doable one-by-one, but when the number of failures grows to, say, > 5, the typically I want to deal with the first couple of errors only, and re-run the harness after that, assuming the rest of the errors would be from the same root cause.

So this enables running with, say, --max-failures 5, and get info on the first handful of errors, and ignore if any more errors occur.

This helps retain the failfast-like behavior while producing a bit more info, and being a bit more tolerant to instabilities.

if options.failfast:
if options.max_failures != 0:
utils.exit_with_error('--failfast and --max-failures are mutually exclusive!')
options.max_failures = 0
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this be = 1?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I took a convention of max_failures to mean "maximum allowed failures before aborting the test run".

So max_failures = 0 means that zero failures are allowed, after that test run is aborted. (first failure will abort)
max_failures = 1 means that one failure is allowed, and the second one after that aborts the run.

help='Use the default CI browser configuration.')
parser.add_argument('tests', nargs='*')
parser.add_argument('--failfast', action='store_true')
parser.add_argument('--failfast', action='store_true', help='If true, test run will abort on first failed test.')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually I wonder if you can you do something action=store_constant + target=max_failures here? Maybe too clever.

lgtm either way.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm there are still a couple of uses of the options.failfast variable that this PR does not change, so keeping that around for now helps.

@juj
Copy link
Collaborator Author

juj commented Oct 16, 2025

Anything more here?

@juj juj merged commit 0b127ff into emscripten-core:main Oct 16, 2025
34 checks passed
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