History log of /system/update_engine/p2p_manager_unittest.cc
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
39910dcd1d68987ccee7c3031dc269233a8490bb 10-Nov-2015 Alex Deymo <deymo@google.com> Split payload application code into a subdirectory.

This patch splits from the main libupdate_engine code the part that
is strictly used to download and apply a payload into a new static
library, moving the code to subdirectories. The new library is divided
in two subdirectories: common/ and payload_consumer/, and should not
depend on other update_engine files outside those two subdirectories.
The main difference between those two is that the common/ tools are more
generic and not tied to the payload consumer process, but otherwise they
are both compiled together.

There are still dependencies from the new libpayload_consumer library
into the main directory files and DBus generated files. Those will be
addressed in follow up CLs.

Bug: 25197634
Test: FEATURES=test emerge-link update_engine; `mm` on Brillo.

Change-Id: Id8d0204ea573627e6e26ca9ea17b9592ca95bc23
/system/update_engine/p2p_manager_unittest.cc
3f39d5cc753905874d8d93bef94f857b8808f19e 13-Oct-2015 Alex Vakulenko <avakulenko@google.com> update_engine: Rename "chromeos" -> "brillo" in include paths and namespaces

libchromeos is transitioning to libbrillo and chromeos namespaces
and include directory is changing to brillo.

Bug: 24872993
Change-Id: I770659a95be380a50fe3b2ba9f91d65818f40945
/system/update_engine/p2p_manager_unittest.cc
6f20dd4fc8861d93d188cd27323d2f9746464aaf 19-Aug-2015 Alex Deymo <deymo@chromium.org> Fix includes and DBus headers to build on Android.

This patch include a set of small changes to includes and names in
order to be compatible with the Android build system.

First, the DBus .xml file needs to be renamed to .dbus-xml and the
output directory must match the soruce directory, since the headers are
generated with automatic Makefile rules.

Some headers required by bionic were missing, such as endian.h and
xattr.h. In the xattr.h case, we include the header from the glibc
(or bionic) instead of libattr, since libattr is not available in
AOSP in the first place, and we are not linking against it Chrome OS,
so we shold include the right headers.

Bug: 23084776
TEST=`FEATURES=test emerge-link update_engine` works; `mma` in AOSP doesn't have these errors anymore (but still doesn't build).

Change-Id: Ifeedfe9d894ca78baa03940ac55563cfcd464e76
/system/update_engine/p2p_manager_unittest.cc
aea4c1cea20dda7ae7e85fc8924a2d784f70d806 20-Aug-2015 Alex Deymo <deymo@google.com> Re-license update_engine to Apache2

This patch automatically replaced the license on all text files from
Chromium OS (BSD style) to AOSP (Apache2), keeping the original year as
a reference.

The license header was added to .gyp and .gypi files, the NOTICE was
replaced with a copy of the Apache2 license and MODULE_LICENSE_* file
was updated.

BUG=b/23084294
TEST=grep 'Chromium OS Authors' doesn't find anything.

Change-Id: Ie5083750755f5180a8a785b24fe67dbf9195cd10
/system/update_engine/p2p_manager_unittest.cc
c00c98a1dad941e5cc04ce0b0e766d40b3b384e1 18-Mar-2015 Alex Deymo <deymo@chromium.org> update_engine: Use portable string format functions.

Replace usage of %zu by PRIuS or calls to std::to_string when possible.
This patch includes other minor linter fixes.

BUG=None
TEST=emerge-link update_engine

Change-Id: I9ff2b3677ed4218a140f9e91a2389cc756941b03
Reviewed-on: https://chromium-review.googlesource.com/293629
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
0b3db6b6040f53eb9859e614f7fe4c681213d33a 11-Aug-2015 Alex Deymo <deymo@chromium.org> update_engine: Remove all references to glib.

The message loop in production code switched from
chromeos::GlibMessageLoop to chromeos::BaseMessageLoop used in
chromeos::Dameon. This patch moves all the unittests also to use
chromeos::BaseMessageLoop or chromeos::FakeMessageLoop when I/O is not
required.

This patch removes all (now unused) references to glib.

BUG=chromium:499886
TEST=`grep glib[^c] . -R` return no results. Also, unittests work.

Change-Id: Iddfb17def501829d932ed1f70faad3e00268898e
Reviewed-on: https://chromium-review.googlesource.com/292157
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
b7ca096f98a43ebbf412f1b2d3d15bb184f871f8 02-Oct-2014 Alex Deymo <deymo@chromium.org> update_engine: Migrate UE DBus service to chrome DBus bindings.

