AzimoLabs / fastlane-plugin-automated-test-emulator-run

Plugin dedicated for Android platform. Wraps gradle task/shell command used for launching instrumented tests. Provides start of as many AVDs with various configs as needed before test run, waits for boot, kills emulators and deletes them from hdd after tests are finished or disturbed.
MIT License
112 stars 48 forks source link

Getting stuck at "Performing wait for params: dev.bootcomplete, sys.boot_completed, init.svc.bootanim." #10

Open deepanshumadan opened 7 years ago

deepanshumadan commented 7 years ago

After updating the plugin to 1.4.1, the devices are getting created and launched, ADB boot gets completed with successfully but then it gets stuck at "Performing wait for params: dev.bootcomplete, sys.boot_completed, init.svc.bootanim."

This is how my avd config looks like { "avd_name": "Test-Emulator-API21_1", "create_avd_package": "system-images;android-21;google_apis;x86_64", "create_avd_device": "Nexus 5", "create_avd_tag": "google_apis", "create_avd_abi": "x86_64", "create_avd_additional_options": "--skin \"1080x1920\" --sdcard 2048M", "create_avd_hardware_config_filepath": "", "launch_avd_snapshot_filepath": "", "launch_avd_launch_binary_name": "emulator", "launch_avd_port": "", "launch_avd_additional_options": "-gpu on -no-boot-anim -partition-size 2048 -wipe-data -skin \"1080x1920\"" }

FisherKK commented 7 years ago

Hey! Sorry for late response. I will look at it tomorrow. For now it might be helpful to tell me how your AVDs look like why script is waiting for parameters.

At first look - you could give a try without "-no-boot-anim" param. I think the problem is that I am waiting for parameters to load but they will never load as no animation is starting.

I will check it and fix it.

deepanshumadan commented 7 years ago

Thanks @FisherKK . AVDs looks fine, they are all ready to go and set up.

I also tried removing "-no-boot-anim", it still gets stuck at the same place.

FisherKK commented 7 years ago

Hey @deepanshumadan,

I apologise for the fact I had promised to look at it the day before yesterday and I could not find time. I have checked it now though and for first look it simply worked for me so I am a bit confused. For now let's make sure we are having similar SDK specs because there might be some kind of difference and we are unaware of it.

  1. AVD config you have sent me looks like that:
{
    "avd_list": [
        {
          "avd_name": "Test-Emulator-API21_1",

          "create_avd_package": "system-images;android-21;google_apis;x86_64",
          "create_avd_device": "Nexus 5X",
          "create_avd_tag": "google_apis",
          "create_avd_abi": "x86_64",
          "create_avd_additional_options": "--skin \"1080x1920\" --sdcard 2048M",
          "create_avd_hardware_config_filepath": "",

          "launch_avd_port": "",
          "launch_avd_snapshot_filepath": "",
          "launch_avd_launch_binary_name": "emulator",
          "launch_avd_additional_options": "-gpu on -no-boot-anim -partition-size 2048 -wipe-data -skin \"1080x1920\""
        }
    ]
}

The difference is that I had to add \ before quoting marks which surrounds screen size as my fastlane would not run with them. JSON formatting falls apart.

  1. I didn't have any SDK for Android 21 so I have downloaded everything via Android Studio. You can try to bring versions of your tools to the similar state, maybe it will help:

