chromiumos/platform/update_engine.git
11 months agoNever defer updates on interactive checks. 64/66864/3 master
Chris Sosa [Fri, 23 Aug 2013 21:46:02 +0000 (14:46 -0700)]
Never defer updates on interactive checks.

Looks like we had a bug when adding the deferred logic. We should never
defer on interactive checks as it's really confusing to a user who's
doing an interactive check. This change is simple enough but I've changed
all unittests that tested deferred behavior to also make sure they allow
an update if interactive is set.

BUG=chromium:274056
TEST=Unittests

Change-Id: Ib63dbd20e64bed2da84e68c96291335e00e944a2
Reviewed-on: https://gerrit.chromium.org/gerrit/66864
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>

11 months agoAllow HTTP urls when device policy doesn't specify. 32/66732/3
Chris Sosa [Thu, 22 Aug 2013 23:45:17 +0000 (16:45 -0700)]
Allow HTTP urls when device policy doesn't specify.

BUG=chromium:277835
TEST=Unittest

Change-Id: I638248dcbdbdaf48e38b79638b2348aa6c1400fb
Reviewed-on: https://gerrit.chromium.org/gerrit/66732
Tested-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>

11 months agoRemove unneeded pcrecpp dependency. 81/66381/2
Andrew de los Reyes [Tue, 20 Aug 2013 16:53:36 +0000 (09:53 -0700)]
Remove unneeded pcrecpp dependency.

BUG=None
TEST=emerge-link -av1 update_engine built without issue.

Change-Id: I1287c808fa363f42cff71ba22684b600cf164722
Reviewed-on: https://gerrit.chromium.org/gerrit/66381
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Andrew de los Reyes <adlr@chromium.org>
Commit-Queue: Andrew de los Reyes <adlr@chromium.org>

12 months agoAdd Installer.UpdatesAbandonedEventCount metric. 28/65328/3 release-R30-4537.B
Alex Deymo [Fri, 9 Aug 2013 04:10:02 +0000 (21:10 -0700)]
Add Installer.UpdatesAbandonedEventCount metric.

This patch adds a new metric similar to
Installer.UpdatesAbandonedCount that reports the number of abandoned
payloads every time a payload is abandoned. A payload is considered
"abandoned" when it was already attempted but not finished for any
reason, and a newer payload is avaibled. In this situation,
update_engine drops the previous payload and starts again with the
new one.

Every time a payload is abandoned, the new metric
Installer.UpdatesAbandonedEventCount is sent with the number of
consecutive different abandoned payloads since the last successful
update. A high number of entries greater than 1 in this metric will
imply that we are releasing new payloads too often, or that the users
are taking too long to download an update.

Finally, when a payload is successfully applied, the total number of
abandoned payloads since the previous successful update is sent as
the the metric Installer.UpdatesAbandonedCount.

BUG=chromium:261370
TEST=unittests

Change-Id: I47054b541c4700a86183461a5cf92830883ea4f3
Reviewed-on: https://gerrit.chromium.org/gerrit/65328
Commit-Queue: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
12 months agounittest: Remove temporary directories. 86/65286/3
Alex Deymo [Fri, 9 Aug 2013 04:21:48 +0000 (21:21 -0700)]
unittest: Remove temporary directories.

The CreateExtImageAtPath() test helper function creates an image
and mounts it at a randomly genereted path directory. Nevertheless,
this function wasn't removing the created mount path at the end
since the mount path is a directory and not a regular file. This
was leaving a lot of empty temporary directories in /tmp and
printing the following error message during test:

[0808/211221:ERROR:utils.h(401)] Unable to unlink path /tmp/UpdateEngineTests_mnt-fymh70: Is a directory

This patch fixes that problem removing the directory when the
function exits.

BUG=None
TEST=unittest pass and doesn't print the mentioned error line.

Change-Id: Iec1d38b0fce437a3b5ecc26ae8c933b8ff1bba80
Reviewed-on: https://gerrit.chromium.org/gerrit/65286
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>

12 months agoCorrectly report firmware update failure if RO needs update. 41/63841/4 stabilize-4512.B
Don Garrett [Wed, 31 Jul 2013 01:46:31 +0000 (18:46 -0700)]
Correctly report firmware update failure if RO needs update.

If the RO Firmware needs updating but can't be because it's
really RO, then report a new erro code (43) back to Omaha.

This normally only happens during board bringup when the RO
firmware is locked prematurely. We want to know these devices
exist so we can replace them.

BUG=chromium:218555
TEST=Build/unittests. Did NOT test on hardware with bug.

Change-Id: I383a999f1b175c378bef936c55d87565d8113336
Reviewed-on: https://gerrit.chromium.org/gerrit/63841
Commit-Queue: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
12 months agoRemove all mentions of Set/Get Track and hard-coding of canary-channel. 74/63674/4
Chris Sosa [Fri, 26 Jul 2013 00:02:59 +0000 (17:02 -0700)]
Remove all mentions of Set/Get Track and hard-coding of canary-channel.

This CL removes the deprecated functionality of Set/Get Track previously
used to change channels. Now that the UI is using Set/Get Channel we no
longer need these methods. I've also gone ahead and fixed the long standing
bug of needed to do an update check before testing channel change.

I've also added the testing of allow powerwash functionality to update_engine
client to better test this feature.

BUG=chromium:221850
TEST=unittests + update_engine_client with channel change and allowing
powerwash and not allowing powerwash. Confirmed the versions were as expected (
when going more stable we send version 0.0.0.0 when we allow powerwash vs the
actual version when not).

Change-Id: I87297f7e7e103bb25e62f2d896e155e758030ead
Reviewed-on: https://gerrit.chromium.org/gerrit/63674
Commit-Queue: Chris Sosa <sosa@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
12 months agoAdd support for /dev/ubiblockX_0 install devices 20/64020/5
Liam McLoughlin [Thu, 1 Aug 2013 01:47:46 +0000 (18:47 -0700)]
Add support for /dev/ubiblockX_0 install devices

BUG=none
TEST=Run unittests, passed

Change-Id: Ie93c3d00370ca80d2a4441817ada4615408c0ba9
Reviewed-on: https://gerrit.chromium.org/gerrit/64020
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Liam McLoughlin <lmcloughlin@chromium.org>
Tested-by: Liam McLoughlin <lmcloughlin@chromium.org>
12 months agoAU/unittest: allow use of a parametric update completed marker 40/63840/2 firmware-pit-4482.B
Gilad Arnold [Tue, 30 Jul 2013 23:01:13 +0000 (16:01 -0700)]
AU/unittest: allow use of a parametric update completed marker

This should allow unit tests to be run in parallel. We introduce
a private constructor available only to specific test classes of
UpdateAttempter, which allows us to set a different marker.

Note that, in all unit tests that do not specifically make use of this
marker, we actually want UpdateAttempter to ignore it entirely. I'm not
entirely positive whether not ignoring would lead to interferences
between concurrently run tests, but I think it's better to err on the
safe side.  (The marker is never ignored when used with any code other
than UpdateAttempter unit testing code.)

BUG=chromium:236465
TEST=Unit tests pass incl ignore semantics when not needed

Change-Id: I30fbed2ae2c21368d79127ed44811007e2a66e77
Reviewed-on: https://gerrit.chromium.org/gerrit/63840
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

12 months agoAdd version information to install plan and GetStatus. 75/63675/3
Chris Sosa [Tue, 30 Jul 2013 00:27:33 +0000 (17:27 -0700)]
Add version information to install plan and GetStatus.

As per the TODO this information is useful for debugging and testing
changes i.e. I'd like to know what version I'm updating to. GetStatus
already supports getting this version but we never populate the field.

BUG=chromium:264505
TEST=Unittests + ran update_engine_client -update which uses GetStatus
to communicate status.

Change-Id: I5332e2f206d92aedba509cd5469e9610c88bcd03
Reviewed-on: https://gerrit.chromium.org/gerrit/63675
Commit-Queue: Chris Sosa <sosa@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
12 months agoDon't send metrics on update_engine restart without reboot. 27/63227/5 factory-pit-4471.B
Alex Deymo [Wed, 24 Jul 2013 19:01:01 +0000 (12:01 -0700)]
Don't send metrics on update_engine restart without reboot.

Certain operations are performed on update_engine start that are
intended to be performed only right after boot. For example, when
an update is applied, a few metrics are sent during the next reboot
when update_engine starts. If the update is applied and
update_engine crashes before reboot, the new update_engine will send
the metrics as if the machine was rebooted.

This patch avoids this problem checking the
SystemState::system_rebooted() method.

BUG=chromium:260990
TEST=unittests

Change-Id: Ib360b1886db38e3abd926455edfa1eb657b2d621
Reviewed-on: https://gerrit.chromium.org/gerrit/63227
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>

12 months agoAU: remove integration_unittest.cc 48/63148/2 factory-4455.B
Gilad Arnold [Tue, 23 Jul 2013 23:46:43 +0000 (16:46 -0700)]
AU: remove integration_unittest.cc

This file has never been built, and likely won't ever be built the way
it is.

BUG=chromium:208655
TEST=Has no impact on the build, nothing to test

Change-Id: I0144778b35de36ad54ec2b92e3e84d76f7af5793
Reviewed-on: https://gerrit.chromium.org/gerrit/63148
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

12 months agoAU: remove obsolete proxy resolver code 47/63147/2
Gilad Arnold [Tue, 23 Jul 2013 23:41:43 +0000 (16:41 -0700)]
AU: remove obsolete proxy resolver code

The module chrome_proxy_resolver has been long obsoleted by
chrome_browser_proxy_resolver, only that it kept living in our codebase,
if only for the use of a single static method, which had nothing to do
with proxy resolution and in fact is Curl specific.  This CL removes it
along with its build/execution dependencies.

BUG=chromium:208655
TEST=Builds fine and unit tests running

Change-Id: Iff50c2c75451e5f3ddbc27c5a90a8b1a421a5d8d
Reviewed-on: https://gerrit.chromium.org/gerrit/63147
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

12 months agoAU/unittest: eliminate use of fixed named test directories 54/62954/4
Gilad Arnold [Tue, 23 Jul 2013 01:32:09 +0000 (18:32 -0700)]
AU/unittest: eliminate use of fixed named test directories

This fixes race conditions when tests are run in parallel.

Note that integration_unittest.cc is currently not (never was?) being
compiled, so all changes are lexically oriented and visually verified
only.

BUG=chromium:236465
TEST=Tests successful

