fastlane-plugin-automated_test_emulator_run 1.4.1 → 1.5.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f4df821ea05fe8c6aa84588219ece95396c8765
|
4
|
+
data.tar.gz: 4b13639cb09291a3cec0b84cb2c5d4c3f4a01775
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c32d4a26d431e7032d4836acd5eb47d1786a7e93c315e9bcc7cd246202919f7abab1980be2a8370747cdaac04680bddc2e1601e0ec0120c53495c268a3da2565
|
7
|
+
data.tar.gz: 10b97e41d75cfda3757222818b60dc06378a407e9aec09b77c26f19a08130850efc80ec5b9cc2325241729b22d1ad570045bbbabb94ae06dc9ea08188884c5a6
|
data/lib/fastlane/plugin/automated_test_emulator_run/actions/automated_test_emulator_run_action.rb
CHANGED
@@ -34,13 +34,14 @@ module Fastlane
|
|
34
34
|
"Output will be delegated to null and lost. Check your save/read permissions."].join(" ").red)
|
35
35
|
end
|
36
36
|
end
|
37
|
-
|
38
37
|
end
|
39
38
|
|
39
|
+
# Reseting wait states
|
40
40
|
all_avd_launched = false
|
41
|
+
adb_launch_complete = false
|
42
|
+
param_launch_complete = false
|
41
43
|
|
42
44
|
while(!all_avd_launched)
|
43
|
-
|
44
45
|
# Preparation
|
45
46
|
UI.message("Configuring environment in order to launch emulators: ".yellow)
|
46
47
|
UI.message("Getting avaliable AVDs".yellow)
|
@@ -100,34 +101,48 @@ module Fastlane
|
|
100
101
|
|
101
102
|
# Wait for AVDs finish booting
|
102
103
|
UI.message("Waiting for AVDs to finish booting.".yellow)
|
103
|
-
boot_status = []
|
104
|
-
for i in 0...avd_schemes.length
|
105
|
-
boot_status << false
|
106
|
-
end
|
107
|
-
|
108
104
|
UI.message("Performig wait for ADB boot".yellow)
|
109
|
-
|
105
|
+
adb_launch_complete = wait_for_emulator_boot_by_adb(adb_controller, avd_schemes, "#{params[:AVD_adb_launch_timeout]}")
|
110
106
|
|
111
|
-
|
107
|
+
# Wait for AVD params finish booting
|
108
|
+
if adb_launch_complete
|
112
109
|
UI.message("Wait for ADB boot completed with success".yellow)
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
110
|
+
|
111
|
+
if (params[:AVD_wait_for_bootcomplete] || params[:AVD_wait_for_boot_completed] || params[:AVD_wait_for_bootanim])
|
112
|
+
message = "Performing wait for params: "
|
113
|
+
|
114
|
+
if params[:AVD_wait_for_bootcomplete]
|
115
|
+
message += "'dev.bootcomplete', "
|
116
|
+
end
|
117
|
+
|
118
|
+
if params[:AVD_wait_for_boot_completed]
|
119
|
+
message += "'sys.boot_completed', "
|
120
|
+
end
|
121
|
+
|
122
|
+
if params[:AVD_wait_for_bootanim]
|
123
|
+
message += "'init.svc.bootanim', "
|
124
|
+
end
|
125
|
+
|
126
|
+
message = message[0...-2] + "."
|
127
|
+
UI.message(message.yellow)
|
128
|
+
|
129
|
+
param_launch_complete = wait_for_emulator_boot_by_params(params, adb_controller, avd_controllers, avd_schemes, "#{params[:AVD_param_launch_timeout]}")
|
130
|
+
else
|
131
|
+
UI.message("Wait for AVD launch params was turned off. Skipping...".yellow)
|
132
|
+
param_launch_complete = true
|
119
133
|
end
|
120
134
|
else
|
121
135
|
UI.message("Wait for ADB boot failed".yellow)
|
122
136
|
end
|
123
137
|
|
138
|
+
all_avd_launched = adb_launch_complete && param_launch_complete
|
139
|
+
|
124
140
|
# Deciding if AVD launch should be restarted
|
125
141
|
devices = Action.sh(adb_controller.command_get_devices)
|
126
142
|
if all_avd_launched
|
127
143
|
UI.message("AVDs Booted!".green)
|
128
144
|
else
|
129
145
|
for i in 0...avd_schemes.length
|
130
|
-
|
131
146
|
if params[:verbose]
|
132
147
|
# Display AVD output
|
133
148
|
if (File.exists?(avd_controllers[i].output_file.path))
|
@@ -248,29 +263,83 @@ module Fastlane
|
|
248
263
|
return launch_status
|
249
264
|
end
|
250
265
|
|
251
|
-
def self.wait_for_emulator_boot_by_params(adb_controller,
|
252
|
-
|
253
|
-
|
266
|
+
def self.wait_for_emulator_boot_by_params(params, adb_controller, avd_controllers, avd_schemes, timeout)
|
267
|
+
timeout_in_seconds= timeout.to_i
|
268
|
+
interval = 1000 * 10
|
269
|
+
all_params_launched = false
|
270
|
+
start_time = last_scan_ended = Time.now
|
271
|
+
device_boot_statuses = Hash.new
|
254
272
|
|
255
|
-
|
256
|
-
|
257
|
-
dev_bootcomplete, _stdeerr, _status = Open3.capture3([avd_controller.command_get_property, "dev.bootcomplete"].join(" "))
|
258
|
-
sys_boot_completed, _stdeerr, _status = Open3.capture3([avd_controller.command_get_property, "sys.boot_completed"].join(" "))
|
259
|
-
bootanim, _stdeerr, _status = Open3.capture3([avd_controller.command_get_property, "init.svc.bootanim"].join(" "))
|
260
|
-
currentTime = Time.now
|
273
|
+
loop do
|
274
|
+
current_time = Time.now
|
261
275
|
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
276
|
+
# Performing single scan over each device
|
277
|
+
if (((current_time - last_scan_ended) * 1000) >= interval || start_time == last_scan_ended)
|
278
|
+
for i in 0...avd_schemes.length
|
279
|
+
avd_schema = avd_schemes[i]
|
280
|
+
avd_controller = avd_controllers[i]
|
281
|
+
avd_param_boot_hash = Hash.new
|
282
|
+
avd_param_status_hash = Hash.new
|
283
|
+
avd_booted = false
|
284
|
+
|
285
|
+
# Retreiving device parameters according to config
|
286
|
+
if params[:AVD_wait_for_bootcomplete]
|
287
|
+
dev_bootcomplete, _stdeerr, _status = Open3.capture3([avd_controller.command_get_property, "dev.bootcomplete"].join(" "))
|
288
|
+
avd_param_boot_hash.store("dev.bootcomplete", dev_bootcomplete.strip.eql?("1"))
|
289
|
+
avd_param_status_hash.store("dev.bootcomplete", dev_bootcomplete)
|
290
|
+
end
|
291
|
+
|
292
|
+
if params[:AVD_wait_for_boot_completed]
|
293
|
+
sys_boot_completed, _stdeerr, _status = Open3.capture3([avd_controller.command_get_property, "sys.boot_completed"].join(" "))
|
294
|
+
avd_param_boot_hash.store("sys.boot_completed", sys_boot_completed.strip.eql?("1"))
|
295
|
+
avd_param_status_hash.store("sys.boot_completed", sys_boot_completed)
|
296
|
+
end
|
297
|
+
|
298
|
+
if params[:AVD_wait_for_bootanim]
|
299
|
+
bootanim, _stdeerr, _status = Open3.capture3([avd_controller.command_get_property, "init.svc.bootanim"].join(" "))
|
300
|
+
avd_param_boot_hash.store("init.svc.bootanim", bootanim.strip.eql?("stopped"))
|
301
|
+
avd_param_status_hash.store("init.svc.bootanim", bootanim)
|
302
|
+
end
|
303
|
+
|
304
|
+
# Checking for param statuses
|
305
|
+
avd_param_boot_hash.each do |name, is_booted|
|
306
|
+
if !is_booted
|
307
|
+
break
|
308
|
+
end
|
309
|
+
avd_booted = true
|
310
|
+
end
|
311
|
+
device_boot_statuses.store(avd_schema.avd_name, avd_booted)
|
312
|
+
|
313
|
+
# Plotting current wait results
|
314
|
+
device_log = "Device 'emulator-" + avd_schemes[i].launch_avd_port.to_s + "' launch status:"
|
315
|
+
UI.message(device_log.magenta)
|
316
|
+
avd_param_boot_hash.each do |name, is_booted|
|
317
|
+
device_log = "'" + name + "' - '" + avd_param_status_hash[name].strip + "' (launched: " + is_booted.to_s + ")"
|
318
|
+
UI.message(device_log.magenta)
|
319
|
+
end
|
266
320
|
end
|
321
|
+
last_scan_ended = Time.now
|
322
|
+
end
|
323
|
+
|
324
|
+
# Checking if wait doesn't last too long
|
325
|
+
if (current_time - start_time) >= timeout_in_seconds
|
326
|
+
UI.message(["AVD param loading took more than ", timeout, ". Attempting to re-launch."].join("").red)
|
327
|
+
all_params_launched = false
|
328
|
+
break
|
329
|
+
end
|
267
330
|
|
268
|
-
|
269
|
-
|
331
|
+
# Finishing wait with success if all params are loaded for every device
|
332
|
+
device_boot_statuses.each do |name, is_booted|
|
333
|
+
if !is_booted
|
270
334
|
break
|
271
335
|
end
|
336
|
+
all_params_launched = true
|
337
|
+
end
|
338
|
+
if all_params_launched
|
339
|
+
break
|
272
340
|
end
|
273
|
-
|
341
|
+
end
|
342
|
+
return all_params_launched
|
274
343
|
end
|
275
344
|
|
276
345
|
def self.available_options
|
@@ -326,6 +395,24 @@ module Fastlane
|
|
326
395
|
default_value: true,
|
327
396
|
is_string: false,
|
328
397
|
optional: true),
|
398
|
+
FastlaneCore::ConfigItem.new(key: :AVD_wait_for_bootcomplete,
|
399
|
+
env_name: "AVD_BOOTCOMPLETE_WAIT",
|
400
|
+
description: "Allows to switch wait for 'dev.bootcomplete' AVD launch param on/off",
|
401
|
+
default_value: true,
|
402
|
+
is_string: false,
|
403
|
+
optional: true),
|
404
|
+
FastlaneCore::ConfigItem.new(key: :AVD_wait_for_boot_completed,
|
405
|
+
env_name: "AVD_BOOT_COMPLETED_WAIT",
|
406
|
+
description: "Allows to switch wait for 'sys.boot_completed' AVD launch param on/off",
|
407
|
+
default_value: true,
|
408
|
+
is_string: false,
|
409
|
+
optional: true),
|
410
|
+
FastlaneCore::ConfigItem.new(key: :AVD_wait_for_bootanim,
|
411
|
+
env_name: "ABD_BOOTANIM_WAIT",
|
412
|
+
description: "Allows to switch wait for 'init.svc.bootanim' AVD launch param on/off",
|
413
|
+
default_value: true,
|
414
|
+
is_string: false,
|
415
|
+
optional: true),
|
329
416
|
|
330
417
|
#launch commands
|
331
418
|
FastlaneCore::ConfigItem.new(key: :shell_task,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-automated_test_emulator_run
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kamil Krzyk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|