Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use test_runner for tests #3268

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jobs:
- name: test
if: ${{ needs.skip_duplicate_runs.outputs.should_skip != 'true' }}
timeout-minutes: 6
run: bundle exec rake test:all
run: test/runner --verbose

test_non_mri:
name: >-
Expand Down Expand Up @@ -206,7 +206,7 @@ jobs:
if: | # only run if previous steps have succeeded
success() &&
(needs.skip_duplicate_runs.outputs.should_skip != 'true')
run: bundle exec rake test:all
run: test/runner --verbose

- name: >-
Test outcome: ${{ steps.test.outcome }}
Expand Down
50 changes: 50 additions & 0 deletions test/runner
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env ruby

=begin
A simplified test runner; it runs all tests by default.
It assumes that "bundle exec rake compile" has been run.

It can also be passed a glob or test file names. If multiple test file names
are used, separate them by the File::PATH_SEPARATOR character with no spaces.
The file extension is optional.

If arguments are used that take values (eg seed), use the 'no space' version,
like -s33388 or --seed=33388

Finally, to keep the code simple, if you pass an invalid argument for file
filtering it will either error or run minitest with no tests loaded

Examples, run from the top Puma repo folder:
test/runner
test/runner -v
test/runner -v test_puma_server
test/runner --verbose test_puma_server*
test/runner --verbose test_integration_cluster:test_integration_single
test/runner --verbose test*ssl*
=end

require 'bundler/setup'

if ARGV.empty? || ARGV.last.start_with?('-')
if RUBY_VERSION >= '2.5'
Dir['test_*.rb', base: __dir__].each { |tf| require_relative tf }
else
Dir["#{__dir__}/test_*.rb"].each { |tf| require tf }
end
else
file_arg = ARGV.pop.sub(/\.rb\z/, '')
if file_arg.include? File::PATH_SEPARATOR
file_args = file_arg.split(File::PATH_SEPARATOR).map { |fn| fn.sub(/\.rb\z/, '') }
file_args.each { |tf| require_relative "#{tf}.rb" }
elsif file_arg.include? '*'
if RUBY_VERSION >= '2.5'
Dir["#{file_arg}.rb", base: __dir__].each { |tf| require_relative tf }
else
Dir["#{__dir__}/#{file_arg}.rb"].each { |tf| require tf }
end
else
require_relative "#{file_arg}.rb"
end
end

require 'minitest'
2 changes: 2 additions & 0 deletions test/runner.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@ECHO OFF
@ruby.exe -x "%~dpn0" %*
Loading