Change-Id: I6181a2cc0c10f6fcf8f982fc263c7a02e5082eeb
Reviewed-on: https://gerrit.chromium.org/gerrit/62954
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

12 months agoSend an UMA metric when failed to boot into the new partition. 15/61815/8
Alex Deymo [Sat, 13 Jul 2013 03:21:15 +0000 (20:21 -0700)]
Send an UMA metric when failed to boot into the new partition.

When a payload is successfully applied, the /other/ partition
is marked as valid and a reboot is needed, the reboot into this
new partition can fail due to several reasons. If than happens,
the firmware can rollback to the previous partition.

When this happens, this fix sends a new UMA metric with the
attempt number of this failing payload.

In order to test this functionality we need to fake the
utils::BootDevice() to emulate a reboot into the same or
a different partition. To achieve this, this function is
moved to a new "HardwareInterface" that can be faked
using the FakeHardware class that can hold similar hardware
related functions. Implementations and unittest were
refactored as needed.

BUG=chromium:243572
TEST=unittests

Change-Id: I1a4242df0bd61e2718ab881ead603b1d3705b877
Reviewed-on: https://gerrit.chromium.org/gerrit/61815
Commit-Queue: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
12 months agoAU/unittest: fix FileWriterTest to be able to run in parallel 53/62953/2
Gilad Arnold [Tue, 23 Jul 2013 00:57:21 +0000 (17:57 -0700)]
AU/unittest: fix FileWriterTest to be able to run in parallel

Eliminated use of fixed paths.

BUG=chromium:236465
TEST=Tests successful

Change-Id: I18684e35a9b775a111efc85281d05fdde2511326
Reviewed-on: https://gerrit.chromium.org/gerrit/62953
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

12 months agoAU/unittest: eliminate use of kMountPath 52/62952/2
Gilad Arnold [Tue, 23 Jul 2013 00:54:52 +0000 (17:54 -0700)]
AU/unittest: eliminate use of kMountPath

This change should allow multiple tests to be run in parallel, including
a whole set of DeltaPerformerTest cases, a case of
FilesystemIteratorTest, a case of FilesystemCopierActionTest, and a case
of UtilsTest.

BUG=chromium:236465
TEST=Tests successful

Change-Id: I47a2afccbece5b0a9e637b3d80af1bf7bbf3623e
Reviewed-on: https://gerrit.chromium.org/gerrit/62952
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

12 months agoAU/unittest: minor cleanup 26/62826/3 stabilize-4443.B
Gilad Arnold [Mon, 22 Jul 2013 13:47:52 +0000 (06:47 -0700)]
AU/unittest: minor cleanup

BUG=None
TEST=Tests pass

Change-Id: I1b054b611f41df5652d1faed2f40310ed60b65e2
Reviewed-on: https://gerrit.chromium.org/gerrit/62826
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

12 months agoAU/unittest: fix to OmahaResponseHandlerAction unit tests 25/62825/3
Gilad Arnold [Mon, 22 Jul 2013 12:39:26 +0000 (05:39 -0700)]
AU/unittest: fix to OmahaResponseHandlerAction unit tests

The said class uses a fixed named file for communicating data (in this
case, a deadline marker) to Chrome, which causes unit tests to fail when
run in parallel. This change makes this file parametric for testing
purposes, allowing the tests to be run in parallel.

Note that we only override the file name for tests that actually examine
the file. For other invocations there may still be race conditions when
writing to the marker file, but they should not affect the outcome of
the tests.

BUG=chromium:236465
TEST=Tests successful

Change-Id: Ieb2a3ef1b4d9c5d5d2e06cf8e281eb832b2a9ff8
Reviewed-on: https://gerrit.chromium.org/gerrit/62825
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

12 months agoAU/unittest: UtilsTest uses unique directories for testing 27/62327/6
Gilad Arnold [Tue, 16 Jul 2013 13:44:45 +0000 (06:44 -0700)]
AU/unittest: UtilsTest uses unique directories for testing

This will allow tests to be run in parallel.

BUG=chromium:236465
TEST=Tests successful; create/remove uniquely named directories

Change-Id: Iea9f6b4fb4e265a294d6f8dec14d446d0c7f8312
Reviewed-on: https://gerrit.chromium.org/gerrit/62327
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
12 months agoAU/unittest: DeltaDiffGeneratorTest uses uniquely named temp files 26/62326/6
Gilad Arnold [Tue, 16 Jul 2013 10:00:20 +0000 (03:00 -0700)]
AU/unittest: DeltaDiffGeneratorTest uses uniquely named temp files

This should allow tests to be run in parallel.

BUG=chromium:236465
TEST=Tests successful; create/remove uniquely named files

Change-Id: I4df126d2183214fa62ed84cfe43ba7a36124e7c2
Reviewed-on: https://gerrit.chromium.org/gerrit/62326
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
12 months agoAU/unittest: postinstall tests use uniquely named stateful + working directories 64/60864/11
Gilad Arnold [Wed, 3 Jul 2013 13:19:09 +0000 (06:19 -0700)]
AU/unittest: postinstall tests use uniquely named stateful + working directories

This should allow these tests to be run in parallel. Also includes an
extension to PostinstallRunnerAction and two global powerwash marker
utility functions to allow testing with uniquely named marker file paths
(necessary to avoid race conditions when multiple tests are run in
parallel).

BUG=chromium:236465
TEST=Uniquely named directories created, used and removed.

Change-Id: I5dde0c0732c51e9e3bb2240cf7e0cac03bcde529
Reviewed-on: https://gerrit.chromium.org/gerrit/60864
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
12 months agoAU/unittest: FilesystemIteratorTest uses uniquely named temp files/directories 47/60647/10
Gilad Arnold [Mon, 1 Jul 2013 13:45:41 +0000 (06:45 -0700)]
AU/unittest: FilesystemIteratorTest uses uniquely named temp files/directories

This should allow tests to be run in parallel. Also, unified directory
creation/removal logic across tests.

BUG=chromium:236465
TEST=Uniquely named test image files/directories used

Change-Id: Ide4035f206beeb8294cba42d762243ba502b23f7
Reviewed-on: https://gerrit.chromium.org/gerrit/60647
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
12 months agoAU/unittest: use uniquely named test directories in OmahaRequestParamsTest 46/60646/10
Gilad Arnold [Mon, 1 Jul 2013 13:24:42 +0000 (06:24 -0700)]
AU/unittest: use uniquely named test directories in OmahaRequestParamsTest

This should prevent name clashes when unit tests are run in parallel.

BUG=chromium:236465
TEST=Uniquely named test directories used

Change-Id: I364580eaea34dda03ff74d95fc1717c1afa89822
Reviewed-on: https://gerrit.chromium.org/gerrit/60646
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
12 months agoAU/unittest: use unique files in BzipExtentWriterTest.ChunkedTest 45/60645/10
Gilad Arnold [Mon, 1 Jul 2013 11:25:55 +0000 (04:25 -0700)]
AU/unittest: use unique files in BzipExtentWriterTest.ChunkedTest

Stop using constant file names, which cause conflicts (and hence test
failures) when run in parallel.  Also removed whitespaces at end of
lines.

BUG=chromium:236465
TEST=Test uses uniquely named temporary files

Change-Id: Ia75b94ac9b36c8c256bdfc06e9b761dbcab5482c
Reviewed-on: https://gerrit.chromium.org/gerrit/60645
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
12 months agoAU/unittest: test code spawns local HTTP server with unique port 37/60637/9
Gilad Arnold [Mon, 1 Jul 2013 09:19:26 +0000 (02:19 -0700)]
AU/unittest: test code spawns local HTTP server with unique port

With this change, unit testing code spawns a local (test) HTTP server
that listens on a unique TCP port. It is up to the server to allocate an
available port number (we use auto-allocation via bind) and report it
back (by default, via its stdout), which the unit test process parses.
Also part of this CL:

- Made the port a property of the server object, rather than a global
  value. This makes more sense in general and may lend itself better to
  future testing scenarios, such as running multiple servers in
  parallel.

- Removed a redundant field (validate_quit) from PythonHttpServer and
  simplified/robustified its shutdown procedure: if the server is known
  to be responsive, a graceful signal is sent (via wget); otherwise, or
  if the former failed, a more brutral signal(SIGKILL) is used.

- http_fetcher_unittest code now properly kills test_http_server if the
  latter is unresponsive.

BUG=chromium:236465
TEST=Test server spawned with unique port

Change-Id: I699cd5019e4bd860f38205d84e5403cfb9b39f81
Reviewed-on: https://gerrit.chromium.org/gerrit/60637
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
12 months agoAU/unittest: new syscall wrappers for testing 25/62325/3
Gilad Arnold [Tue, 16 Jul 2013 13:44:37 +0000 (06:44 -0700)]
AU/unittest: new syscall wrappers for testing

BUG=chromium:236465
TEST=None

Change-Id: I405aedbd719c8412cd2dbe81b8cf6d7351c9994b
Reviewed-on: https://gerrit.chromium.org/gerrit/62325
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

13 months agoChannelDelegated policy: if value is missing, assume it is false. 98/62498/2
Chris Sosa [Thu, 18 Jul 2013 17:36:39 +0000 (10:36 -0700)]
ChannelDelegated policy: if value is missing, assume it is false.

We missed another use of the same check. This should fix that call.

BUG=chromium:261400
TEST=unittests.

Change-Id: I88cb4d22905c4c7953c63fdafaa83bd7547dafa1
Reviewed-on: https://gerrit.chromium.org/gerrit/62498
Commit-Queue: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
13 months agoUse the PhysicalTechnology for VPN connections. 26/61926/3
Alex Deymo [Mon, 15 Jul 2013 19:09:51 +0000 (12:09 -0700)]
Use the PhysicalTechnology for VPN connections.

When a VPN connection is used to download an update, the Type property
is decoded as kNetUnknown, allowing by default the update over that
connection. If the VPN connection runs over a Cellular connection,
the device policy or user setting should be checked.

This patch retrieves the PhysicalTechnology property, when present,
for VPN connections instead of the Type property, effectively using
the real connection type instead of the unknown VPN type.

BUG=chromium:210775
TEST=sudo ./update_engine_unittests

Change-Id: I39506724ca24bf14360fe00129be1eb9ff2c460c
Reviewed-on: https://gerrit.chromium.org/gerrit/61926
Reviewed-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
13 months agoAU: Pass open file descriptor to bspatch through /proc/self/fd. 63/61663/2
Darin Petkov [Fri, 12 Jul 2013 12:37:06 +0000 (14:37 +0200)]
AU: Pass open file descriptor to bspatch through /proc/self/fd.