chromeos-dbus-bindings now generates the adaptor interface that
update_engine exposes over DBus. This interface is implemented in
dbus_service.{h,cc}, which now has a UpdateEngineService class
encapsulating all the service methods implementation.

This allows to write unit test for those methods, which are included
in this CL for all the non-trivial methods.

This CL now uses chrome's DBus bindings for the update_engine serive,
but the proxy interaction is still done using dbus-glib. The main loop
in the main.cc file is now replaced with the chromeos::Dameon, which
uses a chromeos::BaseMessageLoop instead of a GlibMessageLoop. This
causes the asynchronous interactions in the proxy side to not work,
which will be fixed in the next CL.

CQ-DEPEND=CL:290990,CL:291092,CL:293334
BUG=chromium:419827
TEST=Added unittest for all dbus_service methods. deployed and tested manually that update_engine dbus interface works.

Change-Id: I6a6d142b2ac1a61a4c3abcb927665b26114abe5c
Reviewed-on: https://chromium-review.googlesource.com/225324
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
461b259af8815d782200782c5ba3599d8de4a66c 25-Jul-2015 Alex Deymo <deymo@chromium.org> update_engine: Use libchromeos to launch subprocesses.

The Subprocess class handles the execution of suprocesses in the
update_engine such as the post-install script and bspatch operations.

This patch migrates this class from using glib functions to use
libchromeos classes with equivalent functionality.

Callsites and unittests were updated to match the new interface.

BUG=chromium:499886
TEST=Unittest still pass. Deployed on link and cros flash another image
using a delta payload.

Change-Id: Ia64d39734e220675113f393a6049e9a9b0fe8409
Reviewed-on: https://chromium-review.googlesource.com/288837
Trybot-Ready: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
454b798705352bcfbef19759f4dddfe3f0ac490c 10-Jul-2015 Alex Deymo <deymo@chromium.org> update_engine: Remove directory iteration usage of glib.

P2PManager used g_dir_* functions to iterate over the files in a
directory. This patch uses the POSIX equivalent functions instead.

BUG=chromium:499886
TEST=Unittest still pass.

Change-Id: Ia603dcdd5095db8aadf6fbe431b9a92c9d220d04
Reviewed-on: https://chromium-review.googlesource.com/284891
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
b339155941fe27d52c022d01ff5e3faefaa63fa2 10-Jul-2015 Alex Deymo <deymo@chromium.org> update_engine: Remove usage of g_shell_parse_argv().

g_shell_parse_argv() was used as a helper function to specify a command
line in unittests as a string and convert it to a list of command
arguments. With C++11, the overhead of declaring them as a vector of
arguments is minimal, so we just remove the usage of the function
g_shell_parse_argv() completely.

BUG=chromium:499886
TEST=uniitest still pass.

Change-Id: Ibb63ea2cc85d6976bfd45c496906bfcce1f421d6
Reviewed-on: https://chromium-review.googlesource.com/284890
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
60ca1a7bca7cc804ec80b510483081ef894de4cd 19-Jun-2015 Alex Deymo <deymo@chromium.org> update_engine: Migrate time-based glib main loop calls to MessageLoop.

This patch replaces most calls to g_idle_add* and g_timeout_add* with
the equivalent MessageLoop::Post*Task(). To maintain compatibility with
unittests running the main loop and doing I/O we instantiate a
GlibMessageLoop for those tests.

BUG=chromium:499886
TEST=unittests still pass.

Change-Id: Ic87ba69bc47391ac3c36d1bfc3ca28d069666af1
Reviewed-on: https://chromium-review.googlesource.com/281197
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
509dd5376f47e38d18fe7d29da776e3dc9a9786d 10-Jun-2015 Alex Deymo <deymo@chromium.org> update_engine: Convert update_manager to chromeos::MessageLoop.

The update_manager/event_loop.* files were basically an abstraction of
the glib main loop in order to make it easier to replace it later.
This patch removes those files and replaces their functions with the
chromeos::MessageLoop interface, backing it up with a FakeMessageLoop
during test, and a real GlibMessageLoop during normal execution. This
patch reduces the running time of the unittest considerably since there
is no need to wait for the timeouts.

BUG=chromium:419827,chromium:402066
TEST=Unittest still pass. Tested on a link device that the UM still runs.

