fastlane-plugin-test_center 3.7.0.parallelizing.alpha.4 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/fastlane/plugin/test_center.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 +34 -89
- data/lib/fastlane/plugin/test_center/helper/correcting_scan_helper.rb +315 -0
- data/lib/fastlane/plugin/test_center/helper/reportname_helper.rb +6 -15
- data/lib/fastlane/plugin/test_center/helper/test_collector.rb +11 -48
- data/lib/fastlane/plugin/test_center/version.rb +1 -1
- metadata +11 -24
- data/lib/fastlane/plugin/test_center/actions/restart_core_simulator_service.rb +0 -38
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager.rb +0 -5
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/device_manager.rb +0 -30
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/interstitial.rb +0 -143
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/parallel_test_batch_worker.rb +0 -27
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/report_collator.rb +0 -115
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/retrying_scan.rb +0 -74
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/retrying_scan_helper.rb +0 -255
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/runner.rb +0 -356
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/simulator_helper.rb +0 -49
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/simulator_manager.rb +0 -317
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/test_batch_worker.rb +0 -20
- data/lib/fastlane/plugin/test_center/helper/multi_scan_manager/test_batch_worker_pool.rb +0 -129
- data/lib/fastlane/plugin/test_center/helper/xctestrun_info.rb +0 -42
@@ -1,20 +0,0 @@
|
|
1
|
-
module TestCenter
|
2
|
-
module Helper
|
3
|
-
module MultiScanManager
|
4
|
-
class TestBatchWorker
|
5
|
-
attr_accessor :state
|
6
|
-
|
7
|
-
def initialize(options)
|
8
|
-
@options = options
|
9
|
-
@state = :ready_to_work
|
10
|
-
end
|
11
|
-
|
12
|
-
def run(run_options)
|
13
|
-
self.state = :working
|
14
|
-
RetryingScan.run(@options.merge(run_options))
|
15
|
-
self.state = :ready_to_work
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,129 +0,0 @@
|
|
1
|
-
module TestCenter
|
2
|
-
module Helper
|
3
|
-
module MultiScanManager
|
4
|
-
class TestBatchWorkerPool
|
5
|
-
def initialize(options)
|
6
|
-
@options = options
|
7
|
-
end
|
8
|
-
|
9
|
-
def is_serial?
|
10
|
-
@options.fetch(:parallel_simulator_fork_count, 1) == 1
|
11
|
-
end
|
12
|
-
|
13
|
-
def setup_workers
|
14
|
-
if is_serial?
|
15
|
-
setup_serial_workers
|
16
|
-
else
|
17
|
-
setup_parallel_workers
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def setup_cloned_simulators
|
22
|
-
@simhelper = SimulatorHelper.new(
|
23
|
-
parallelize: true,
|
24
|
-
batch_count: @options[:parallel_simulator_fork_count] || @options[:batch_count]
|
25
|
-
)
|
26
|
-
@simhelper.setup
|
27
|
-
@clones = @simhelper.clone_destination_simulators
|
28
|
-
main_pid = Process.pid
|
29
|
-
at_exit do
|
30
|
-
clean_up_cloned_simulators(@clones) if Process.pid == main_pid
|
31
|
-
end
|
32
|
-
@clones
|
33
|
-
end
|
34
|
-
|
35
|
-
def destination_from_simulators(simulators)
|
36
|
-
simulators.map do |simulator|
|
37
|
-
"platform=iOS Simulator,id=#{simulator.udid}"
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def setup_parallel_workers
|
42
|
-
setup_cloned_simulators
|
43
|
-
desired_worker_count = @options[:parallel_simulator_fork_count]
|
44
|
-
@workers = []
|
45
|
-
(0...desired_worker_count).each do |worker_index|
|
46
|
-
@workers << ParallelTestBatchWorker.new(parallel_scan_options(worker_index))
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def parallel_scan_options(worker_index)
|
51
|
-
options = @options.reject { |key| %i[device devices].include?(key) }
|
52
|
-
options[:destination] = destination_from_simulators(@clones[worker_index])
|
53
|
-
options[:xctestrun] = xctestrun_products_clone if @options[:xctestrun]
|
54
|
-
options[:buildlog_path] = buildlog_path_for_worker(worker_index) if @options[:buildlog_path]
|
55
|
-
options[:derived_data_path] = derived_data_path_for_worker(worker_index)
|
56
|
-
options
|
57
|
-
end
|
58
|
-
|
59
|
-
def xctestrun_products_clone
|
60
|
-
xctestrun_filename = File.basename(@options[:xctestrun])
|
61
|
-
xcproduct_dirpath = File.dirname(@options[:xctestrun])
|
62
|
-
tmp_xcproduct_dirpath = Dir.mktmpdir
|
63
|
-
FileUtils.cp_r(xcproduct_dirpath, tmp_xcproduct_dirpath)
|
64
|
-
at_exit do
|
65
|
-
FileUtils.rm_rf(tmp_xcproduct_dirpath)
|
66
|
-
end
|
67
|
-
"#{tmp_xcproduct_dirpath}/#{File.basename(xcproduct_dirpath)}/#{xctestrun_filename}"
|
68
|
-
end
|
69
|
-
|
70
|
-
def buildlog_path_for_worker(worker_index)
|
71
|
-
"#{@options[:buildlog_path]}/parallel-simulators-#{worker_index}-logs"
|
72
|
-
end
|
73
|
-
|
74
|
-
def derived_data_path_for_worker(worker_index)
|
75
|
-
Dir.mktmpdir(['derived_data_path', "-worker-#{worker_index.to_s}"])
|
76
|
-
end
|
77
|
-
|
78
|
-
def clean_up_cloned_simulators(clones)
|
79
|
-
return if clones.nil?
|
80
|
-
|
81
|
-
clones.flatten.each(&:delete)
|
82
|
-
end
|
83
|
-
|
84
|
-
def setup_serial_workers
|
85
|
-
@workers = [
|
86
|
-
TestBatchWorker.new(@options)
|
87
|
-
]
|
88
|
-
end
|
89
|
-
|
90
|
-
def wait_for_worker
|
91
|
-
if is_serial?
|
92
|
-
return @workers[0]
|
93
|
-
else
|
94
|
-
if_no_available_workers = Proc.new do
|
95
|
-
worker = nil
|
96
|
-
loop do
|
97
|
-
freed_child_proc_pid = Process.wait
|
98
|
-
worker = @workers.find do |w|
|
99
|
-
w.pid == freed_child_proc_pid
|
100
|
-
end
|
101
|
-
|
102
|
-
break if worker
|
103
|
-
end
|
104
|
-
# worker.clean_up_or_whatever
|
105
|
-
# TODO: do not set state directly
|
106
|
-
worker.state == :ready_to_work
|
107
|
-
worker
|
108
|
-
end
|
109
|
-
|
110
|
-
first_ready_to_work_worker = @workers.find(if_no_available_workers) do |worker|
|
111
|
-
worker.state == :ready_to_work
|
112
|
-
end
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
def wait_for_all_workers
|
117
|
-
unless is_serial?
|
118
|
-
FastlaneCore::UI.message("TestBatchWorkerPool.wait_for_all_workers")
|
119
|
-
busy_worker_pids = @workers.each.select { |w| w.state == :working }.map(&:pid)
|
120
|
-
busy_worker_pids.each do |pid|
|
121
|
-
Process.wait(pid)
|
122
|
-
end
|
123
|
-
@workers.each { |w| w.state = :ready_to_work }
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
module TestCenter
|
2
|
-
module Helper
|
3
|
-
require 'plist'
|
4
|
-
|
5
|
-
class XCTestrunInfo
|
6
|
-
def initialize(xctestrun_filepath)
|
7
|
-
raise Errno::ENOENT, xctestrun_filepath unless File.exist?(xctestrun_filepath)
|
8
|
-
|
9
|
-
@xctestrun = Plist.parse_xml(xctestrun_filepath)
|
10
|
-
@xctestrun_rootpath = File.dirname(xctestrun_filepath)
|
11
|
-
end
|
12
|
-
|
13
|
-
def app_path_for_testable(testable)
|
14
|
-
@xctestrun[testable].fetch('UITargetAppPath') do |_|
|
15
|
-
@xctestrun[testable]['TestHostPath']
|
16
|
-
end.sub('__TESTROOT__', @xctestrun_rootpath)
|
17
|
-
end
|
18
|
-
|
19
|
-
def app_plist_for_testable(testable)
|
20
|
-
binary_plistfile = File.join(app_path_for_testable(testable), 'Info.plist')
|
21
|
-
|
22
|
-
Plist.parse_binary_xml(binary_plistfile)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
require 'plist'
|
29
|
-
|
30
|
-
class Hash
|
31
|
-
def save_binary_plist(filename, options = {})
|
32
|
-
Plist::Emit.save_plist(self, filename)
|
33
|
-
`plutil -convert binary1 \"#{filename}\"`
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
module Plist
|
38
|
-
def self.parse_binary_xml(filename)
|
39
|
-
`plutil -convert xml1 \"#{filename}\"`
|
40
|
-
Plist.parse_xml(filename)
|
41
|
-
end
|
42
|
-
end
|