It seems that /dev/fd is provided for legacy/compatibility
reasons. /proc/self/fd seems more intuitive and portable anyway, and
exists on sonic while /dev/fd doesn't.

BUG=chromium:259782
TEST=delta update on sonic; try bots

Change-Id: I985f813e38fce643479b6a51854d88ca28aac728
Reviewed-on: https://gerrit.chromium.org/gerrit/61663
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: Darin Petkov <petkov@chromium.org>

13 months agoDon't allow rollback on the stable-channel. 87/61687/4
Chris Sosa [Fri, 12 Jul 2013 18:39:53 +0000 (11:39 -0700)]
Don't allow rollback on the stable-channel.

This change explicitly disallows rollback on the stable-channel.

BUG=chromium:252539
TEST=unittests + on device.

Change-Id: I71caf95daae185790cf9fb0fda790eaf960bbe6b
Reviewed-on: https://gerrit.chromium.org/gerrit/61687
Tested-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>

13 months agoDon't allow rollback when we are enterprise enrolled. 45/61645/2
Chris Sosa [Fri, 12 Jul 2013 00:59:24 +0000 (17:59 -0700)]
Don't allow rollback when we are enterprise enrolled.

As stated (and verified) by the device_policy protobuf, we can determine
whether a device is enterprise enrolled by checking if GetOwner is empty.
We use this knowledge to not allow rollback when powerwash is also requested (
the default).

As part of this CL I've figured out how to unittest Rollback and added tests
for both enterprise and non-enterprise rollback.

BUG=chromium:254829
TEST=Tested on both an enrolled and non-enrolled device. Verified only the
latter actually did a powerwash while the other aborted correctly. Also ran
new unittests

Change-Id: Idfe6bfef88819fe1bab7da6b31854faf7642c9ce
Reviewed-on: https://gerrit.chromium.org/gerrit/61645
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
13 months agoPrefs: Implement and use Prefs::GetBoolean/SetBoolean. 52/61352/2 factory-pit-4390.B firmware-falco_peppy-4389.B firmware-leon-4389.26.B firmware-wolf-4389.24.B
Alex Deymo [Tue, 9 Jul 2013 21:34:00 +0000 (14:34 -0700)]
Prefs: Implement and use Prefs::GetBoolean/SetBoolean.

Adds a pair of functions GetBoolean/SetBoolean to the list Prefs
class to read and write persisted boolean values. The stored
values are not compatible with the SetInt64 and will return
false when attempting to get or set a value of the other type.

These functions are now used to store the update over cellular
user setting.

BUG=chromium:213401
TEST=sudo ./update_engine_unittests

Change-Id: I44107e33f8e81ae900671d9ba6a4f5779c2353db
Reviewed-on: https://gerrit.chromium.org/gerrit/61352
Reviewed-by: Joy Chen <joychen@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>

13 months agoAdd Installer.[Full]PayloadAttemptNumber 44/61344/3
Alex Deymo [Tue, 9 Jul 2013 22:26:24 +0000 (15:26 -0700)]
Add Installer.[Full]PayloadAttemptNumber

This patch adds two new metrics with the attempt number of the
current payload. The difference with other similar metrics, like
Installer.AttemptsCount.Total is that this metric is send every
time the PayloadAttemptNumber is incremented, tracking also
abandoned payload attempts.

BUG=chromium:225973
TEST=cros_workon_make update_engine --test

Change-Id: I96828fdf0512bac0e04c63a40383ac46143c5908
Reviewed-on: https://gerrit.chromium.org/gerrit/61344
Commit-Queue: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
13 months agoAdd DBus methods to allow/disallow updates over 3G 16/60716/6
Alex Deymo [Fri, 28 Jun 2013 21:41:39 +0000 (14:41 -0700)]
Add DBus methods to allow/disallow updates over 3G

This fix adds a new DBus pair of methods to allow/disallow the
updates over cellular networks and get the current state of this
setting. The setting is overridden by the device policy and the
SetUpdateOverCellularPermission() method fails if called on an
enrolled device that has the autoupdate settings in the device
policy.

BUG=chromium:213401
TEST=unittests for connection_manager changes. Manual test for the DBus service, see below.

Manual test procedure.
======================
Run on a shell:

1. Test for the default setting.
$ update_engine_client -show_update_over_cellular
[0701/183633:INFO:update_engine_client.cc(371)] Current update over cellular network setting: DISABLED
[0701/183633:INFO:update_engine_client.cc(443)] Done.

2. Test that enable works.
$ update_engine_client -update_over_cellular=yes -show_update_over_cellular
[0701/183655:INFO:update_engine_client.cc(371)] Current update over cellular network setting: ENABLED
[0701/183655:INFO:update_engine_client.cc(443)] Done.

3. Test that disable works.
$ update_engine_client -update_over_cellular=no -show_update_over_cellular
[0701/183659:INFO:update_engine_client.cc(371)] Current update over cellular network setting: DISABLED
[0701/183659:INFO:update_engine_client.cc(443)] Done.

4. Enable again the update over cellular, connect the chromebook to a 3G
and perform an update check.

Change-Id: Ic234a3ef8898b1e60e26277208276a958b7e0d94
Reviewed-on: https://gerrit.chromium.org/gerrit/60716
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
13 months agoAdd Installer.AttemptsCount.Total metric. 51/60951/4
Alex Deymo [Fri, 28 Jun 2013 22:43:46 +0000 (15:43 -0700)]
Add Installer.AttemptsCount.Total metric.

This patch adds a new Installer.AttemptsCount.Total metric that
reports the number of payload attempts until the payload is
successfully applied. To achieve this a new variable persisted in
the preferences directory is added. This variable tracks the number
of attempts for the current payload, beign it a full or a delta
payload.

Unfortunatelly, there is a "PayloadAttemptNumber" variable that
tracks the number of attempts for the current payload, but only
if it is a Full payload since this value is used for the exponential
backoff algorithm used only for Full payloads. To overcome this,
this variable is renamed to "FullPayloadAttemptNumber" and the
new variable, tracking both delta and full payloads, is named
"PayloadAttemptNumber". The setter, getter and unittests are
updated as needed, and a new test is introduced to verify the
difference between these two variables when the involved payload
is a Delta payload.

BUG=chromium:226769
TEST=update_engine_unittests

Change-Id: I33d346d27ee8355f1152ebb829621571fe3a4244
Reviewed-on: https://gerrit.chromium.org/gerrit/60951
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>

13 months agoAU/unittest: parameterize test_http_server port 26/60626/2
Gilad Arnold [Mon, 1 Jul 2013 06:05:50 +0000 (23:05 -0700)]
AU/unittest: parameterize test_http_server port

This eliminates the constant definition of the test HTTP server port,
replacing it with a command-line parameter (which defaults to 8080, the
well-known userland HTTP port). This is needed for allowing parallel
invocations of unit tests.

BUG=chromium:236465
TEST=Passes unit tests

Change-Id: I91904dc360ec1b993cbaae93554fb0dd9e5adaad
Reviewed-on: https://gerrit.chromium.org/gerrit/60626
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

13 months agoAdd Installer.PayloadFormat metric 18/60318/3
Alex Deymo [Fri, 28 Jun 2013 18:02:14 +0000 (11:02 -0700)]
Add Installer.PayloadFormat metric

Adds a new PayloadFormat metric with three different values: Delta, Full
and ForcedFull. The metric is send whenever an update is applied successfully
indicating the type of the used payload. The difference between Full and
ForcedFull is that in the ForcedFull, the request sent to omaha included a
directive saying that a delta payload wasn't accepted, where a Full payload
is one where a delta payload was accepted but a Full payload was provided.

BUG=chromium:225977
TEST=cros_workon_make update_engine --test # Three tests added, one for each condition.

Change-Id: If44cd96df325d320ed327114cc5e5de3d34a5c62
Reviewed-on: https://gerrit.chromium.org/gerrit/60318
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
13 months agoReplace deprecated g_thread_create with g_thread_try_new 01/60001/4
Jungshik Shin [Tue, 25 Jun 2013 23:22:17 +0000 (16:22 -0700)]
Replace deprecated g_thread_create with g_thread_try_new

g_thread_create was deprecated in glib 2.32 (the current glib
we use) and we need to
update glib to 2.34.x to fix complex script shaping bugs in
Chrome's UI area ( http://crbug.com/245783 )

The CL to update glib 2.34.x is at
https://gerrit.chromium.org/gerrit/#/c/59652/

BUG=chromium:254228
TEST=1. Build and run unit tests
     2. Run trybot builds on x86, amd64 and arm

Change-Id: Ia6f58f7d18d6963fe3236bd56e819e38253a7fc8
Reviewed-on: https://gerrit.chromium.org/gerrit/60001
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Jungshik Shin (jungshik at google) <jshin@chromium.org>
Tested-by: Jungshik Shin (jungshik at google) <jshin@chromium.org>
13 months agoBlacklist versions as part of Rollback along with unittests. 18/59518/4
Chris Sosa [Thu, 20 Jun 2013 20:20:30 +0000 (13:20 -0700)]
Blacklist versions as part of Rollback along with unittests.

This CL adds version blacklisting as part of AU Rollback. A few additional
things:

1) Since this pref must persist across rollback I have introduced a
powerwash_safe_prefs as part of system_state that will persist across
powerwashes.
2) Fixed bug where we needed to read the device policy (which is read during an
update_check before Rollback would work).
3) Some refactoring to move pref constants to constants.
4) Passing keepimg into our powerwash command so we don't wipe the old
partitions.

BUG=chromium:252589 chromium:254217
TEST=Unittests + test on device + using rollback with and without powerwash
checking preserve state.

Change-Id: I991fad944594944425fd9941e10b30a919f2b83b
Reviewed-on: https://gerrit.chromium.org/gerrit/59518
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>

13 months agoRemove unnecessary call to the deprecated g_thread_init(). 01/59801/2
Ben Chan [Mon, 24 Jun 2013 18:17:41 +0000 (11:17 -0700)]
Remove unnecessary call to the deprecated g_thread_init().

g_thread_init() has been deprecated since glib 2.32. This CL removes the
unnecessary call to g_thread_init(), so that we can later migrate to
glib 2.34. It also replaces dbus_g_thread_init(), which calls the
deprecated g_thread_supported(), with dbus_threads_init_default()
directly.

