bin/parallel_test in parallel_tests-0.3.5 vs bin/parallel_test in parallel_tests-0.3.6
- old
+ new
@@ -11,21 +11,26 @@
Options are:
BANNER
opts.on("-n [PROCESSES]", Integer, "How many processes to use, default: available CPUs"){|n| options[:count] = n }
opts.on("-p", '--path [PATH]', "run tests inside this path only"){|path| options[:path_prefix] = path }
- opts.on("-f", '--files path/to/test_file,path/to/other_test_file]', Array, "run these test files (comma-separated list w/o spaces)"){|files| options[:files] = files }
+ opts.on("-m [FLOAT]", "--multiply-processes [FLOAT]", Float, "use given number as a multiplier of processes to run"){ |multiply| options[:multiply] = multiply }
opts.on("-r", '--root [PATH]', "execute test commands from this path"){|path| options[:root] = path }
opts.on("-e", '--exec [COMMAND]', "execute this code parallel and with ENV['TEST_ENV_NUM']"){|path| options[:execute] = path }
- opts.on("-o", '--test-options [SOMETHING]', "execute test commands with those options"){|arg| options[:test_options] = arg }
+ opts.on("-o", "--test-options '[SOMETHING]'", "execute test commands with those options"){|arg| options[:test_options] = arg }
opts.on("-t", "--type [TYPE]", "which type of tests to run? test, spec or features"){|type| options[:type] = type }
opts.on('-v', '--version', 'Show Version'){ puts ParallelTests::VERSION; exit}
opts.on("-h", "--help", "Show this.") { puts opts; exit }
end.parse!
+
+# get files to run from arguments
+options[:files] = ARGV if ARGV.size > 0
+
require 'parallel'
num_processes = options[:count] || Parallel.processor_count
+num_processes = num_processes * (options[:multiply] || 1)
if options[:execute]
require File.join(lib_folder, "parallel_tests")
Parallel.in_processes(num_processes) do |i|
ParallelTests.execute_command(options[:execute], i)
@@ -70,6 +75,6 @@
#exit with correct status code
# - rake parallel:test && echo 123 ==> 123 should not show up when test failed
# - rake parallel:test db:reset ==> works when tests succeed
abort "#{name.capitalize}s Failed" if klass.failed?(results)
-end
\ No newline at end of file
+end