skia2/infra/bots/recipe_modules/flavor
Leandro Lovisolo 17fbcd145b ios.py: Bugfix to prevent iOS tasks from failing with "Error: ImageMountFailed".
This CL fixes a bug in the logic that checks whether there's an image mounted on the attached iOS device.

Currently this is determined by checking whether strings "ImagePresent: true" or "ImageSignature:" are present in the output of command "ideviceimagemounter --list". However, these strings do not match the command's actual output:

  # No image mounted.
  $ ideviceimagemounter --list
  Status: Complete

  # Image mounted (fake signature for illustrative purposes).
  $ ideviceimagemounter --list
  ImageSignature[1]:
   0: Rm9yIGlsbHVzdHJhdGl2ZSBwdXJwb3NlcyBvbmx5LiBUaGlzIGlzIG5vdCBhIHJlYWwgc2lnbmF0dXJlLg==
  Status: Complete

As is, the recipe fails to detect that an image is already mounted on the attached iOS device. The recipe then tries to mount one, which makes the "ideviceimagemounter" command fail with "Error: ImageAlreadyMounted". The following example shows how to reproduce this error:

  # Initially no image is mounted.
  $ ideviceimagemounter --list
  Status: Complete

  # Mount an image.
  $ ideviceimagemounter DeveloperDiskImage.dmg DeveloperDiskImage.dmg.signature
  Uploading DeveloperDiskImage.dmg
  done.
  Mounting...
  Done.
  Status: Complete

  # Verify that the image is mounted.
  $ ideviceimagemounter --list
  ImageSignature[1]:
   0: Rm9yIGlsbHVzdHJhdGl2ZSBwdXJwb3NlcyBvbmx5LiBUaGlzIGlzIG5vdCBhIHJlYWwgc2lnbmF0dXJlLg==
  Status: Complete

  # Try to mount an image when one is already mounted.
  $ ideviceimagemounter DeveloperDiskImage.dmg DeveloperDiskImage.dmg.signature
  Uploading DeveloperDiskImage.dmg
  done.
  Mounting...
  Error: ImageMountFailed

Checking for presence of string "ImageSignature" in the ideviceimagemounter command's output seems to solve the problem.

In the process I also discovered that self._run() requires keyword argument stdout=self.m.raw_io.output() in order to return the command's output. As is, the returned stdout is always blank.

Note to reviewer:
- Patchsets 1 to 11 iterate on a potential fix.
- Patchset 12 reproduces the bug. See the failing tryjob.
- Patchset 13 tries the fix. See the successful tryjob.
- Patchsets 14+ clean up the CL.

Change-Id: I3ca1cdbf4bfa450c3e87d6d87b5f615f28c4aaba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281058
Reviewed-by: Weston Tracey <westont@google.com>
Commit-Queue: Leandro Lovisolo <lovisolo@google.com>
2020-04-02 19:18:06 +00:00
..
examples [recipes] Move app_name into flavor.setup() 2020-02-27 18:06:15 +00:00
resources [infra] Switch iOS to updated libimobiledevice. 2020-02-21 16:21:20 +00:00
__init__.py [recipes] Minor import cleanup 2020-03-06 19:06:10 +00:00
android.py [recipes] Move app_name into flavor.setup() 2020-02-27 18:06:15 +00:00
api.py [recipes] Move app_name into flavor.setup() 2020-02-27 18:06:15 +00:00
chromebook.py [recipes] Move app_name into flavor.setup() 2020-02-27 18:06:15 +00:00
default.py [recipes] Move app_name into flavor.setup() 2020-02-27 18:06:15 +00:00
docker.py [recipes] Move app_name into flavor.setup() 2020-02-27 18:06:15 +00:00
ios.py ios.py: Bugfix to prevent iOS tasks from failing with "Error: ImageMountFailed". 2020-04-02 19:18:06 +00:00
ssh.py [recipes] Move app_name into flavor.setup() 2020-02-27 18:06:15 +00:00
valgrind.py [recipes] Move app_name into flavor.setup() 2020-02-27 18:06:15 +00:00
win_ssh.py [recipes] Move app_name into flavor.setup() 2020-02-27 18:06:15 +00:00