BUG=chromium:253025
TEST=Tested the following:
1. Build and run unit tests.
2. Run trybot builds on x86, amd64, and arm platforms.

Change-Id: I30852f1d3525f3d7b5b6cd756d18c2816a28903f
Reviewed-on: https://gerrit.chromium.org/gerrit/59801
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>

13 months agoOnly report non-zero MiB counts 28/59828/2
David Zeuthen [Mon, 24 Jun 2013 20:32:14 +0000 (13:32 -0700)]
Only report non-zero MiB counts

More precisely, only send an UMA event to the following UMA metrics

 Installer.{Successful,Total}MBsDownloadedFrom{Http,Https}Server

if the mechanism (the so-called DownloadSource) was actually
used. Without this patch, we would be reporting a lot of zeroes which
would dominate the histograms and thus, render them less useful than
they could be.

BUG=chromium:253612
TEST=Unittests pass

Change-Id: Ib2d797e9c65eb480e5b97e561495abffcbbfbb5d
Reviewed-on: https://gerrit.chromium.org/gerrit/59828
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
13 months agoAdd Installer.TimeToRebootMinutes metric 32/59132/4
David Zeuthen [Wed, 19 Jun 2013 00:26:50 +0000 (17:26 -0700)]
Add Installer.TimeToRebootMinutes metric

This patch introduces a new metric for tracking the duration between
when an update has successfully completed (and the user is presented
with the "reboot arrow" in the panel) and when the system has booted
into the new update.

BUG=chromium:248800
TEST=New unit test + Unit tests pass + Manual tested

Change-Id: Ia22cedc3b70f1d9c2598bed9469b34a257546a64
Reviewed-on: https://gerrit.chromium.org/gerrit/59132
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>

13 months agoAdded permissions to call {Get|Set}Channel. 22/59422/2
Yuri Gorshenin [Thu, 20 Jun 2013 13:53:36 +0000 (17:53 +0400)]
Added permissions to call {Get|Set}Channel.

Added permissions to call {Get|Set}Channel.

BUG=chromium:219292
TEST=none

Change-Id: Ie23109602d2981f05f9508cc147b3b47b3df13a3
Reviewed-on: https://gerrit.chromium.org/gerrit/59422
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Yuri Gorshenin <ygorshenin@chromium.org>
Reviewed-by: Yuri Gorshenin <ygorshenin@chromium.org>
Commit-Queue: Yuri Gorshenin <ygorshenin@chromium.org>

13 months agoParse and add manifest version to the Omaha Response object. 98/59498/3
Chris Sosa [Thu, 20 Jun 2013 23:42:59 +0000 (16:42 -0700)]
Parse and add manifest version to the Omaha Response object.

This CL adds the version of the update we're updating to to the Omaha
response object and removes the use of DisplayVersion. DisplayVersion is
from the Omaha Protocol v1, and v2 and has never been used or relied
upon in the update engine.

Protocol is described here:
https://code.google.com/p/omaha/wiki/ServerProtocol

Manifest version should always describe the version of the application we are
updating to as is described by the manifest.

BUG=chromium:252527
TEST=Unittests + devserver image_to_live test.

Change-Id: I9afaa8af3c21813f19d88abf437f35b024d31985
Reviewed-on: https://gerrit.chromium.org/gerrit/59498
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>

13 months agoIf ReleaseChannelDelegated is unset, allow channel change. 30/59130/3
Chris Sosa [Wed, 19 Jun 2013 00:05:33 +0000 (17:05 -0700)]
If ReleaseChannelDelegated is unset, allow channel change.

BUG=chromium:251495
TEST=Unittests + -channel on device.

Change-Id: I46c739375ef37a24785e65d0229e46103b40b755
Reviewed-on: https://gerrit.chromium.org/gerrit/59130
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>

14 months agoAdd Installer.UpdatesAbandonedCount metric 98/59098/2
David Zeuthen [Fri, 14 Jun 2013 23:13:36 +0000 (16:13 -0700)]
Add Installer.UpdatesAbandonedCount metric

This patch adds a new metric Installer.UpdatesAbandonedCount to track
the number of update attempts that didn't complete because a newer
update was detected during the download. This is implemented by
counting the number of different responses seen since the last
successful update.

Updates are typically only abandoned if a device is suspended or
powered off while an update is happening. This can happen either
because the device was not turned on for a very long time or because
it had little or no connectivity to Omaha and/or the servers serving
the payload.

This metric will help show how many users run into this problem.

BUG=chromium:248800
TEST=New units tests + Unit tests pass + Manually tested

Change-Id: I524a380a931c2fb30916d033b7e5b0c700f57103
Reviewed-on: https://gerrit.chromium.org/gerrit/59098
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>

14 months agoImplement Rollback to previously booted partitions. 27/58427/9 factory-4290.B
Chris Sosa [Wed, 12 Jun 2013 20:47:09 +0000 (13:47 -0700)]
Implement Rollback to previously booted partitions.

This CL implements rollback to whatever partition we ran from before.
We expose this functionality via dbus under AttemptRollback and expose
a new command-line option to update_engine_client that a developer can
use.

BUG=chromium:242665
TEST=Unittests, full update, update + rollback and verified.

Change-Id: Ie59f90b9a0b777dc1329592449090c70892236bf
Reviewed-on: https://gerrit.chromium.org/gerrit/58427
Commit-Queue: Chris Sosa <sosa@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
14 months agoRevert "Continue with an older update if update progress is 30% or more" 37/58937/2 stabilize-4287.B
David Zeuthen [Mon, 17 Jun 2013 23:33:06 +0000 (16:33 -0700)]
Revert "Continue with an older update if update progress is 30% or more"

This reverts commit 249030ef688639585974d7fd2b4383f695551da0.

The problem with this patch is that if we decide to resume an older
update, we will already have overwritten the persistent data used by
PayloadState.

BUG=chromium:244538
TEST=None
Change-Id: Ifb19a399e0afb35e974670ae4171d24b5b1491a5
Reviewed-on: https://gerrit.chromium.org/gerrit/58937
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
14 months agoContinue with an older update if update progress is 30% or more 70/58470/3
David Zeuthen [Wed, 12 Jun 2013 23:50:41 +0000 (16:50 -0700)]
Continue with an older update if update progress is 30% or more

This feature is desirable in cases where a device is used infrequently
on a network with little or no bandwidth to the update servers. In a
nutshell, the problem is that the device will start downloading an
update but it's so slow that it will see a new update before it's
done. This new update will cause the device to throw away the old
update (and thereby the resources it has already expended downloading
it) and then start over again. Which means downloading an update and
then get interrupted again. Rinse and repeat. With this change, we'll
at least converge against an update (albeit, perhaps an old one)
instead of starting over again and again.

To implement this feature, a new "update-state-overall-progress"
persistent variable (so-called "preference" according to the codebase)
is introduced so we can easily evaluate the progress without having to
parse the manifest again.

This feature is difficult to test with devserver since it's always
using the same URL, e.g.

 http://your-workstation.corp.company.net:8080/static/update.gz

meaning that it's not possible to actually continue an older update
server from deverser. What happens is that update_engine will happily
continue downloading and apply the update, but it will fail with
something like kErrorCodePayloadSizeMismatchError because it's getting
the new payload while expecting the old. This is not a problem per se,
it will just cause us to abandon the update attempt.

Fortunately, to verify that the patch works, it's sufficient to just
check the log files for these messages

 [0612/163553:INFO:delta_performer.cc(1144)] Abandoning current update (at 12% completion) because there is a newer update available.

 [0612/164451:INFO:delta_performer.cc(1139)] Resuming current update (at 51% completion) despite the fact that there's a newer update.

BUG=chromium:244538
TEST=Unit tests pass + Manually tested (see above)

Change-Id: Ibfb2fe10fe1883bfadf132f22b802ca3482c699e
Reviewed-on: https://gerrit.chromium.org/gerrit/58470
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
14 months agoAdd EC and Firmware Versions to the Omaha Response. 13/49713/5 factory-pit-4280.B factory-spring-4262.B stabilize-4255.B
Chris Sosa [Wed, 1 May 2013 05:31:10 +0000 (22:31 -0700)]
Add EC and Firmware Versions to the Omaha Response.

This CL adds 2 additional utils methods to get the version for both the
fw and ec versions. I've added a unittest to verify these work and piped
in the values into the omaha response.

BUG=chromium:219871
TEST=Unittests + on device

Change-Id: Iadf70fff858988f52797d94bcdb062bb2482bbf3
Reviewed-on: https://gerrit.chromium.org/gerrit/49713
Commit-Queue: Chris Sosa <sosa@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
14 months agoAU: removing unnecessary braces (cosmetic) 71/56671/2
Gilad Arnold [Sat, 25 May 2013 00:21:17 +0000 (17:21 -0700)]
AU: removing unnecessary braces (cosmetic)

BUG=None
TEST=None

Change-Id: Ib07c7620057f90030000055166982ebac1c89d7a
Reviewed-on: https://gerrit.chromium.org/gerrit/56671
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
14 months agoRevert "Revert "AU: do not copy filesystem during full updates"" 00/56600/2
Gilad Arnold [Fri, 24 May 2013 15:51:22 +0000 (08:51 -0700)]
Revert "Revert "AU: do not copy filesystem during full updates""

This reverts commit d1cd325c3135d88498483da811b594ba6b91ce42

The problem that caused all autotests to fail with the original CL has now been rectified; lab devservers were updated to send the correct delta flag in their omaha response.

Change-Id: I664afb33f72856572baaa658cbd473c07271af36
Reviewed-on: https://gerrit.chromium.org/gerrit/56600
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

14 months agoRevert "AU: do not copy filesystem during full updates" 51/56351/2
Don Garrett [Thu, 23 May 2013 02:45:17 +0000 (19:45 -0700)]
Revert "AU: do not copy filesystem during full updates"

This reverts commit 81c90628abb268c9e54f655c2493b4495b5cf91e

This broke all of the Canaries with NPO update tests. It may be because devserver changes require manual staging into the autotest framework.

An example test:

http://cautotest/afe/#tab_id=view_job&object_id=3064976

Test Logs:

https://storage.cloud.google.com/?arg=chromeos-autotest-results/3064976-chromeos-test/chromeos2-row5-rack1-host9/debug#chromeos-autotest-results%2F3064976-chromeos-test%2Fchromeos2-row5-rack1-host9%2Fautoupdate_EndToEndTest.npo_test_delta%2Fsysinfo%2Fvar%2Flog_diff%2Fupdate_engine