a) SDK Manager API: Screen_Shot_2017_04_21_at_00_25_07
how do you upload pictures
b) SDK Tools Tools: Screen_Shot_2017_04_21_at_00_25_28 c) AVD Manager - image of AVD: Screen_Shot_2017_04_21_at_00_28_59

  1. Part of my terminal where it just had worked:
    
    [00:20:09]: Preparing commands for Android ADB
    [00:20:09]: Preparing parameters and commands for emulator: Test-Emulator-API21_1
    [00:20:09]: Successfully created tmp output file for AVD: Test-Emulator-API21_1. File: /var/folders/12/c6c0nn3d20788xz63zx53td00000gn/T/emulator_output20170421-36035-12t0u8a
    [00:20:09]: Configuring environment in order to launch emulators: 
    [00:20:09]: Getting avaliable AVDs
    [00:20:09]: $ /Users/F1sherKK/Library/Android/sdk/tools/bin/avdmanager list avd
    [00:20:11]: ▸ Available Android Virtual Devices:
    [00:20:11]: ▸ Name: Test-Emulator-API23-Nexus-5-0
    [00:20:11]: ▸ Device: Nexus 5X (Google)
    [00:20:11]: ▸ Path: /Users/F1sherKK/.android/avd/Test-Emulator-API23-Nexus-5-0.avd
    [00:20:11]: ▸ Target: Google APIs (Google Inc.)
    [00:20:11]: ▸ Based on: Android 6.0 (Marshmallow) Tag/ABI: google_apis/x86_64
    [00:20:11]: ▸ Skin: nexus_5x
    [00:20:11]: ▸ Sdcard: 100M
    [00:20:11]: ▸ ---------
    [00:20:11]: ▸ Name: Test-Emulator-API23-Nexus-5-1
    [00:20:11]: ▸ Device: Nexus 5X (Google)
    [00:20:11]: ▸ Path: /Users/F1sherKK/.android/avd/Test-Emulator-API23-Nexus-5-1.avd
    [00:20:11]: ▸ Target: Google APIs (Google Inc.)
    [00:20:11]: ▸ Based on: Android 6.0 (Marshmallow) Tag/ABI: google_apis/x86_64
    [00:20:11]: ▸ Skin: nexus_5x
    [00:20:11]: ▸ Sdcard: 100M
    [00:20:11]: ▸ ---------
    [00:20:11]: ▸ Name: Test-Emulator-API23-Nexus-5-2
    [00:20:11]: ▸ Device: Nexus 5X (Google)
    [00:20:11]: ▸ Path: /Users/F1sherKK/.android/avd/Test-Emulator-API23-Nexus-5-2.avd
    [00:20:11]: ▸ Target: Google APIs (Google Inc.)
    [00:20:11]: ▸ Based on: Android 6.0 (Marshmallow) Tag/ABI: google_apis/x86_64
    [00:20:11]: ▸ Skin: nexus_5x
    [00:20:11]: ▸ Sdcard: 100M
    [00:20:11]: AVD with name 'Test-Emulator-API21_1' does not exist. Creating new AVD.
    [00:20:11]: $ echo "no" | /Users/F1sherKK/Library/Android/sdk/tools/bin/avdmanager create avd --name "Test-Emulator-API21_1" --package "system-images;android-21;google_apis;x86_64" --device "Nexus 5X" --tag google_apis --abi x86_64 
    [00:20:16]: Restarting adb
    [00:20:16]: $ /Users/F1sherKK/Library/Android/sdk/platform-tools/adb kill-server
    [00:20:16]: $ /Users/F1sherKK/Library/Android/sdk/platform-tools/adb start-server
    [00:20:19]: ▸ * daemon not running. starting it now at tcp:5037 *
    [00:20:19]: ▸ * daemon started successfully *
    [00:20:19]: Attemting to apply custom config to Test-Emulator-API21_1
    [00:20:19]: No config file found for AVD 'Test-Emulator-API21_1'. AVD won't have config.ini applied.
    [00:20:19]: Launching all AVDs at the same time.
    [00:20:19]: Waiting for AVDs to finish booting.
    [00:20:19]: Performig wait for ADB boot
    [00:20:19]: $ /Users/F1sherKK/Library/Android/sdk/emulator/emulator -port 5556 -avd Test-Emulator-API21_1  -gpu on -no-boot-anim -partition-size 2048 -wipe-data -skin "1080x1920" &>/var/folders/12/c6c0nn3d20788xz63zx53td00000gn/T/emulator_output20170421-36035-12t0u8a&
    [00:20:29]: $ /Users/F1sherKK/Library/Android/sdk/platform-tools/adb devices | grep [0-9] | tr -s " " " | cut -d"
    [00:20:29]: ▸ emulator-5556 offline
    [00:20:39]: $ /Users/F1sherKK/Library/Android/sdk/platform-tools/adb devices | grep [0-9] | tr -s " " " | cut -d"
    [00:20:39]: ▸ emulator-5556 device
    [00:20:39]: Wait for ADB boot completed with success
    [00:20:39]: Performing wait for params: dev.bootcomplete, sys.boot_completed, init.svc.bootanim.
    [00:20:46]: $ /Users/F1sherKK/Library/Android/sdk/platform-tools/adb devices | grep [0-9] | tr -s " " " | cut -d"
    [00:20:46]: ▸ emulator-5556 device
    [00:20:46]: AVDs Booted!
    [00:20:46]: Starting tests
    [00:20:46]: Using gradle task.
    [00:20:46]: $ ANDROID_SERIAL= ./gradlew spoon -PspoonPackage=com.azimo.sendmoney.instrumentation.azimoTestCases.bddTests.functional.AuthFlow -PspoonTestLogDir=bddFunction/AuthFlow
    [00:20:47]: ▸ Parallel execution is an incubating feature.
    [00:21:40]: ▸ The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.

(...)



4. I have made sure I have committed and sent as *.gem all code. So version 1.4.1 is most recent one.

5. About your question about downgrading to 1.3.1, it won't work since build tools 25.0.2 as there was new binaries handling AVD launch announced. You stopped using android binary and started using avdmanager instead and thats what 1.4+ is for.

Check the differences for now. I will have to look at code and "imagine what could go wrong there". I hope we will make it somehow though.
deepanshumadan commented 7 years ago

thanks @FisherKK for looking into it. I didn't send you the entire config, I have 6 devices in the config (same device configurations). I just tested it works fine for 2 devices, for 6 it gets stuck. I also made sure i am giving 12 gb memory to HAXm, but still its getting stuck there for 6 devices. and this started happening just after i updated the plugin to 1.4.1

FisherKK commented 7 years ago

I wonder if you aren't increasing RAM allowance per AVD too much. How about you try decreasing those 2048 values and number of AVD and increase little by little to see how it reacts?

FisherKK commented 7 years ago

Hey @deepanshumadan I wonder if you managed to fix your problem. If not then I did something that might help you. Plugin ver was updated to 1.5.0.

I have rewritten whole "wait for params" process. Now you will be able to:

Add them like that with any combination you wish:

automated_test_emulator_run(
    (... rest of params)
    AVD_wait_for_bootcomplete: true,
    AVD_wait_for_boot_completed: true,
    AVD_wait_for_bootanim: false
)