Change-Id: Id572248ff4c9c8be7226ef8c653a5c94ab9c1677
Reviewed-on: https://chromium-review.googlesource.com/276892
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
3c3807cf75c532d476a04b9d61610f09c301b50b 30-Jan-2015 Alex Deymo <deymo@chromium.org> update_engine: Reduce file size for p2p /tmp files.

The P2PManagerTest.ShareFile unit test requires to have enough free
space in /tmp to hold a file, although it never creates the file.

This patch reduces the requirement from 10MB to 1MB to minimize
false failures when there isn't enough space in /tmp.

BUG=chromium:401341
TEST=FEATURES=test emerge-link update_engine

Change-Id: I6ac5cc6735ed6deef1c81a5dd4a589a0930105df
Reviewed-on: https://chromium-review.googlesource.com/244760
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
610277efc6f7e5239158dfa4bb3b1021804326e0 12-Nov-2014 Alex Deymo <deymo@chromium.org> update_engine: Add override when possible.

Google Style Guide requires to include the "override" keyword
when overriding a method on a derived class, so the compiler will
catch errors if the method is not overriding a member of the base
class.

This patch introduces the "override" keyword when possible.

BUG=None
TEST=FEATURES=test emerge-link update_engine

Change-Id: Ie83d115c5730f3b35b3d95859a54bc1a48e0be7b
Reviewed-on: https://chromium-review.googlesource.com/228928
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
10875d90cf67f883ba7c9ed13bc8d706aa8c6fbc 11-Nov-2014 Alex Deymo <deymo@chromium.org> update_engine: Move test-only utils to test_utils.{h,cc}.

utils.{h,cc} contains a collections of basic or small functions used
in different parts of the codebase. The test_utils.{h,cc} instead
contains functions only required during testing split out to a
separated file to be reused in different tests.

This CL moves without changes some functions defined in utils.h that
were only used during unittests. Two other basic functions were replaced
by the same function already present in base/ (StringHasSuffix and
StringHasPrefix). The functions in test_utils.h now have their own
namespace chromeos_update_engine::test_utils so is clear they come
from the test_utils file, in the same way the ones from utils are
in their own namespace.

Some othe minor linter fixes included here.

BUG=chromium:351429
TEST=Unittest still pass.

Change-Id: I73ab72a14158cb21c8e1f404cbc728423bc8f34f
Reviewed-on: https://chromium-review.googlesource.com/229021
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
4a0321b804524e001b482edea882bd1fc4af98a2 28-Oct-2014 Gilad Arnold <garnold@chromium.org> update_engine: Policy determines P2P enabled status.

This switches the P2P Manager to use the newly introduced Update Manger
policy requests in determining whether P2P is enabled on the system.
There is a policy request for the initial state (P2PEnabled, sync) and
for tracking changes (P2PEnabledChanged, async), with the latest known
value being cached by the P2P Manager.

This also reverses a recent change that moved P2P prefs setting into the
P2PManager. In the absence of any additional logic (now cleared) there
was no point in having a dedicated method just for that, and so
dbus_service writes the prefs value directly. This affords us removing
the prefs argument when initializing the P2PManager.

BUG=chromium:425233
TEST=Unit tests.

Change-Id: I53280f05da8fe532b6502c175a8cc9ddc1e15a87
Reviewed-on: https://chromium-review.googlesource.com/226937
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
41f2cf52137dd94ef9115e27ec8729a126edb0ff 05-Nov-2014 David Zeuthen <zeuthen@chromium.org> update_engine: Share payloads for a maximum of five days only.

This helps limit exposure of what version the device may or may not be
running.

BUG=chromium:424823
TEST=New unit test + unit tests pass.

Change-Id: I9db6f8d560e359c2b8a65d1381dc44320ed4b3a1
Reviewed-on: https://chromium-review.googlesource.com/227592
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
8427b4a6d0e6e02beedbb53798272f8ddc39386f 05-Nov-2014 Alex Deymo <deymo@chromium.org> update_engine: Standarize mock/fake filenames.

Mock classes implement mostly MOCK_METHOD* methods used with gmock.
Those classes should be named with the prefix "Mock" in the class
name and "mock_" in the header filename.

Fake classes implement a working version of the interface they provide,
often with extra functionality to change their behavior. Those classes
should be prefixed with "Fake" in the class name and "fake_" in the
file name.

Other minor include order fixes are included in this patch.

BUG=None
TEST=Unittest still pass.

Change-Id: I23de7cb11e25182d5855afacca47d431c97b82bb
Reviewed-on: https://chromium-review.googlesource.com/227779
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
f329b933db41d26644a97afef928eb1b319d6d99 30-Oct-2014 Alex Deymo <deymo@chromium.org> update_engine: Fix all the "using" declaration usage.