UE Logs:

[0522/183224:INFO:chrome_browser_proxy_resolver.cc(168)] dbus_g_proxy_call succeeded!
[0522/183224:INFO:libcurl_http_fetcher.cc(63)] Starting/Resuming transfer
[0522/183224:INFO:libcurl_http_fetcher.cc(74)] Using proxy: no
[0522/183224:INFO:libcurl_http_fetcher.cc(52)] We are connected via ethernet, Updates allowed: Yes
[0522/183224:INFO:libcurl_http_fetcher.cc(180)] Not setting http(s) curl options because we are in test mode or running a dev/test image
[0522/183224:INFO:libcurl_http_fetcher.cc(485)] Setting up timeout source: 1 seconds.
[0522/183224:INFO:delta_performer.cc(104)] Completed 0/? operations, 15677/681963 bytes downloaded (2%), overall progress 1%
[0522/183224:WARNING:delta_performer.cc(327)] Ignoring missing/incorrect metadata size (0) in Omaha response as validation is not mandatory. Trusting metadata size in payload = 1410
[0522/183224:INFO:utils.cc(824)] Sending error code 32 (kErrorCodeDownloadInvalidMetadataSize) to UMA metric: Installer.DevModeErrorCodes. Flags = TestOmahaUrl, TestImage
[0522/183224:WARNING:delta_performer.cc(791)] Cannot validate metadata as the signature is empty
[0522/183224:INFO:utils.cc(824)] Sending error code 39 (kErrorCodeDownloadMetadataSignatureMissingError) to UMA metric: Installer.DevModeErrorCodes. Flags = TestOmahaUrl, TestImage
[0522/183224:ERROR:delta_performer.cc(852)] Purported full payload contains old partition hash(es), aborting update
[0522/183224:ERROR:download_action.cc(102)] Error 6 in DeltaPerformer's Write method when processing the received payload -- Terminating processing
[0522/183224:INFO:delta_performer.cc(216)] Discarding 15677 unused downloaded bytes
[0522/183224:INFO:update_attempter.cc(724)] Download status: inactive
[0522/183224:INFO:multi_range_http_fetcher.cc(155)] Received transfer terminated.
[0522/183224:INFO:multi_range_http_fetcher.cc(107)] TransferEnded w/ code 200
[0522/183224:INFO:multi_range_http_fetcher.cc(109)] Terminating.
[0522/183224:INFO:prefs.cc(27)] delta-update-failures not present in /var/lib/update_engine/prefs
[0522/183224:INFO:action_processor.cc(68)] ActionProcessor::ActionComplete: DownloadAction action failed. Aborting processing.
[0522/183224:INFO:action_processor.cc(73)] ActionProcessor::ActionComplete: finished last action of type DownloadAction
[0522/183224:INFO:update_attempter.cc(578)] Processing Done.
[0522/183224:INFO:utils.cc(673)] Setting cgroup cpu shares to  1024
[0522/183224:INFO:update_attempter.cc(963)] CPU shares = 1024
[0522/183224:ERROR:update_attempter.cc(934)] Update failed.

Change-Id: I69d3b93711707d9429201865346fd50117338718
Reviewed-on: https://gerrit.chromium.org/gerrit/56351
Commit-Queue: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
14 months agoAU: gitignore update 98/56298/2
Gilad Arnold [Wed, 22 May 2013 19:39:50 +0000 (12:39 -0700)]
AU: gitignore update

This ignores temporary directories used for unit testing; apparently,
devs tend to run unit tests inside their source directory, e.g. using
./run_unittests, so this is annoying.

BUG=None
TEST=Directories ignored by git

Change-Id: I4ad67909605d899c78e8579b3981f39d8c8dd2fe
Reviewed-on: https://gerrit.chromium.org/gerrit/56298
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
14 months agoAU: do not copy filesystem during full updates 65/43665/5
Gilad Arnold [Fri, 25 Jan 2013 16:41:25 +0000 (08:41 -0800)]
AU: do not copy filesystem during full updates

The filesystem copying stage is redundant during full updates, where the
partition is being entirely overwritten regardless of its previous
content. It is also a very wasteful step, causing intensive I/O and
kernel buffer pressure, and known to (sometimes) cause jank and
otherwise have detrimental effects on our user experience.

This CL eliminates filesystem copying for full updates:

1) The decision is based on whether the Omaha response indicates that
   this is a full update.

2) To be safe, we also ensure that the payload manifest does not contain
   old partition hashes, which is indicative of a delta update.

