fastlane-plugin-test_center 3.8.0.parallelizing.beta.4 → 3.8.0.parallelizing.beta.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/test_center/actions/collate_html_reports.rb +1 -1
- data/lib/fastlane/plugin/test_center/actions/collate_json_reports.rb +1 -1
- data/lib/fastlane/plugin/test_center/actions/collate_junit_reports.rb +1 -1
- data/lib/fastlane/plugin/test_center/actions/collate_test_result_bundles.rb +1 -1
- data/lib/fastlane/plugin/test_center/actions/multi_scan.rb +1 -2
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/parallel_test_batch_worker.rb +5 -2
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/retrying_scan_helper.rb +2 -7
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/runner.rb +27 -8
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/simulator_helper.rb +1 -1
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/test_batch_worker_pool.rb +7 -14
- data/lib/fastlane/plugin/test_center/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9009b24fcae4a31fad31d0cd1bccf91e8579f125
|
4
|
+
data.tar.gz: cbb3dc2c2059adcab3e0a14c7b36abfab2e6b8cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4058a6ddf791d5746cc302eccbb4efe5819d26d4199ba98a18b227dd1efa583b5285cd63a8321ec971f45f8dd3b7614d10c5a31a7e88cd1210b75903e010fac
|
7
|
+
data.tar.gz: 9e939e96beafc7d9f57d0975e21efadf58e16f0549d0cc6a607694f7f77002791313703f8836bd437c1d30fb5ded3b372f2bef5b6f7dfaba7a85ab006cbf4374
|
@@ -149,7 +149,7 @@ module Fastlane
|
|
149
149
|
#####################################################
|
150
150
|
# :nocov:
|
151
151
|
def self.description
|
152
|
-
"Combines
|
152
|
+
"Combines multiple junit report files into one junit report file"
|
153
153
|
end
|
154
154
|
|
155
155
|
def self.details
|
@@ -175,8 +175,7 @@ module Fastlane
|
|
175
175
|
|
176
176
|
# :nocov:
|
177
177
|
def self.description
|
178
|
-
"Uses scan to run Xcode tests a given number of times, with the option "
|
179
|
-
"of batching them, only re-testing failing tests."
|
178
|
+
"Uses scan to run Xcode tests a given number of times, with the option of batching and/or parallelizing them, only re-testing failing tests."
|
180
179
|
end
|
181
180
|
|
182
181
|
def self.details
|
data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/parallel_test_batch_worker.rb
CHANGED
@@ -17,7 +17,7 @@ module TestCenter
|
|
17
17
|
def process_results
|
18
18
|
@pid = nil
|
19
19
|
File.foreach(@log_filepath) do |line|
|
20
|
-
puts "[worker #{@options[:batch_index]}] #{line}"
|
20
|
+
puts "[worker #{@options[:batch_index] + 1}] #{line}"
|
21
21
|
end
|
22
22
|
state = :ready_to_work
|
23
23
|
@options[:test_batch_results] << (@reader.gets == 'true')
|
@@ -32,6 +32,9 @@ module TestCenter
|
|
32
32
|
begin
|
33
33
|
reroute_stdout_to_logfile
|
34
34
|
tests_passed = super(run_options)
|
35
|
+
rescue StandardError => e
|
36
|
+
puts e.message
|
37
|
+
puts e.backtrace.inspect
|
35
38
|
ensure
|
36
39
|
handle_child_process_results(tests_passed)
|
37
40
|
exit!
|
@@ -44,7 +47,7 @@ module TestCenter
|
|
44
47
|
@reader, @writer = IO.pipe
|
45
48
|
@log_filepath = File.join(
|
46
49
|
Dir.mktmpdir,
|
47
|
-
"parallel-test-batch-#{@options[:batch_index]}.txt"
|
50
|
+
"parallel-test-batch-#{@options[:batch_index] + 1}.txt"
|
48
51
|
)
|
49
52
|
end
|
50
53
|
|
@@ -45,12 +45,7 @@ module TestCenter
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def output_directory
|
48
|
-
|
49
|
-
if @options[:batch]
|
50
|
-
testable = @options.fetch(:only_testing, ['']).first.split('/').first || ''
|
51
|
-
absolute_output_directory = File.join(absolute_output_directory, "#{testable}-batch-#{@options[:batch]}")
|
52
|
-
end
|
53
|
-
absolute_output_directory
|
48
|
+
@options.fetch(:output_directory, 'test_results')
|
54
49
|
end
|
55
50
|
|
56
51
|
def print_starting_scan_message
|
@@ -220,7 +215,7 @@ module TestCenter
|
|
220
215
|
Fastlane::Actions::RestartCoreSimulatorServiceAction.run
|
221
216
|
end
|
222
217
|
else
|
223
|
-
FastlaneCore::UI.error(
|
218
|
+
FastlaneCore::UI.error(test_session_last_messages)
|
224
219
|
send_callback_testrun_info(test_operation_failure: test_operation_failure)
|
225
220
|
raise exception
|
226
221
|
end
|
@@ -20,8 +20,15 @@ module TestCenter
|
|
20
20
|
@batch_count = @test_collector.test_batches.size
|
21
21
|
end
|
22
22
|
|
23
|
-
def output_directory
|
24
|
-
@options.fetch(:output_directory, 'test_results')
|
23
|
+
def output_directory(batch_index = 0, test_batch = [])
|
24
|
+
undecorated_output_directory = File.absolute_path(@options.fetch(:output_directory, 'test_results'))
|
25
|
+
|
26
|
+
return undecorated_output_directory if batch_index.zero?
|
27
|
+
|
28
|
+
absolute_output_directory = undecorated_output_directory
|
29
|
+
|
30
|
+
testable = test_batch.first.split('/').first || ''
|
31
|
+
File.join(absolute_output_directory, "#{testable}-batch-#{batch_index}")
|
25
32
|
end
|
26
33
|
|
27
34
|
def run
|
@@ -45,7 +52,8 @@ module TestCenter
|
|
45
52
|
def run_invocation_based_tests
|
46
53
|
@options[:only_testing] = @options[:only_testing]&.map(&:strip_testcase)&.uniq
|
47
54
|
@options[:skip_testing] = @options[:skip_testing]&.map(&:strip_testcase)&.uniq
|
48
|
-
|
55
|
+
@options[:output_directory] = output_directory
|
56
|
+
|
49
57
|
RetryingScan.run(@options.reject { |key| %i[device devices force_quit_simulator].include?(key) } )
|
50
58
|
end
|
51
59
|
|
@@ -53,6 +61,7 @@ module TestCenter
|
|
53
61
|
test_batch_results = []
|
54
62
|
pool_options = @options.reject { |key| %i[device devices force_quit_simulator].include?(key) }
|
55
63
|
pool_options[:test_batch_results] = test_batch_results
|
64
|
+
pool_options[:xctestrun] = @test_collector.xctestrun_path
|
56
65
|
|
57
66
|
pool = TestBatchWorkerPool.new(pool_options)
|
58
67
|
pool.setup_workers
|
@@ -60,7 +69,7 @@ module TestCenter
|
|
60
69
|
remaining_test_batches = @test_collector.test_batches.clone
|
61
70
|
remaining_test_batches.each_with_index do |test_batch, current_batch_index|
|
62
71
|
worker = pool.wait_for_worker
|
63
|
-
FastlaneCore::UI.message("Starting test run #{current_batch_index}")
|
72
|
+
FastlaneCore::UI.message("Starting test run #{current_batch_index + 1}")
|
64
73
|
worker.run(scan_options_for_worker(test_batch, current_batch_index))
|
65
74
|
end
|
66
75
|
pool.wait_for_all_workers
|
@@ -71,10 +80,9 @@ module TestCenter
|
|
71
80
|
def scan_options_for_worker(test_batch, batch_index)
|
72
81
|
{
|
73
82
|
only_testing: test_batch.map(&:shellsafe_testidentifier),
|
74
|
-
output_directory: output_directory,
|
83
|
+
output_directory: output_directory(batch_index + 1, test_batch),
|
75
84
|
try_count: @options[:try_count],
|
76
|
-
batch: batch_index + 1
|
77
|
-
xctestrun: @test_collector.xctestrun_path
|
85
|
+
batch: batch_index + 1
|
78
86
|
}
|
79
87
|
end
|
80
88
|
|
@@ -82,10 +90,21 @@ module TestCenter
|
|
82
90
|
return unless @batch_count > 1
|
83
91
|
return unless @options[:collate_reports]
|
84
92
|
|
85
|
-
|
86
93
|
@test_collector.testables.each do |testable|
|
87
94
|
collate_batched_reports_for_testable(testable)
|
88
95
|
end
|
96
|
+
move_single_testable_reports_to_final_location
|
97
|
+
end
|
98
|
+
|
99
|
+
def move_single_testable_reports_to_final_location
|
100
|
+
return unless @test_collector.testables.size == 1
|
101
|
+
|
102
|
+
report_files_dir = File.join(
|
103
|
+
File.absolute_path(output_directory),
|
104
|
+
@test_collector.testables.first
|
105
|
+
)
|
106
|
+
FileUtils.cp_r("#{report_files_dir}/.", File.absolute_path(output_directory))
|
107
|
+
FileUtils.rm_rf(report_files_dir)
|
89
108
|
end
|
90
109
|
|
91
110
|
def collate_batched_reports_for_testable(testable)
|
@@ -28,7 +28,7 @@ module TestCenter
|
|
28
28
|
original_simulators.each do |simulator|
|
29
29
|
FastlaneCore::UI.verbose("Cloning simulator")
|
30
30
|
cloned_simulator = simulator.clone
|
31
|
-
new_first_name = simulator.name.sub(/( ?\(.*| ?$)/, " Clone #{batch_index}")
|
31
|
+
new_first_name = simulator.name.sub(/( ?\(.*| ?$)/, " Clone #{batch_index + 1}")
|
32
32
|
new_last_name = "#{self.class.name}<#{self.object_id}>"
|
33
33
|
cloned_simulator.rename("#{new_first_name} #{new_last_name}")
|
34
34
|
|
@@ -34,6 +34,7 @@ module TestCenter
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def destination_for_worker(worker_index)
|
37
|
+
# each worker has its own simulators to work with
|
37
38
|
return @options[:destination] unless @options[:platform] == :ios
|
38
39
|
|
39
40
|
@clones[worker_index].map do |simulator|
|
@@ -53,7 +54,6 @@ module TestCenter
|
|
53
54
|
def parallel_scan_options(worker_index)
|
54
55
|
options = @options.reject { |key| %i[device devices].include?(key) }
|
55
56
|
options[:destination] = destination_for_worker(worker_index)
|
56
|
-
options[:xctestrun] = xctestrun_products_clone if @options[:xctestrun]
|
57
57
|
options[:buildlog_path] = buildlog_path_for_worker(worker_index) if @options[:buildlog_path]
|
58
58
|
options[:derived_data_path] = derived_data_path_for_worker(worker_index)
|
59
59
|
options[:batch_index] = worker_index
|
@@ -61,23 +61,16 @@ module TestCenter
|
|
61
61
|
options
|
62
62
|
end
|
63
63
|
|
64
|
-
def xctestrun_products_clone
|
65
|
-
xctestrun_filename = File.basename(@options[:xctestrun])
|
66
|
-
xcproduct_dirpath = File.dirname(@options[:xctestrun])
|
67
|
-
tmp_xcproduct_dirpath = Dir.mktmpdir
|
68
|
-
FileUtils.cp_r(xcproduct_dirpath, tmp_xcproduct_dirpath)
|
69
|
-
at_exit do
|
70
|
-
FileUtils.rm_rf(tmp_xcproduct_dirpath)
|
71
|
-
end
|
72
|
-
"#{tmp_xcproduct_dirpath}/#{File.basename(xcproduct_dirpath)}/#{xctestrun_filename}"
|
73
|
-
end
|
74
|
-
|
75
64
|
def buildlog_path_for_worker(worker_index)
|
76
|
-
|
65
|
+
# ensure that simultaneous simulators are not writing to the same log
|
66
|
+
# at the same time.
|
67
|
+
"#{@options[:buildlog_path]}/worker-#{worker_index + 1}-logs"
|
77
68
|
end
|
78
69
|
|
79
70
|
def derived_data_path_for_worker(worker_index)
|
80
|
-
|
71
|
+
# ensure that simultaneous simulators are not writing diagnostics to
|
72
|
+
# the same location at the same time.
|
73
|
+
Dir.mktmpdir(['derived_data_path', "-worker-#{(worker_index + 1).to_s}"])
|
81
74
|
end
|
82
75
|
|
83
76
|
def clean_up_cloned_simulators(clones)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-test_center
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.8.0.parallelizing.beta.
|
4
|
+
version: 3.8.0.parallelizing.beta.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lyndsey Ferguson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|