diff --git a/.rubocop_gradual.lock b/.rubocop_gradual.lock index 7527bd3..165d079 100644 --- a/.rubocop_gradual.lock +++ b/.rubocop_gradual.lock @@ -25,14 +25,14 @@ "lib/turbo_tests/reporter.rb:1386902608": [ [7, 5, 400, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 2092085575] ], - "lib/turbo_tests/runner.rb:1170052458": [ + "lib/turbo_tests/runner.rb:1092969829": [ [13, 5, 271, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 21989008], - [20, 5, 1253, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1925027850], - [211, 11, 10, "ThreadSafety/NewThread: Avoid starting new threads.", 3411682361], - [229, 47, 6, "Style/GlobalStdStream: Use `$stderr` instead of `STDERR`.", 3356712163], - [231, 21, 10, "ThreadSafety/NewThread: Avoid starting new threads.", 3411682361], - [240, 7, 10, "ThreadSafety/NewThread: Avoid starting new threads.", 3411682361], - [300, 9, 6, "Style/GlobalStdStream: Use `$stdout` instead of `STDOUT`.", 3356722952] + [20, 5, 1311, "Style/ClassMethodsDefinitions: Use `class << self` to define a class method.", 1925027850], + [216, 11, 10, "ThreadSafety/NewThread: Avoid starting new threads.", 3411682361], + [234, 47, 6, "Style/GlobalStdStream: Use `$stderr` instead of `STDERR`.", 3356712163], + [236, 21, 10, "ThreadSafety/NewThread: Avoid starting new threads.", 3411682361], + [245, 7, 10, "ThreadSafety/NewThread: Avoid starting new threads.", 3411682361], + [305, 9, 6, "Style/GlobalStdStream: Use `$stdout` instead of `STDOUT`.", 3356722952] ], "spec/cli_spec.rb:3990998076": [ [1, 1, 30, "RSpec/SpecFilePathFormat: Spec path should end with `turbo_tests/cli*_spec.rb`.", 965721356], diff --git a/lib/turbo_tests/cli.rb b/lib/turbo_tests/cli.rb index 18c7ac2..ae6f445 100644 --- a/lib/turbo_tests/cli.rb +++ b/lib/turbo_tests/cli.rb @@ -19,6 +19,7 @@ def run seed = nil print_failed_group = false create = false + nice = false OptionParser.new do |opts| opts.banner = <<~BANNER @@ -95,6 +96,10 @@ def run opts.on("--print_failed_group", "Prints group that had failures in it") do print_failed_group = true end + + opts.on("--nice", "execute test commands with low priority") do + nice = true + end end.parse!(@argv) if create @@ -126,6 +131,7 @@ def run fail_fast: fail_fast, count: count, seed: seed, + nice: nice, print_failed_group: print_failed_group, parallel_options: parallel_options, ) diff --git a/lib/turbo_tests/runner.rb b/lib/turbo_tests/runner.rb index 94fdfa1..f271d7c 100644 --- a/lib/turbo_tests/runner.rb +++ b/lib/turbo_tests/runner.rb @@ -31,6 +31,7 @@ def self.run(opts = {}) seed = opts.fetch(:seed, nil) seed_used = !seed.nil? print_failed_group = opts.fetch(:print_failed_group, false) + nice = opts.fetch(:nice, false) use_runtime_info = files == ["spec"] @@ -57,6 +58,7 @@ def self.run(opts = {}) print_failed_group: print_failed_group, use_runtime_info: use_runtime_info, parallel_options: parallel_options, + nice: nice, ).run end @@ -69,6 +71,7 @@ def initialize(opts) @count = opts[:count] @seed = opts[:seed] @seed_used = opts[:seed_used] + @nice = opts[:nice] @use_runtime_info = opts[:use_runtime_info] @load_time = 0 @@ -194,6 +197,8 @@ def start_subprocess(env, extra_args, tests, process_id, record_runtime:) *record_runtime_options, *tests, ] + command.unshift(ENV["BUNDLE_BIN_PATH"], "exec") if ENV["BUNDLE_BIN_PATH"] + command.unshift("nice") if @nice if @verbose command_str = [