Note that it is generally desirable to base the decision solely on #2
above (and ignore #1 altogether). However, this will require more
extensive re-engineering of the update flow, as filesystem copying
currently happens prior to the manifest being downloaded.

BUG=chromium:189855
TEST=Full and delta updates run correctly on x86-alex

Change-Id: Ic0dc6e32913cfb96019606624ec6b87c2e5b3ebb
Reviewed-on: https://gerrit.chromium.org/gerrit/43665
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
14 months agoDownload via HTTP only if enterprise policy allows. 05/55805/6
Jay Srinivasan [Sat, 18 May 2013 00:13:01 +0000 (17:13 -0700)]
Download via HTTP only if enterprise policy allows.

In order to rollout HTTP-downloads for AU to stable channel, we want to
be a bit more conservative to preseve the defense in depth we have now
with HTTPS. So, we're introduced a new enterprise policy which should be
explicitly enabled in order for the payloads to be downloaded via HTTP.

This CL adds the support for honoring such a policy in update engine.

BUG=chromium:235562
TEST=New unit tests added, existing ones updated and they all pass.
TEST=Tested on ZGB with and without policy and it works as expected.
Change-Id: I356efbe237b10031161a57c70cb851c521915a76
Reviewed-on: https://gerrit.chromium.org/gerrit/55805
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>

14 months agoChange the default partition size to 2GiB if not specified. 91/56091/2
Chris Sosa [Tue, 21 May 2013 20:33:42 +0000 (13:33 -0700)]
Change the default partition size to 2GiB if not specified.

BUG=chromium:242276
TEST=Built and tested against a R26 and non-R26 image.

Change-Id: I5d685ad62d444c044b971ba44574b8b55c7a96de
Reviewed-on: https://gerrit.chromium.org/gerrit/56091
Tested-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>

15 months agoFix size_t issue when the image size is > 2GiB. 96/55596/2
Chris Sosa [Fri, 17 May 2013 23:11:10 +0000 (16:11 -0700)]
Fix size_t issue when the image size is > 2GiB.

BUG=chromium:241256
TEST=cros_generate_update_payload with PGO image.

Change-Id: I7220ddb61c7e0a6844d41378ee12f5fd0074bff4
Reviewed-on: https://gerrit.chromium.org/gerrit/55596
Tested-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>

15 months agoAdd human friendly payload information to the manifest. 47/47347/9
Don Garrett [Wed, 3 Apr 2013 23:55:42 +0000 (16:55 -0700)]
Add human friendly payload information to the manifest.

This adds new strings to the payload manifest that describe what images
the payload updates from/to. These strings are passed in when delta_generator
is invoked, and are trusted implicitly.

BUG=chromium:226310
TEST=Built/Updated.

Change-Id: I278137c97cf8376d4e2fd8e82402cbb7d4f1a104
Reviewed-on: https://gerrit.chromium.org/gerrit/47347
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Don Garrett <dgarrett@chromium.org>

15 months agoAU: Don't use sparse holes as scratch space in the delta generator. 48/50448/5 factory-4128.B factory-spring-4131.B
Darin Petkov [Wed, 8 May 2013 12:33:24 +0000 (14:33 +0200)]
AU: Don't use sparse holes as scratch space in the delta generator.

This patch fixes a number of bugs related to handling of sparse holes
in the context of scratch space in the delta diff generator and adds
appropriate unit tests. Most notably:

- Ignore sparse holes for the purposes of ExtentRanges. This prevents
  the generator from using sparse holes as scratch.

- Adds two unit tests to catch using sparse holes as scratch in a more
  deterministric way.

- Handle correctly sparse holes in
  GraphUtils::AppendBlockToExtents. For example, previously, if one
  adds block 0 to a single-block kSparseHole extent, the extent would
  have been simply extended.

BUG=chromium:238440
TEST=unit tests, trybots

Change-Id: I3fedcc93af319ee741821ad9d1a2a57b7a7d5de2
Reviewed-on: https://gerrit.chromium.org/gerrit/50448
Commit-Queue: Darin Petkov <petkov@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Darin Petkov <petkov@chromium.org>
15 months agoAdd DownloadSourcesUsed and DownloadOverheadPercentage metrics. 56/48856/4 release-R28-4100.B stabilize-4100.38.B stabilize-spring-4100.53.B toolchainB
Jay Srinivasan [Tue, 23 Apr 2013 00:45:19 +0000 (17:45 -0700)]
Add DownloadSourcesUsed and DownloadOverheadPercentage metrics.

DownloadSourcesUsed: This metric will tell us the various combinations of
the protocols and servers that were used in completing the download for
each successful update attempt.

DownloadOverheadPercentage: This metric will indicate how efficient our
download mechanisms are by calculating the overhead we incurred as a percentage
of the number of bytes that were actually needed to do the update
successfully.

BUG=chromium:225953
TEST=Unit Tests added, chrome://histograms shows new metrics correctly.

Change-Id: Ic1e9547a9a27e1aad53f7e30c70d822820d2c60f
Reviewed-on: https://gerrit.chromium.org/gerrit/48856
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
15 months agoAU: Minor DeltaPerformer cleanup. 79/49879/2
Darin Petkov [Thu, 2 May 2013 08:02:34 +0000 (10:02 +0200)]
AU: Minor DeltaPerformer cleanup.

- Use DCHECK rather than DCHECK_EQ to avoid printing of non-readable
  characters on failure.

- Don't store the return-by-value result of StringPrintf as a
  reference.

BUG=chromium:196378
TEST=unit tests

Change-Id: Ibf912061627c56a9f5d82f6979b6fb8e3f7c6717
Reviewed-on: https://gerrit.chromium.org/gerrit/49879
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Darin Petkov <petkov@chromium.org>

15 months agoAllow callers to override the default partition size. 63/48963/8
Chris Sosa [Tue, 23 Apr 2013 20:20:18 +0000 (13:20 -0700)]
Allow callers to override the default partition size.

Callers should know the actual size of the image on the device. If they do,
use that and not our hard-coded constant.

BUG=chromium:234556
TEST=Running it on canary try jobs

Change-Id: I1f4e268d218d83d5499fd1561f8aacf8c4b0f7c2
Reviewed-on: https://gerrit.chromium.org/gerrit/48963
Commit-Queue: Chris Sosa <sosa@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
15 months agoRename ActionExitCode to ErrorCode 12/49512/2
David Zeuthen [Mon, 29 Apr 2013 20:42:47 +0000 (13:42 -0700)]
Rename ActionExitCode to ErrorCode

Nowadays ActionExitCode is used throughout the codebase so use a more
generic name to reflect this.

BUG=chromium:216507
TEST=unit tests pass

Change-Id: I23d1d7e2676443251dbc42ed137fd018aadfa8a3
Reviewed-on: https://gerrit.chromium.org/gerrit/49512
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
15 months agoAU: Handle moving of sparse block extents correctly in DeltaPerformer. 72/49172/6
Darin Petkov [Thu, 25 Apr 2013 12:46:09 +0000 (14:46 +0200)]
AU: Handle moving of sparse block extents correctly in DeltaPerformer.

Rather than reading from sparse holes, just reset the buffer with zeros. Drop
writes to sparse holes (and DCHECK that the data to be written is all zeros).

This patch also adds the following tests:

- Move a file of zeros into a sparse file.
- Move a sparse file into a file of zeros.
- Move a partially sparse file.

BUG=chromium:196378
TEST=unit tests

Change-Id: Idab8d44b391fbe7714c7fd53f7f383c9bf81edc1
Reviewed-on: https://gerrit.chromium.org/gerrit/49172
Commit-Queue: Darin Petkov <petkov@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Darin Petkov <petkov@chromium.org>
15 months agoAdd unit tests for duration metrics 14/48814/7 stabilize-4068.0.B
David Zeuthen [Mon, 22 Apr 2013 21:04:39 +0000 (14:04 -0700)]
Add unit tests for duration metrics

As a side-effect, move utils::GetMonotonicTime() into the newly added
ClockInterface type.

BUG=None
TEST=Unit tests pass

Change-Id: I972a7e4ba37b63f96348fbeda901697b8ba2fc05
Reviewed-on: https://gerrit.chromium.org/gerrit/48814
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>

15 months agoAU: Optimize BzipExtentWriter's memory use. 47/49047/3
Darin Petkov [Wed, 24 Apr 2013 10:56:19 +0000 (12:56 +0200)]
AU: Optimize BzipExtentWriter's memory use.

This patch introduces the following two changes:

- Reduces the output buffer size from 1MiB to 16KiB.

- Avoids copying of the input data when there's no leftover data. This
  covers the current DeltaPerformer usage of the writer.

BUG=chromium:234578
TEST=unit tests; tested full update on device

Change-Id: I44f74b4fd8b05b082fde84d5ac06d9b1c1177b81
Reviewed-on: https://gerrit.chromium.org/gerrit/49047
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Darin Petkov <petkov@chromium.org>

15 months agoUse better histogram parameters for duration metrics 58/48558/8
David Zeuthen [Thu, 18 Apr 2013 21:05:20 +0000 (14:05 -0700)]
Use better histogram parameters for duration metrics

In the current code this is capped at 20 minutes which is not helpful
as we're interested in data for devices that take much longer to
update. Instead, use one year for UpdateDuration and one month for
UpdateDurationUptime. Also move the code that sends the metric into
PayloadState to better conform with newly added code.

Also rename the metrics to they have the suffix Minutes. E.g. the new
metric names are

 Installer.UpdateDurationMinutes
 Installer.UpdateDurationUptimeMinutes

Also add unit test for utils::FormatTimeDelta().

BUG=None
TEST=Unit tests, look at chrome://histogram

Change-Id: I8581ec111f9833bdd72f10888c9626f40779f8b9
Reviewed-on: https://gerrit.chromium.org/gerrit/48558
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
15 months agoAdd update reboot metric to the update engine. 10/47710/11
Chris Sosa [Wed, 10 Apr 2013 01:25:12 +0000 (18:25 -0700)]
Add update reboot metric to the update engine.

This change add the Installer.UpdateNumReboots metric.

This records the number of reboots that occurred while an update was being
attempted. It uses a marker file stored in tmp to discover whether or not
it's already recorded the reboot.

BUG=chromium:226766
TEST=Unittests | ran an update on a test machine and rebooted/resumed and
checked about:histograms to confirm numbers. Also restart update-engine to
verify it didn't double count that.

Change-Id: I5d2af9d5b62a9d974c7c6243a89cb3359051b650
Reviewed-on: https://gerrit.chromium.org/gerrit/47710
Tested-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
15 months agoAdd metric to report number of URL switches per update attempt 37/48537/4
David Zeuthen [Thu, 18 Apr 2013 18:57:24 +0000 (11:57 -0700)]
Add metric to report number of URL switches per update attempt

BUG=chromium:226765
TEST=Existing unit tests modified to test feature, Unit tests pass

Change-Id: I5ee0816cac3fa4fa641949ed4872aef8074e3fcc
Reviewed-on: https://gerrit.chromium.org/gerrit/48537
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
16 months agoAU: Optionally limit the size of delta update operations. 57/48357/4 stabilize-4035.0.B
Darin Petkov [Tue, 16 Apr 2013 14:23:50 +0000 (16:23 +0200)]
AU: Optionally limit the size of delta update operations.

Add a --chunk_size flag to delta_generator. If it's not -1, files will
be split into chunks of this size when generating delta payloads. This
effectively limits the size of each delta operation.

BUG=chromium:229797
TEST=unit tests; generated delta payloads and checked them through
paycheck.py.

Change-Id: I21502118088bfbac75aa8009eb144f6aaf23a83a
Reviewed-on: https://gerrit.chromium.org/gerrit/48357
Commit-Queue: Darin Petkov <petkov@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Darin Petkov <petkov@chromium.org>
16 months agoAdd metrics to report the number of bytes downloaded per protocol. 69/48069/4
Jay Srinivasan [Sat, 13 Apr 2013 02:23:36 +0000 (19:23 -0700)]
Add metrics to report the number of bytes downloaded per protocol.

This CL adds these two basic metrics:
1. The number of megabytes downloaded using each protocol (or source
in general, as we want to consider HTTP downloads from server and possibly
a peer in future as two different sources) for each successful update. The
totals across all protocols will equal the payload size exactly.
2. The total number of megabytes downloaded since the last update attempt.
If there are no errors, this should be same as above. Otherwise, this will
be larger and will help us to compute the update efficiency.

BUG=chromium:225953
TEST=Unit tests pass, new Unit tests added.
TEST=chrome://histograms shows metrics correctly.

Change-Id: Ic02e218f46568427df99a8a9df2011860aee84f3
Reviewed-on: https://gerrit.chromium.org/gerrit/48069
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
16 months agoFix clang syntax checking. 97/47997/4 stabilize-4008.0.B
Yunlian Jiang [Fri, 12 Apr 2013 16:53:09 +0000 (09:53 -0700)]
Fix clang syntax checking.

This fixes serveral clang syntax checking. 1) unused functions.
2) confict of struct and class. 3) unused variables.

BUG=chromium:230663
TEST=clang syntax checking passed.
     trybot daisy-release passed
Change-Id: I8dbfb7dd5f21739831843bc3e7fa8ec7864824b9
Reviewed-on: https://gerrit.chromium.org/gerrit/47997
Reviewed-by: Han Shen <shenhan@chromium.org>
Commit-Queue: Yunlian Jiang <yunlian@chromium.org>
Tested-by: Yunlian Jiang <yunlian@chromium.org>
16 months agoMeasure and send update duration (and corresponding uptime) to UMA 28/47928/7
David Zeuthen [Thu, 11 Apr 2013 23:10:26 +0000 (16:10 -0700)]
Measure and send update duration (and corresponding uptime) to UMA

This patch introduces two new metrics, Installer.UpdateDuration and
Installer.UpdateDurationUptime. The former is the timespan from when
the update was first discovered until it has been downloaded and
applied (including the time the device is suspended or powered
off). The latter is similar, but without taking into account time
spent in suspend or powered off.

For example, if the device is suspended (or powered off) for N seconds
while updating, the Installer.UpdateDuration metric will be N seconds
bigger than Installer.UpdateDurationUptime metric:

 Histogram: Installer.UpdateDuration recorded 1 samples, average = 313.0
 Histogram: Installer.UpdateDurationUptime recorded 1 samples, average = 251.0

Also remove the existing Installer.UpdateTime metric as this didn't
take process restarts into account and is now superseeded by the
Installer.UpdateDuration metric.

This is done by using the CLOCK_MONOTONIC_RAW clock (available in
Linux 2.6.28 and later) since this clock indeed does not advance when
the system is sleeping.

We use the PayloadState class to persist recorded data across
update_engine process restart (including device reboots).

Since clock_gettime(2) and CLOCK_MONOTONIC_RAW requires linking to the
librt library do this and also request the system header files to
expose the required symbols and defines, i.e. define _POSIX_C_SOURCE
>= 199309L.

Also remove _POSIX_C_SOURCE mangling from update_attempter.cc since
it's actually not needed there and generally it's better to make the
environment the same across all translation units (by putting whatever
is needed in e.g. CCFLAGS).

BUG=chromium:226763
TEST=unit tests, force update, examine chrome://histograms

Change-Id: I883668564b5fa78ff3e19156bd77496ff929ca58
Signed-off-by: David Zeuthen <zeuthen@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/47928
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
16 months agoRemove the obsolete needsadmin attribute. 22/47822/3
Don Garrett [Thu, 11 Apr 2013 01:14:56 +0000 (18:14 -0700)]
Remove the obsolete needsadmin attribute.

It seems that the needsadmin attribute hasn't been used for a long time, so
stop parsing it. We were parsing out the value, then ignoring it anyway.

BUG=chromium:199039
TEST=built, trybot mario-release

Change-Id: Ic0fbb8924af7c647fe1630cc60c260587431a0ff
Reviewed-on: https://gerrit.chromium.org/gerrit/47822
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Commit-Queue: Don Garrett <dgarrett@chromium.org>

16 months agoRefactoring: Move prefs constants out to the constants.h/cc 93/47593/3
Jay Srinivasan [Mon, 8 Apr 2013 22:08:05 +0000 (15:08 -0700)]
Refactoring: Move prefs constants out to the constants.h/cc

Adding/removing the set of keys used by various parts of the Update Engine code
does not affect the implementation of the prefs module, hence separating them.

