New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 748665 link

Starred by 1 user

Issue metadata

Status: Archived
Owner:
Last visit > 30 days ago
Closed: Aug 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug

Blocking:
issue 730144



Sign in to add a comment

cros-disks unit tests fail on loopback device

Project Member Reported by bmgordon@chromium.org, Jul 25 2017

Issue description

When the root device inside the chroot is a loopback device, cros-disks unit tests fail to find the root device.
 
Blocking: 730144
Project Member

Comment 2 by bugdroid1@chromium.org, Jul 26 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/4e1b25b832074338b930c2d4748f6be14cf5a26f

commit 4e1b25b832074338b930c2d4748f6be14cf5a26f
Author: Benjamin Gordon <bmgordon@chromium.org>
Date: Wed Jul 26 23:46:50 2017

cros-disks: Support loopback root in unit tests

The unit tests currently assume that the root device is
  1. Not the same device as /dev/loop0 by name
  2. Not a loopback device in general
  3. On a partitioned disk

These assumptions become incorrect as soon as the chroot is mounted from
a loopback device (coming in crrev.com/c/553462).  Fix these assumptions
by explicitly searching for devices that have the necessary properties.

BUG= chromium:748665 , chromium:730144
TEST=Ran unit tests inside a loopback-based chroot and regular chroot.

Change-Id: I176332790d3c9fa6a8555784c6716bcbab151e62
Reviewed-on: https://chromium-review.googlesource.com/585694
Commit-Ready: Benjamin Gordon <bmgordon@chromium.org>
Tested-by: Benjamin Gordon <bmgordon@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>

[modify] https://crrev.com/4e1b25b832074338b930c2d4748f6be14cf5a26f/cros-disks/udev_device_unittest.cc

Project Member

Comment 3 by bugdroid1@chromium.org, Jul 28 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/third_party/rootdev/+/fc570685c1ca4acb871c706a66d0493b5e92c7c9

commit fc570685c1ca4acb871c706a66d0493b5e92c7c9
Author: Benjamin Gordon <bmgordon@chromium.org>
Date: Fri Jul 28 22:04:27 2017

rootdev: Strip partitions less aggressively

In device names like dm-N or loopN, the N is not a partition number and
should not be stripped off.  These can arise for example if run inside a
chroot mounted on a loopback device.

BUG= chromium:748665 , chromium:730144
TEST=New unit tests.

Change-Id: If7ecacbfcf00690376cb4ffc75baa45422579085
Reviewed-on: https://chromium-review.googlesource.com/585652
Commit-Ready: Benjamin Gordon <bmgordon@chromium.org>
Tested-by: Benjamin Gordon <bmgordon@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>

[modify] https://crrev.com/fc570685c1ca4acb871c706a66d0493b5e92c7c9/rootdev_test.sh
[modify] https://crrev.com/fc570685c1ca4acb871c706a66d0493b5e92c7c9/rootdev.c

Project Member

Comment 4 by bugdroid1@chromium.org, Aug 1 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/bda72e34c19dd1320b6aff64fd256bac0b9a4bf3

commit bda72e34c19dd1320b6aff64fd256bac0b9a4bf3
Author: Benjamin Gordon <bmgordon@chromium.org>
Date: Tue Aug 01 21:39:53 2017

cros-disks: Fix GetBootDevicePath in unit tests

rootdev() returns 0 on success, so GetBootDevicePath has been testing
the result backwards.  I think this has been working in the past because
rootdev sometimes sets the path even when it fails and most of the tests
didn't depend on having the correct boot device.  The incorrect logic
started failing when the chroot is on a loopback device for x86_64
boards.

BUG= chromium:748665 , chromium:730144
TEST=Sent to trybots with http://crrev.com/c/553462 to confirm inside a
  loopback-based chroot.

Change-Id: Id6ed829667f0055ce6e6ddde292bad18ddc253a3
Reviewed-on: https://chromium-review.googlesource.com/596408
Commit-Ready: Benjamin Gordon <bmgordon@chromium.org>
Tested-by: Benjamin Gordon <bmgordon@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>

[modify] https://crrev.com/bda72e34c19dd1320b6aff64fd256bac0b9a4bf3/cros-disks/udev_device_unittest.cc

Status: Fixed (was: Started)

Comment 6 by dchan@chromium.org, Jan 22 2018

Status: Archived (was: Fixed)

Sign in to add a comment