Skip to content

Define helper function which takes already sorted test as argument#140

Merged
giordano merged 4 commits into
mainfrom
mg/test
Jul 2, 2026
Merged

Define helper function which takes already sorted test as argument#140
giordano merged 4 commits into
mainfrom
mg/test

Conversation

@giordano

@giordano giordano commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread test/runtests.jl
Comment on lines +805 to +838
@testset "quickfail" begin
# To test that `--quickfail` does its job, we want to launch tests with one job, with
# the failing one launched as first: we should observe that the successful ones are
# never started.
testsuite = Dict(
"fail-test" => :( @test false ),
# If there's a bug in the launch order, having multiple successful tests increases
# the likelihood of hitting the bug, making investigation easier.
"pass-test1" => :( @test true ),
"pass-test2" => :( @test true ),
"pass-test3" => :( @test true ),
"pass-test4" => :( @test true ),
"pass-test5" => :( @test true ),
)
io = IOBuffer()
@test_throws Test.FallbackTestSetException begin
# Call `_runtests` so that we can enforce a run order.
ParallelTestRunner._runtests(
# Use a single job to make sure only `fail-test` is started.
ParallelTestRunner, parse_args(["--quickfail", "--verbose", "--jobs=1"]);
testsuite,
tests=["fail-test", "pass-test1", "pass-test2", "pass-test3", "pass-test4", "pass-test5"],
historical_durations=Dict{String, Float64}(),
stdout=io,
stderr=io,
)
end
str = String(take!(io))
@test contains(str, r"fail-test .+ started at")
@test contains(str, r"fail-test .+ failed at")
@test contains(str, "FAILURE")
# `fail-test` is always launched first, `pass-test`s are never started.
@test !contains(str, r"pass-test[1-5] .+ started at")
end

@giordano giordano Jul 2, 2026

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.

A simplified version of this test was originally in #118, but it didn't make sense back then because we had no way to enforce the tests launch order, so I removed it in that PR. I brought it back here, with more robust tests.

Note: if you run the tests with multiple julia threads, this fails very frequently because of #139 (the multiple pass-tests makes the failure much more likely than if having a single one).

@giordano giordano merged commit deed457 into main Jul 2, 2026
23 checks passed
@giordano giordano deleted the mg/test branch July 2, 2026 23:01
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.

1 participant