BUG=chromium:229090
TEST=Unit tests pass.

Change-Id: Id774b726a47b461e563e2e413527054e4da0c012
Reviewed-on: https://gerrit.chromium.org/gerrit/47593
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>

16 months agoFix the confict of declaration and definition between struct and class 76/47476/6
Yunlian Jiang [Fri, 5 Apr 2013 21:41:56 +0000 (14:41 -0700)]
Fix the confict of declaration and definition between struct and class

This fixes the error when compiling with clang syntax checking
The error message was:
/update_engine/test_utils.h:188:1: error: 'ObjectFeederAction'
defined as a struct template here but previously declared as a
class template [-Werror,-Wmismatched-tags]

BUG=chromium:218781
TEST=USE="chrome_internal" CXXFLAGS="-clang -print-cmdline"
     CFLAGS="-clang -print-cmdline" emerge-x86-alex update_engine

Change-Id: Ieac9981c84c4e5779cbf876650f21a5d1b2acd72
Reviewed-on: https://gerrit.chromium.org/gerrit/47476
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Yunlian Jiang <yunlian@chromium.org>
Commit-Queue: Yunlian Jiang <yunlian@chromium.org>

16 months agoAU: Release bspatch memory as early as possible. 32/47232/3
Darin Petkov [Wed, 3 Apr 2013 12:45:19 +0000 (14:45 +0200)]
AU: Release bspatch memory as early as possible.

Release the memory as soon as the bspatch file is written out in order
to reduce overall peak memory usage.

BUG=chromium:220750
TEST=unit tests; trybots

Change-Id: I0d82976c207c6bb57287f6ea1a79e214db1f08c7
Reviewed-on: https://gerrit.chromium.org/gerrit/47232
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Darin Petkov <petkov@chromium.org>

16 months agoSupport changing from non-canary to canary channel in update engine. 81/47181/4
Jay Srinivasan [Tue, 2 Apr 2013 21:47:45 +0000 (14:47 -0700)]
Support changing from non-canary to canary channel in update engine.

Now that we have added support in lsb-release for both the board appid
and canary app id to be specified, we should use the appropriate appid
according to the channel from which we want to download the new payload.

This change in update engine will enable the change from non-canary to
canary channels. This feature when be lit up end to end when the UI for
this scenario is ready.

BUG=chromium:225866
TEST=Unit tests pass. Tested all channel changes on my ZGB.

Change-Id: Ia9c37c72f53f6c69436f0a96e35d2584d84653c8
Reviewed-on: https://gerrit.chromium.org/gerrit/47181
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
16 months agoLog the correct error when the rootfs hash/size mismatches on deltas. 06/46906/2
Chris Sosa [Fri, 29 Mar 2013 21:17:45 +0000 (14:17 -0700)]
Log the correct error when the rootfs hash/size mismatches on deltas.

BUG=None
TEST=Unittests

Change-Id: If2ca1eecaacfa23deedc08b52a4f8033e4d0359c
Reviewed-on: https://gerrit.chromium.org/gerrit/46906
Tested-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
16 months agoCancel the current download if user chooses a different channel. 95/46095/11
Jay Srinivasan [Thu, 28 Mar 2013 23:45:25 +0000 (16:45 -0700)]
Cancel the current download if user chooses a different channel.

In my earlier CL, to keep the implementation simple, we disallowed changing
a channel until the previous change completed in its entirety. Given that
the UI is not going to be updated for M27, such a restriction turned out
to be very confusing when playing around with channel changing. So, we
decided to implement a simple form of canceling the download if the
user selected a different channel while we're downloading the bits. This
implementation can easily be extended to support a general form of cancel
in the future, if required.

This CL also adds validation of libchromeos API calls when interpreting
the policy values. It also cleans up some bogus error messages that were
logged earlier when we abort a download.

BUG=chromium:222617
TEST=All scenarios pass on ZGB. Unit Tests pass.

Change-Id: I7cd691fe461d9ce47314299f6e2598944650ee33
Reviewed-on: https://gerrit.chromium.org/gerrit/46095
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
16 months agofix(chrome_browser_proxy_resolver): fix spelling errors 52/46552/2
Brandon Philips [Tue, 26 Mar 2013 20:58:51 +0000 (13:58 -0700)]
fix(chrome_browser_proxy_resolver): fix spelling errors

BUG=None
TEST=None

change dbug to dbus

Change-Id: I50c71c85dc48c3ef6defc8092003ab202c4783f3
Reviewed-on: https://gerrit.chromium.org/gerrit/46552
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Brandon Philips <brandon@ifup.co>
Tested-by: Brandon Philips <brandon@ifup.co>
Commit-Queue: Brandon Philips <brandon@ifup.co>

17 months agoAU: improve/clarify signature padding 93/45993/2
Gilad Arnold [Mon, 11 Feb 2013 17:26:00 +0000 (09:26 -0800)]
AU: improve/clarify signature padding

Reformatted and added comments that make it clear what exactly this
padding stands for.

BUG=None
TEST=Builds, unit tests

Change-Id: I7b0b57f6791c4706ede1fd957214236c7921f50e
Reviewed-on: https://gerrit.chromium.org/gerrit/45993
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
17 months agoAU: uprev the default BASE_VER value for local builds 96/45996/2
Gilad Arnold [Wed, 20 Mar 2013 15:21:51 +0000 (08:21 -0700)]
AU: uprev the default BASE_VER value for local builds

We seem to be baking a default value in SConstruct, which became
outdated, hence this fix.

BUG=None
TEST=./build now works

Change-Id: I72de470de920582883f92f0fd8f4a195041456f3
Reviewed-on: https://gerrit.chromium.org/gerrit/45996
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
17 months agoFix update_disabled flag to be set to false when there's no policy. 41/45941/2
Jay Srinivasan [Wed, 20 Mar 2013 01:12:38 +0000 (18:12 -0700)]
Fix update_disabled flag to be set to false when there's no policy.

My previous check-in introduced an uninitialized variable which
may cause some random AU failures because of the update_disbled
flag being initialized to true based on the contents of the stack.

This CL fixes it by always setting it to false.

BUG=chromium:222161
TEST=Unit Tests Pass, work as expected on my ZGB.

Change-Id: I80fce1db566f6cea0ea80370c4a90dc538215316
Reviewed-on: https://gerrit.chromium.org/gerrit/45941
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
17 months agoEnhanced channel changing behavior 19/44619/8
Jay Srinivasan [Tue, 19 Mar 2013 00:08:08 +0000 (17:08 -0700)]
Enhanced channel changing behavior

This CL adds a new DBUS API to UpdateEngine called SetTargetChannel to
change the current channel of the device with an option to indicate
whether to do eventually or immediately.

The API will be called with the option to do it immediately in a
subsequent CL in Chrome UI. For now the old API (set_track) has been
wired up to call the new API to produce the old behavior (i.e. change
eventually). The old API will be removed after Chrome UI code stops
using it.

It's the UI's responsibility to ask the user for confirmation for the
powerwash that may happen in some cases and call the API with the
appropriate value whether or not the powerwash should happen.

For now, we're restricting the changing of channels to only those
devices that are on canary-channel or running test builds. This
restriction will be lifted off once the UI work is ready to give
warning to the users about the powerwash that may happen when they move
to a more stable channel.

We also enforce ReleaseChannelDelegated and ReleaseChannel policies
correctly now as follows:

* If ReleaseChannelDelegated is false, SetTargetChannel will fail as we
need to honor (only) the ReleaseChannel value in this case.
* If ReleaseChannelDelegated is true, we'll allow the SetTargetChannel
call to specify. In this case, we'll ignore the value of ReleaseChannel,
if any.

BUG=chromium-os:39095
TEST=Tested on ZGB by going from canary to dev-channel with and without
powerwash.
TEST=Existing unit tests have been updated and they pass.
TEST=New unit tests have been added.

Change-Id: Ifbf806a06e1c30d2f318e94d73735d1812049abd
Reviewed-on: https://gerrit.chromium.org/gerrit/44619
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
17 months agoRewrite comment as requested. 65/45165/2 factory-spring-3842.B firmware-spring-3833.B
Don Garrett [Tue, 12 Mar 2013 01:07:28 +0000 (18:07 -0700)]
Rewrite comment as requested.

There was a poorly worded comment related to bsdiff blacklisting that caused
confusion. Rewording it to be clearer (I hope).

BUG=None
TEST=Built, visual inspection that it's a comment change only.

Change-Id: Ib69c3ab168ffbba79ee430e5baa0dc4eca1e90b2
Reviewed-on: https://gerrit.chromium.org/gerrit/45165
Reviewed-by: David Dorwin <ddorwin@chromium.org>
Commit-Queue: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
17 months agofix(udev_interface.h): remove return from voids 94/44894/2
Brandon Philips [Thu, 7 Mar 2013 02:34:52 +0000 (18:34 -0800)]
fix(udev_interface.h): remove return from voids

BUG=None
TEST=None

gcc is complaining about these returns, just remove them:

update_engine-0.0.1-r366: ../update_engine/udev_interface.h:190:27:
error: return-statement with a value, in function returning 'void'
[-fpermissive]

Change-Id: Iad34fa669e8cc5597f09058fdaa7c3bb3e3ec87b
Reviewed-on: https://gerrit.chromium.org/gerrit/44894
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Brandon Philips <brandon@ifup.co>
Tested-by: Brandon Philips <brandon@ifup.co>
17 months agoUpdate update engine to compile and use libchrome-180609. 98/44098/4 firmware-spring-3824.4.B firmware-spring-3824.55.B firmware-spring-3824.84.B firmware-spring-3824.B
Chris Sosa [Tue, 26 Feb 2013 22:43:21 +0000 (14:43 -0800)]
Update update engine to compile and use libchrome-180609.

Made the following fixes:
- base/eintr_wrapper.h -> base/posix/eintr_wrapper.h
- base/string_tokenizer.h -> base/strings/string_tokenizer.h
- Switched JSONReader->JsonToValue to use JSONReader->ReadToValue.

BUG=chromium-os:39847
TEST=unittests + run through image_to_live

Change-Id: Iffa0a3af4a065fac40460d8c1c2ed5c9b6e9ed07
Reviewed-on: https://gerrit.chromium.org/gerrit/44098
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>

17 months agoAU: change 'userinitiated' into 'installsource' 51/41951/4
Gilad Arnold [Thu, 24 Jan 2013 19:26:00 +0000 (11:26 -0800)]
AU: change 'userinitiated' into 'installsource'

