lib/parallel_tests/cli.rb in parallel_tests-1.8.0 vs lib/parallel_tests/cli.rb in parallel_tests-1.9.0
- old
+ new
@@ -57,11 +57,11 @@
abort final_fail_message if any_test_failed?(test_results)
end
def run_tests(group, process_number, num_processes, options)
if group.empty?
- {:stdout => '', :exit_status => 0}
+ {:stdout => '', :exit_status => 0, :command => '', :seed => nil}
else
@runner.run_tests(group, process_number, num_processes, options)
end
end
@@ -86,9 +86,23 @@
def report_results(test_results)
results = @runner.find_results(test_results.map { |result| result[:stdout] }*"")
puts ""
puts @runner.summarize_results(results)
+ report_failure_rerun_commmand(test_results)
+ end
+
+ def report_failure_rerun_commmand(test_results)
+ failing_sets = test_results.reject { |r| r[:exit_status] == 0 }
+ return if failing_sets.none?
+
+ puts "\n\nTests have failed for a parallel_test group. Use the following command to run the group again:\n\n"
+ failing_sets.each do |failing_set|
+ command = failing_set[:command]
+ command = command.gsub(/;export [A-Z_]+;/, ' ') # remove ugly export statements
+ command = @runner.command_with_seed(command, failing_set[:seed]) if failing_set[:seed]
+ puts command
+ end
end
def report_number_of_tests(groups)
name = @runner.test_file_name
num_processes = groups.size