This patch removes unused "using" declarations, that is, declarations
included in a .cc file at a global scope such that "using foo::bar"
that later don't use the identifier "bar" at all.

This also unifies the usage of these identifiers in the .cc files
in favor of using the short name defined by the using declaration.
For example, in several cases the .h refer to a type like
"std::string" because using declarations are forbidden in header
files while the .cc includes "using std::string;" with the purpose
of just writting "string" in the .cc file. Very rarely, the full
identifier is used when a local name ocludes it, for example,
StringVectorToGStrv() and StringVectorToString() in utils.cc named
its argument just "vector" need to refer to std::vector with the
full name. This patch renames those arguments instead.

Finally, it also sorts a few lists of using declarations that weren't
in order.

BUG=None
TEST=FEATURES=test emerge-link update_engine

Change-Id: I30f6b9510ecb7e03640f1951c48d5bb106309840
Reviewed-on: https://chromium-review.googlesource.com/226423
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
02f7c1dee242f490143791dbb73fa23fa3007cfa 19-Oct-2014 Ben Chan <benchan@chromium.org> update_engine: Replace scoped_ptr with std::unique_ptr.

BUG=None
TEST=`FEATURES=test emerge-$BOARD update_engine`
TEST=`USE='clang asan' FEATURES=test emerge-$BOARD update_engine`

Change-Id: I55a2f7f53675faaac20ba25f72ed52cf938d7744
Reviewed-on: https://chromium-review.googlesource.com/224189
Tested-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
9a58e6a2977dea9997234cac71f738f4fff33651 22-Sep-2014 David Zeuthen <zeuthen@chromium.org> update_engine: Use p2p when enterprise-enrolled and policy is unset.

If au_p2p_enabled is unset in the CPanel and the device is
enterprise-enrolled, use p2p. Non-enterprise-enrolled devices will
continue to not use p2p (unless specifically requested by the chrosh
flag).

In effect, this CL enables p2p for enterprises but allows them to opt
out.

BUG=chromium:415563
TEST=New unit tests + unit tests passes.

Change-Id: I8125dfe82c46026e1c97e5dee8abd1e3c4abe12b
Reviewed-on: https://chromium-review.googlesource.com/219332
Reviewed-by: Julian Pastarmov <pastarmovj@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
a77939e368597241fe0153bedce196d7152a5de5 10-Sep-2014 Gabe Black <gabeblack@chromium.org> update_engine: Use utils::FileSize when finding the size of a file.

The utils::FileSize funciton can find the size of a block device correctly.
Use it instead of the adhoc methods used around the codebase.

BUG=chromium:415867
TEST=Ran a butterfly-paladin tryjob with --hwtest.

Change-Id: Id6fd37f04b136b4265bde9b1f56c379a5d9c30f9
Reviewed-on: https://chromium-review.googlesource.com/217418
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
88b591f24cb3f94f982d7024c2e8ed25c2cc26a2 29-Aug-2014 Alex Vakulenko <avakulenko@chromium.org> update_engine: Replace NULL with nullptr

Replaced the usage of NULL with nullptr. This also makes it possible to
use standard gtest macros to compare pointers in Update Manager's unit tests.
So, there is no need in custom UMTEST_... macros which are replaced with the
gtest macros (see change in update_engine/update_manager/umtest_utils.h):

UMTEST_ASSERT_NULL(p) => ASSERT_EQ(nullptr, p)
UMTEST_ASSERT_NOT_NULL(p) => ASSERT_NE(nullptr, p)
UMTEST_EXPECT_NULL(p) => EXPECT_EQ(nullptr, p)
UMTEST_EXPECT_NOT_NULL(p) => EXPECT_NE(nullptr, p)

BUG=None
TEST=FEATURES=test emerge-link update_engine
USE="clang asan" FEATURES=test emerge-link update_engine

Change-Id: I77a42a1e9ce992bb2f9f263db5cf75fe6110a4ec
Reviewed-on: https://chromium-review.googlesource.com/215136
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
44cab30e0ee04b277e8463785ab069e9885a9f2d 23-Jul-2014 Alex Vakulenko <avakulenko@chromium.org> update_engine: Sort headers alphabetically (build/include_alpha)

We are going to enable build/include_alpha linter warning soon,
so in preparation for this, fixed the warnings in update_engine.

