We need to handle the case where a machine has no existing simulated devices.
<rdar://problem/81484040>
Created attachment 434866 [details] Patch
The important piece to understand with this change is that comparing device types is fuzzy. Ie, `iPhone running iOS` matches `iPhone 10 running iOS 14`, but not `iPad running iOS`. Many scripts, and run-api-tests, in particular, don't exactly define exact device types and instead rely on the devices available on a machine. This is where the current issue is. If no devices are available, we don't have anything to match against and end up with a device type too generic for actually running tests. The solution to this (as implemented in this patch) is to check all device types this machine declares, even if those types are not currently associated with a simulated device, from newest to oldest, picking the first one that matches the requested device type.
Committed r280622 (240235@main): <https://commits.webkit.org/240235@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 434866 [details].