-
Notifications
You must be signed in to change notification settings - Fork 129
Fix build report issue with FTL devices #1809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -388,17 +388,17 @@ def combine_config(platform, config, config_value, k): | |||||||||||||||||||||||||||
| if len(config_value) > 1 and len(config) == len(config_value): | ||||||||||||||||||||||||||||
| config = ["All %d %s" % (len(config_value), config_name)] | ||||||||||||||||||||||||||||
| elif config_name == "ios_device": | ||||||||||||||||||||||||||||
| ftl_devices = set(filter(lambda device: get_test_device(device).get("type") in "ftl", config_value)) | ||||||||||||||||||||||||||||
| simulators = set(filter(lambda device: get_test_device(device).get("type") in "virtual", config_value)) | ||||||||||||||||||||||||||||
| ftl_devices = set(filter(lambda device: get_test_device(device) and get_test_device(device).get("type") in "ftl", config_value)) | ||||||||||||||||||||||||||||
| simulators = set(filter(lambda device: get_test_device(device) and get_test_device(device).get("type") in "virtual", config_value)) | ||||||||||||||||||||||||||||
| if len(ftl_devices) > 1 and ftl_devices.issubset(set(config)): | ||||||||||||||||||||||||||||
| config.insert(0, "All %d FTL Devices" % len(ftl_devices)) | ||||||||||||||||||||||||||||
| config = [x for x in config if (x not in ftl_devices)] | ||||||||||||||||||||||||||||
| if len(simulators) > 1 and simulators.issubset(set(config)): | ||||||||||||||||||||||||||||
| config.insert(0, "All %d Local Simulators" % len(simulators)) | ||||||||||||||||||||||||||||
| config = [x for x in config if (x not in simulators)] | ||||||||||||||||||||||||||||
| elif config_name == "android_device": | ||||||||||||||||||||||||||||
| ftl_devices = set(filter(lambda device: get_test_device(device).get("type") in "ftl", config_value)) | ||||||||||||||||||||||||||||
| emulators = set(filter(lambda device: get_test_device(device).get("type") in "virtual", config_value)) | ||||||||||||||||||||||||||||
| ftl_devices = set(filter(lambda device: get_test_device(device) and get_test_device(device).get("type") in "ftl", config_value)) | ||||||||||||||||||||||||||||
| emulators = set(filter(lambda device: get_test_device(device) and get_test_device(device).get("type") in "virtual", config_value)) | ||||||||||||||||||||||||||||
|
Comment on lines
+400
to
+401
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to the
Suggested change
|
||||||||||||||||||||||||||||
| if len(ftl_devices) > 1 and ftl_devices.issubset(set(config)): | ||||||||||||||||||||||||||||
| config.insert(0, "All %d FTL Devices" % len(ftl_devices)) | ||||||||||||||||||||||||||||
| config = [x for x in config if (x not in ftl_devices)] | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the added check for
get_test_device(device)correctly prevents a crash, this implementation can be improved for readability and efficiency.get_test_device(device)is called twice in the lambda for each device, andconfig_valueis iterated over twice (once forftl_devices, once forsimulators).in "ftl"orin "virtual"is confusing and less precise than==. It works here because the only possible values are"ftl"and"virtual", but it's brittle.I suggest refactoring this to a single loop that categorizes devices. This is more efficient and readable.