- Renamed the flag so it is in line with the flag name and values used
  by Chrome to indicate different forms of an update. It will allow us
  to reuse existing Omaha dashboard facilities to monitor this flag.

- Also, per advise from Omaha, moved the said attribute to the <request>
  XML node.

BUG=chromium-os:26594
TEST=New flag name/values now appear

Change-Id: I46a158b3aef8a56813464d74fc6043ea5b1ec3c1
Reviewed-on: https://gerrit.chromium.org/gerrit/41951
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

18 months agoMake policy reloads explicit. 40/42540/2 release-R26-3701.B stabilize-3701.30.0 stabilize-3701.30.0b stabilize-3701.46.B stabilize-3701.81.B stabilize-bluetooth-smart toolchain-3701.42.B
Julian Pastarmov [Mon, 4 Feb 2013 17:04:48 +0000 (18:04 +0100)]
Make policy reloads explicit.

BUG=chromium-os:38541
TEST=unit tests pass
CQ-DEPEND=I20461078ca890c6ec2f81ad5383c06c4d75a64cd

Change-Id: I3f9ca593247816534d4f9f87e8a0c7db593b87b5
Reviewed-on: https://gerrit.chromium.org/gerrit/42540
Reviewed-by: Will Drewry <wad@chromium.org>
Commit-Queue: Julian Pastarmov <pastarmovj@chromium.org>
Tested-by: Julian Pastarmov <pastarmovj@chromium.org>
18 months agoAU: recommend cgpt undo on update_engine_client -reset_status 22/42022/3
Gilad Arnold [Fri, 25 Jan 2013 18:27:19 +0000 (10:27 -0800)]
AU: recommend cgpt undo on update_engine_client -reset_status

While -reset_status will reset the update engine's internal state, as
well as remove the flag file that necessitates a reboot, it will not
undo the (potentially detrimental) effect of an update to a machine's
partition table. With this change, update_engine_client now prompts the
user to apply a one-liner shell command to reverse the impact of such
changes, ensuring that a subsequent reboot will load the current
kernel/rootfs (and not the updated ones).

Note that this command should work regardless of which physical device
is the boot device (e.g. /dev/sda, /dev/mmcblk0) and the partition
scheme used (rootfs is e.g. /dev/sda3, /dev/mmcblk0p3). It does,
however, assume that the number of the kernel partition is that of the
corresponding rootfs partition minus one.

BUG=None
TEST=Expected log message displayed

Change-Id: I4503c4377a9ddbfd597ac7e049fad72ba989a213
Reviewed-on: https://gerrit.chromium.org/gerrit/42022
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

18 months agoAU: improve progress logging during updates 01/41301/14
Gilad Arnold [Tue, 15 Jan 2013 20:35:05 +0000 (12:35 -0800)]
AU: improve progress logging during updates

We currently emit a log message for operations at fixed index increments
of 1000. This is fairly useful in keeping the number of log messages
small, but otherwise quite arbitrary and useless in giving an actual
sense of progress, throughput, etc for updates of varying number of
operations in them and subject to network latencies.  Further, this
progress report does not take into the account the download progress,
which appears to be the completion metric used toward the UI.

This CL proposes a simple mechanism for computing an "overall update
progress" and an adaptive method for emitting a progress log message in
reasonable intervals. The raw metrics currently used include (i) the
number of bytes downloaded out of the expected total; (ii) the number of
operations successfully applied out of the expected total.  These are
weighed into a single percentage counter based on a prefixed set of
weights.  Logging occurs based on either (i) completion of update
"chunks" of some predetermined number; or (ii) having enough time
elapsed since the last log message.  This guarantees that we'll see
enough progress messages at regular intervals, but not too many of them.

We're also similarly logging the relative position in a resumed update
right before we start applying from the point we left it.

Note that the max number of regular log intervals, as well as the
timeout to force a progress log, can be easily tweaked by changing
compile-time constants.  They are currently set to 10 (or every 10%) and
30 (for 30 seconds since the last progress log), respectively, which
appear to be a reasonable choices.

Here's an example from an actual update log:

[0118/145759:INFO:delta_performer.cc(451)] Starting to apply update payload operations
[0118/145821:INFO:delta_performer.cc(150)] Completed 100/1040 operations (9%), 38363576/319659860 bytes downloaded (12%), overall progress 10%
[0118/145835:INFO:delta_performer.cc(150)] Completed 213/1040 operations (20%), 63939000/319659860 bytes downloaded (20%), overall progress 20%
[0118/145857:INFO:delta_performer.cc(150)] Completed 298/1040 operations (28%), 102293944/319659860 bytes downloaded (32%), overall progress 30%
[0118/145912:INFO:delta_performer.cc(150)] Completed 421/1040 operations (40%), 127869368/319659860 bytes downloaded (40%), overall progress 40%
[0118/145935:INFO:delta_performer.cc(150)] Completed 507/1040 operations (48%), 166224312/319659860 bytes downloaded (52%), overall progress 50%

(update interrupted and resumed)

[0118/150058:INFO:delta_performer.cc(150)] Resuming after 582/1040 operations (55%), 195577374/319659860 bytes downloaded (61%), overall progress 57%
[0118/150058:INFO:delta_performer.cc(451)] Starting to apply update payload operations
...
[0118/150102:INFO:delta_performer.cc(150)] Completed 604/1040 operations (58%), 200934046/319659860 bytes downloaded (62%), overall progress 60%
[0118/150116:INFO:delta_performer.cc(150)] Completed 749/1040 operations (72%), 221543046/319659860 bytes downloaded (69%), overall progress 70%
[0118/150134:INFO:delta_performer.cc(150)] Completed 840/1040 operations (80%), 255736454/319659860 bytes downloaded (80%), overall progress 80%
[0118/150154:INFO:delta_performer.cc(150)] Completed 936/1040 operations (90%), 289225350/319659860 bytes downloaded (90%), overall progress 90%
[0118/150212:INFO:delta_performer.cc(150)] Completed 1040/1040 operations (100%), 319659860/319659860 bytes downloaded (100%), overall progress 100%

BUG=chromium-os:37910
TEST=Passes unit tests
TEST=Update works, progress logged as expected on x86-alex

Change-Id: I2ec5511fc20df05a264e59651528c65133209132
Reviewed-on: https://gerrit.chromium.org/gerrit/41301
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

19 months agoChange how update_engine_client handles DBus proxy failures. 62/41662/4
Richard Barnette [Fri, 18 Jan 2013 21:38:51 +0000 (13:38 -0800)]
Change how update_engine_client handles DBus proxy failures.

Change GetProxy() to log failures with LOG(ERROR) and then
terminate, rather than use LOG(FATAL), as the latter unhelpfully
generates a core file.

BUG=chromium-os:37542
TEST=run update_engine_client with and without a working update_engine

Change-Id: Id84b56ff0b5ffa51cf4fda4cb7ad847f5bb617e5
Reviewed-on: https://gerrit.chromium.org/gerrit/41662
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Richard Barnette <jrbarnette@chromium.org>

19 months agoAU: move 'userinitiated' flag to the right place in an update check 28/41628/3
Gilad Arnold [Fri, 18 Jan 2013 08:39:49 +0000 (00:39 -0800)]
AU: move 'userinitiated' flag to the right place in an update check

The said flag, introduced in a recent change, should be an attribute of
the <updatecheck> node, now fixed. Also changed a couple of unit tests
to reflect this.

BUG=chromium-os:26594
TEST=Flag now appears in the right place

Change-Id: I4f024797da34376364d358631d1a606be8be639e
Reviewed-on: https://gerrit.chromium.org/gerrit/41628
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
19 months agoAU: add missing include 24/41224/2
Gilad Arnold [Mon, 14 Jan 2013 19:58:24 +0000 (11:58 -0800)]
AU: add missing include

Forgot to include gpio_handler.h in system_state.h.

BUG=None
TEST=Builds

Change-Id: I26d54487ad937deb24ea791fdd1fc332d0af021e
Reviewed-on: https://gerrit.chromium.org/gerrit/41224
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>

19 months agoAU: coalesce interactive / user-initiated flags 82/41082/6
Gilad Arnold [Fri, 11 Jan 2013 00:32:45 +0000 (16:32 -0800)]
AU: coalesce interactive / user-initiated flags

The latter was introduced recently but turns out it just carries
a duplicate meaning to the former, so we're eliminating it. This also
makes the case of a simulated scheduled update check more accurate, as
all of the effects of a scheduled update are made.

BUG=None
TEST=Unit tests; interactive/scheduled update check behaves as expected.

Change-Id: I8971aefcfc15cb76733059860832507e88795883
Reviewed-on: https://gerrit.chromium.org/gerrit/41082
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
19 months agoAU: add an interactive flag to Omaha requests 81/41081/5
Gilad Arnold [Fri, 11 Jan 2013 00:06:30 +0000 (16:06 -0800)]
AU: add an interactive flag to Omaha requests

Such a flag can be used to distinguish between user-initiated
(interactive) checks and those that are due to background scheduling. In
the former case, we may want to suppress the probabilistic throttling
that's commonly used with latest releases. This CL piggybacks the new
functionality on top of an existing dataflow used for distinguishing
between interactive / scheduled checks, only it pushes it further so it
is evident in the Omaha request as well.

Comes with a unit test for ensuring that the Omaha flag is set as
expected.

BUG=chromium-os:26594
TEST=Dbus initiated checks correctly tainted

Change-Id: Ia2b3ff5ce3a866c64e453557028b8cbd92c1a258
Reviewed-on: https://gerrit.chromium.org/gerrit/41081
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
19 months agoUse IsDeltaPayload instead of IsDelta. 81/41181/2
Jay Srinivasan [Sat, 12 Jan 2013 01:17:19 +0000 (17:17 -0800)]
Use IsDeltaPayload instead of IsDelta.

Trying to resurrect the IsDelta in an earlier CL to avoid pollution of
Omaha rules turned out to be a wrong choice because R14 and R15 code
strictly expects IsDelta to be true even for full payloads. So
preserving IsDelta's semantics as-is and introducing IsDeltaPayload to
really convey the intended semantics: True if it's delta payload, False
if it's full payload.

BUG=chromium-os:37801
TEST=Updated unit tests. Works fine on ZGB with Omaha devserver.

Change-Id: I899b56be4dcbdcf1981f72d356d40a1e99fdf725
Reviewed-on: https://gerrit.chromium.org/gerrit/41181
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>