BUG=None
TEST=cpplint.py --filter=-build/include_order,+build/include_alpha update_engine/*
CQ-DEPEND=CL:209472

Change-Id: I261ea04681599a68ec7cb899f2f881cbe228ff7b
Reviewed-on: https://chromium-review.googlesource.com/209631
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
072359ca138504065e1e0c1189eb38c09576d324 18-Jul-2014 Alex Vakulenko <avakulenko@chromium.org> update_engine: fixed remaining linter and some spelling errors

Fixed remaining errors from cpplint as well as some spelling errors
mostly in comments.

BUG=None
TEST=FEATURES=test emerge-link update_engine

Change-Id: I484988ab846ac5a3c68c016ddccfb247f225ec27
Reviewed-on: https://chromium-review.googlesource.com/208897
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
8ad6da98cdf5670ac999482d6579fbd49997809a 16-Jul-2014 Alex Deymo <deymo@chromium.org> update_engine: Remove usage of non-literal format string.

FakeP2PManagerConfiguration used a private variable to store a
format string that unittests can change. This implies that we use a
non-literal format string with printf.

This patch instead uses {file_id} and {minsize} as markers on that
string that get replaced later to the passed values, avoiding the
non-literal format string. This also drops the exception flag from
the gyp file.

BUG=chromium:394166
TEST=USE="clang asan" FEATURES="test" cros_workon_make update_engine

Change-Id: I071a743e756c6214f4915b094520ef73ae902362
Reviewed-on: https://chromium-review.googlesource.com/208205
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
d2779df63aaad8b65fc5d4badee7dbc9bed7f2b6 16-Jun-2014 Alex Vakulenko <avakulenko@chromium.org> update_engine: fixed warnings from cpplint

Fixed all the cpplint warnings in update engine.

BUG=None
TEST=Unit tests still pass.

Change-Id: I285ae858eec8abe0b26ff203b99a42a200ceb71c
Reviewed-on: https://chromium-review.googlesource.com/204027
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
75039d7397f03dff77bdf4e26398049ff88edc4c 25-Mar-2014 Alex Vakulenko <avakulenko@chromium.org> update_engine: update to libbase 242728

Made update_engine link with libchrome-242728 and fixed compile
issues due to changes in namespaces and include file layout.

Also removed some of suppressed compiler warnings and fixed the
issues masked by them (e.g. mismatched printf-like specifiers).

Added -Wextra compiler option to enable additional useful warnings
to ensure more strict checking... Had to disable "unused-parameter"
though since we have a lot of functions (mainly in fakes) that do
not use all of their parameters.

BUG=chromium:351593
TEST=Unit tests passed.
CQ-DEPEND=CL:191721

Change-Id: I1aa63a48d5f1f4ea75ba6b00aec7aa5f3bad15c4
Reviewed-on: https://chromium-review.googlesource.com/191510
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
a6742b35938b6f58e24e3f1c550fe92d4d33eb74 11-Jan-2014 Gilad Arnold <garnold@chromium.org> AU: shift to use new TMPDIR-enabled temp file

The main change here is that delta generator will now create all
temporary files in TMPDIR, if set. Other than that, we're converting all
other temporary file/directory creation to use the new functions.

- All temps of the form "/tmp/foo" are converted to "foo": this
preserves the behavior in the default case (where TMPDIR is not set),
yet will do the right thing if run with a different TMPDIR.

- A few other cases (for example, temp file created relative to the
current working directory) will now be created in TMPDIR or /tmp.
These are all in unit tests and the transition makes sense anyway.

Note that two temp file/directory creation calls in actual UE code were
using "/tmp/..." and were not changed. This will ensure that they are
resilient to TMPDIR changes and will always be allocated in the same
(hard-coded) location.

BUG=chromium:253622
TEST=Unit tests.

Change-Id: Ia1208963a0e2fcd43b8d6f92bb3d1b7459e930a2
Reviewed-on: https://chromium-review.googlesource.com/182247
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
910ec5b95d98c81edc5a8d40bc0210b0559f371b 26-Sep-2013 David Zeuthen <zeuthen@chromium.org> p2p: Skip some tests if xattr support is not available.

This is needed because some builders still lack xattr / fallocate
support despite being updated to Precise. Also gracefully handle lack
of fallocate(2) support since this feature is not always available
either.

BUG=chromium:298397
TEST=Remounted the filesystem holding my chroot with nouser_xattr
(e.g. 'mount -oremount,nouser_xattr /ssd') and unit tests pass with
the newly added warning.

Change-Id: I0fe53d762fad778a3d68162ddcd8bc74557fba6b
Reviewed-on: https://chromium-review.googlesource.com/170782
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
41f7fdc7fd0bf88c46a1a0035db2a0ec4252199c 19-Sep-2013 Alex Deymo <deymo@chromium.org> p2p: Re-enable p2p unittests on update_engine.

These tests were disabled because they fail on systems where
fallocate is not supported on /tmp. Now that all the test
infrastructure is running precise we can re-enable these tests.

BUG=chromium:281496
TEST=run tests on peppy-paladin (failing before)

Change-Id: Ia9a53448ed9c357ff15619ddad255e616ec81871
Reviewed-on: https://chromium-review.googlesource.com/170028
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
92d9c8bc5cd418e34944d6fc4bae44e3b4370246 11-Sep-2013 David Zeuthen <zeuthen@chromium.org> Also use DevicePolicy::GetAuP2PEnabled() to determine if p2p is enabled

With this change update_engine will use p2p either if the user has
manually enabled it (through the crosh flag) OR if the enterprise has
enabled it in Enterprise Policy.

BUG=chromium:260442
TEST=New unit tests + unit tests pass.

Change-Id: I54cd92c481bd2fd7c90232d7137ce2b37fa2ce61
Reviewed-on: https://chromium-review.googlesource.com/168950
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
0f5135106b59d46f134a7149305f2b8228103cf9 13-Sep-2013 Alex Deymo <deymo@chromium.org> unittest: Ensure different timestamps on generated files.

The test P2PManagerTest.Housekeeping needs to generate files with
different timestamps to test the Housekeeping function. These
timestamps are affected by the file system's time resolution which
is 1 second on ext2/ext3 and 1 nanosecond on ext4. The previous fix
introduced by CL:167882 didn't solve the problem because touch -t
replaces the "Modify" and "Create" times, but not the "Change" time
which is the one used by Housekeeping.

This patch ensures that the timestamps on the created files are
different sleeping enough time to allow the kernel put a different
timestamp for the "Change" time. The slept time depends on the
file system time resolution, making it shorter when ran on
file systems with higher resolution.

BUG=chromium:290257,chromium:281694
TEST=Run unittest on an environment where /tmp is an ext2 FS.

Change-Id: I5631ef317813b83443b36e0e5b660cafb8616f59
Reviewed-on: https://chromium-review.googlesource.com/169381
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Yunlian Jiang <yunlian@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
45e2ae284660b640cba967bb266f8d2ab766021d 03-Sep-2013 David Zeuthen <zeuthen@chromium.org> p2p: rewrite P2PManager.Housekeeping test so it's not flaky

Instead of sleeping so the kernel chooses a new timestamp, just set it
manually. Also spell housekeeping as one word instead of two.

BUG=chromium:281694
TEST=unit tests pass

Change-Id: I124131e2e4d7c1deeaa666affd1f78a6d98b24a5
Reviewed-on: https://chromium-review.googlesource.com/167882
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
d5b3e427e14817266da4d6ead89815778dedf089 29-Aug-2013 David Zeuthen <zeuthen@chromium.org> p2p: disable flaky housekeeping test for now

BUG=chromium:281694
TEST=unit tests pass

Change-Id: I857ba2dd2762ca1e6d5aecd4e549daeaaa956faa
Reviewed-on: https://chromium-review.googlesource.com/167482
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
ac9c1860534944de50168166575715167366459c 29-Aug-2013 David Zeuthen <zeuthen@chromium.org> p2p: comment out tests failing on builders without xattr/fallocate support

This is a stop-gap fix to avoid holding up the CQ.

BUG=chromium:281496
TEST=unit tests pass

Change-Id: If380912619e14c8b65d7c758170b157a69444770
Reviewed-on: https://chromium-review.googlesource.com/167432
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
/system/update_engine/p2p_manager_unittest.cc
27a48bc3f2531166370c214f7a21e17fb1fc7af1 06-Aug-2013 David Zeuthen <zeuthen@chromium.org> p2p: Add P2PManager class

This class makes it simple to use p2p both as a client and a server.

For now, this feature is hidden behind a flag. The intent is that this
flag can be toggled with the crosh command - for now, only the reading
of the flag is implemented - see chromium:260441 for the remaining
work.

BUG=chromium:260426,chromium:260441
TEST=New unit tests + unit tests pass
Change-Id: If1879f4535c8e7e3af7c6d378e6df4054264b794
Reviewed-on: https://chromium-review.googlesource.com/64824
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
/system/update_engine/p2p_manager_unittest.cc