Skip to content

Commit

Permalink
Merge pull request #2043 from ruby/random-order
Browse files Browse the repository at this point in the history
Randomize stdlib test order to uncover hidden assumptions
  • Loading branch information
soutaro authored Oct 8, 2024
2 parents a877d7d + 6690718 commit 8f80973
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jobs:
job: rubocop validate test_doc build test_generate_stdlib raap
- ruby: "3.3"
job: typecheck_test
env:
RANDOMIZE_STDLIB_TEST_ORDER: "true"
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
Expand Down
5 changes: 5 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ task :stdlib_test => :compile do
test_files = FileList["test/stdlib/**/*_test.rb"].reject do |path|
path =~ %r{Ractor} || path =~ %r{Encoding}
end

if ENV["RANDOMIZE_STDLIB_TEST_ORDER"] == "true"
test_files.shuffle!
end

sh "#{ruby} -Ilib #{bin}/test_runner.rb #{test_files.join(' ')}"
# TODO: Ractor tests need to be run in a separate process
sh "#{ruby} -Ilib #{bin}/test_runner.rb test/stdlib/Ractor_test.rb"
Expand Down

0 comments on commit 8f80973

Please sign in to comment.