dotnet / xharness

C# command line tool for running tests on Android / iOS / tvOS devices and simulators
MIT License
153 stars 49 forks source link

Can Xharness.CLI boot Android emulators? #201

Open EgorBo opened 4 years ago

EgorBo commented 4 years ago

XHarness.CLI for iOS is able to boot iOS simulators without help, is it possible to do it for Android as well?

MattGal commented 4 years ago

Possibly (I'm fighting an issue with them being offline already), but what's the goal here? Currently for the emulator setup we have, they're booted as services by systemd.

The tricky part we'd have to solve for this is that the location of the executable would not be known so resolution of the path becomes a challenge.

EgorBo commented 4 years ago

@MattGal

but what's the goal here?

To be consistent with iOS where Xharness does boot them

solve for this is that the location of the executable

what executable?

MattGal commented 4 years ago

what executable?

The emulator. On linux and on how we've set up our machines, it's $ANDROID_SDK_ROOT/emulator/emulator , but this could be anywhere.

MattGal commented 4 years ago

@EgorBo , after discussing with the other XHarness team members I think this is a non-starter for Android. When using iOS simulator, one always knows the OS (it's always MacOS) and the simulator is always in a static location relative to XCode. On Android, we support running from Windows, Linux, and MacOS, there can be any number of emulators and devices attached to the machine, and the location of these emulators can be anywhere.

XHarness will always print error messages ( I can try to make them extra-explicit) when no usable devices are found, but as I can conceive of no reliable way to find the emulators and start them (and since finding and starting random processes on the user's machine might be unwanted ) I am closing this.

If you have a reliable strategy for finding and starting emulators that works on all three OSes we can certainly discuss it at a later juncture.

mattleibow commented 10 months ago

We could use adb shell getprop sys.boot_completed (or dev.bootcomplete) and see if it is done.

https://github.com/cake-contrib/Cake.Android.Adb/blob/85c37d0026ec9e924ccd5950827cfaf07fe9d7d8/src/Cake.Android.Adb/Aliases/AdbAliases.cs#L337