aboutsummaryrefslogtreecommitdiff
path: root/chromeos
AgeCommit message (Collapse)Author
2015-09-08Improve default logging when sending asynchronous HTTP requestsAlex Vakulenko
When analyzing production logs (with log level = 0/INFO) it is difficult to judge when HTTP request succeed or fail. With --v=2 enabled, all of this is provided, but this is not good for production devices and their logs. Added request/response tracking messages to LOG(INFO) level to make log analysis easier. BUG: 23791756 Change-Id: Ie3bf48d45d6facb02a6d26176d10a5612d4e683b
2015-09-02Add libpolicy stub-implementation to Android.mkAlex Deymo
libpolicy is installed directly as "policy" in Chrome OS, so this patch moves the chromeos/policy directory one level up to match what users will see in installed Chrome OS include dir. A new libchromeos-policy shared library is included in the Android.mk. BUG: 23555535 TEST=emerge-link libchromeos; `mm` in aosp. Change-Id: I0d62a1651632242a08309ca2c00056837a5280a6
2015-08-27libchromeos: remove libchromeos-ui.Bertrand SIMONNET
libchromeos-ui is moving back to src/platform2 as it is only used on chromeos. BUG=chromium:525211 TEST=manual: `emerge-gizmo libchromeos` does not install libchromeos-ui. TEST=trybots. Change-Id: Id16af4b9f4aa090ef2c9805f6e963773bd62a881
2015-08-26Merge "libchromeos: disable accelerated video decode on sandybridge."Haixia Shi
2015-08-25libchromeos: disable accelerated video decode on sandybridge.Haixia Shi
BUG=chromium:521249 TEST=emerge-lumpy libchromeos, verify cmdline is added Change-Id: I9694fb465715bcaf29d9dcfc07a9b21b7ede8e9f
2015-08-25libchromeos: dbus: support additional types for variant deserializationPeter Qiu
This is needed for supporting cellular modem proxies in shill. While there, use std::tuple instead of std::pair for deserializing struct variant type. BUG=chromium:517680 TEST=build libchromeos TEST=Run network_3GSmokeTest on device with shill using libchromeos dbus Change-Id: I6c138ee4a52c2655143929c70d6958d6aff3b05f
2015-08-19Merge "Use __ANDROID__ instead of __BRILLO__."Daniel Erat
2015-08-19Use __ANDROID__ instead of __BRILLO__.Daniel Erat
__ANDROID__ is defined automatically by the toolchain. Bug: 23358460 Change-Id: I125d56638f06f0eb10ba0cde147ab835522959f1
2015-08-19libchromeos: Fix the CA store pathAlex Vakulenko
The certificates are stored at /system/etc/security/cacerts on Brillo BUG: 23352819 Change-Id: I0ed8a084bb8597671fffd33b03f3d5b5dc01f52c
2015-08-14libchromeos: Prevent starvation in BaseMessageLoop.Alex Deymo
(cherry-picked from https://chromium.googlesource.com/a/chromiumos/platform2 at 3f609aba265a91634b5af226ceac9783beac6b36) When more than once source of events (file descriptor available or delayed task ready) is available, the MessageLoop has some freedom to schedule between I/O tasks and delayed tasks. The base::MessageLoopForIO will not dispatch posted delayed tasks if there are file descriptors indefinitely available and will prefer to allways run all the I/O callbacks before running the delayed tasks that are due, causing what is known as starvation. In the Chrome context, this is not a big problem since the thread running the base::MessageLoopForIO normally posts delayed tasks to other threads. Even with a single CPU, it is sufficient to have a fair thread scheduler to avoid starvation. In the Chrome OS context of single threaded daemons doing I/O, this is more important. This patch tightens the contract on chromeos::MessageLoop API to prevent starvation. The chromeos::GlibMessageLoop implementation already ensures this property, so we fix the chromeos::BaseMessageLoop by posting a task to the message loop when a file descriptor is ready and stop watching that file descriptor while the task is waiting in the message loop. New unittest are included here to verify the same behaviour over both implementations. BUG=chromium:419827 TEST=Added unittest. Change-Id: Ibc0aa999b9e86e6e3205d71ece3a7b72e019b6a3 Reviewed-on: https://chromium-review.googlesource.com/293334 Reviewed-by: Alex Vakulenko <avakulenko@chromium.org> Trybot-Ready: Alex Deymo <deymo@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org>
2015-08-13Added unit test target, unit tests run and pass with bionic runnerAri Hausman-Cohen
As b/22772126 says, mm runtests should do the "right thing". For clarity, this has been renamed so you use mm runtargettests. The "right thing" is here interpreted to mean build & run the unit tests using the bionic test runner on the target. All tests should pass. BUG: 22772126, 22874311 Change-Id: Id68bbf18bc7a8b3b36e80408af0399fdb53bad61
2015-08-12libchromeos: dbus: deserialize variant valuePeter Qiu
Allows parser to deserialize a variant value from a non-variant type value. BUG=chromium:519576 TEST=emerge-$BOARD libchromeos shill TEST=Verify with wifi autotests against shill with chromeos dbus Reviewed-on: https://chromium-review.googlesource.com/292056 Reviewed-by: Alex Vakulenko <avakulenko@chromium.org> Tested-by: Zeping Qiu <zqiu@chromium.org> Commit-Queue: Zeping Qiu <zqiu@chromium.org> (cherry-picked from https://chromium.googlesource.com/chromiumos/platform2 at e4fffa682cd9d22642d0fec7fa55ac970e57cc91) Change-Id: Ic40865a39ede3d635e704dddb22cf995349aeaa8
2015-08-12libchromeos: dbus: unregister DBus object synchronouslyPeter Qiu
When DBus object is unregistered explicitly, it allows its path to be reused. BUG=chromium:518026 TEST=emerge-$BOARD libchromeos shill TEST=Verify using shill with chromeos dbus Reviewed-on: https://chromium-review.googlesource.com/291841 Reviewed-by: Alex Vakulenko <avakulenko@chromium.org> Tested-by: Zeping Qiu <zqiu@chromium.org> Commit-Queue: Zeping Qiu <zqiu@chromium.org> (cherry-picked from https://chromium.googlesource.com/chromiumos/platform2 at 5688fbaf4aeb195c6915d3f362b888e549b7a010) Change-Id: I77d88089b687df85afd78ebe0178040f24be8a31
2015-08-12libchromeos: Don't WaitForData() if the Stream doesn't block.Alex Deymo
Read[All]Async and Write[All]Async would first call WaitForData() before attempting to read/write from the Stream. In some cases, such asi the FileStream implementation using a BaseMessageLoop (base::MessageLoopForIO, implemented using libevent/epoll) we can't WaitForData() on a file descriptor if it never blocks. A regular file or a block device are common examples of a file descriptor for wich we can't call MessageLoop::WatchFileDescriptor() in that implementation. This CL prevents this scenario by calling first ReadNonBlocking() or WriteNonBlocking() and then falling back to WaitForData() only if ReadNonBlocking() or WriteNonBlocking(), respectively, return a situation in which the Blocking call would actually block. BUG=chromium:499886 TEST=Updated unittests. Reviewed-on: https://chromium-review.googlesource.com/291092 Tested-by: Alex Deymo <deymo@chromium.org> Trybot-Ready: Alex Deymo <deymo@chromium.org> Reviewed-by: Alex Vakulenko <avakulenko@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org> (cherry-picked from https://chromium.googlesource.com/chromiumos/platform2 at cd6dfe22ffaf6322b33bbf2e1f1322093d67a46e) Change-Id: Iba97e384e9fb5aa7827b68e11135b396dcda67ed
2015-08-12libchromeos: dbus: synchronous dbus object registrationPeter Qiu
This allows shill to maintain its current behavior regarding to DBus object registration. BUG=chromium:517721 TEST=emerge-$BOARD libchromeos shill TEST=Verify with shill using chromeos dbus Reviewed-on: https://chromium-review.googlesource.com/291432 Commit-Ready: Zeping Qiu <zqiu@chromium.org> Tested-by: Zeping Qiu <zqiu@chromium.org> Reviewed-by: Alex Vakulenko <avakulenko@chromium.org> (cherry-picked from https://chromium.googlesource.com/chromiumos/platform2 at 2962f062990d2b04646c84def2284e607f9d1113) Change-Id: Id1379008e82a34c1ccf8e21d4c1d3393aa207081
2015-08-12libchromeos: Use MockMessageLoop on FakeStream.Alex Deymo
The added MockMessageLoop is a mockable FakeMessageLoop. By default the mock object will behave like a fake one, but it is also possible to set expectations on the MessageLoop methods. The MockMessageLoop now replaces the base::TaskRunner used in FakeStream and runs the posted callbacks from the message loop instead of running them when they are posted. libweave is updated to create the FakeStream using a chromeos::MessageLoop. BUG=chromium:499886 TEST=FEATURES=test emerge-link libchromeos libweave buffet Reviewed-on: https://chromium-review.googlesource.com/290632 Reviewed-by: Vitaly Buka <vitalybuka@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org> Commit-Queue: Vitaly Buka <vitalybuka@chromium.org> (cherry-picked from https://chromium.googlesource.com/chromiumos/platform2 at 78c174362c0ce8f75c53ab37da1874533eb1a56a) Change-Id: I5b6952fc75e7300e9734e6f8f8103fe684584712
2015-08-12libchromeos: Use chromeos::MessageLoop in Streams classes.Alex Deymo
This patch replaces the calls to base::MessageLoopForIO with calls to chromeos::MessageLoop in the Stream classes. This allows to use Streams with other message loops. BUG=chromium:499886 TEST=Unittests updated. Reviewed-on: https://chromium-review.googlesource.com/290541 Reviewed-by: Alex Vakulenko <avakulenko@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org> Trybot-Ready: Alex Deymo <deymo@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org> (cherry-picked from https://chromium.googlesource.com/chromiumos/platform2 at 8f3af00c53aef99d1f7fab2f1d8035a9b5b4f7e9) Change-Id: I04c78b0dc258a2eff9ab0b4eb8559f4f02feab46
2015-08-06Add libchromeos-minijail target.Jorge Lucangeli Obes
Also fix a bunch of comments. "Target" in this context does not refer to the build target (e.g 'libchromeos') but to the fact that it's building *for* the target architecture (e.g. ARM) and not for the host. Bug: 22557394 Change-Id: Icabcb28809a46b74c3d5b4e8bd1975dda684598a
2015-08-03Silence unused parameter warnings in dbus_param_writer.hChristopher Wiley
Bug: 22880161 Change-Id: I7a7c30abb4776e3bd1986f0453d49a9943e94449
2015-07-31process_test: Fix binary path in android.Bertrand SIMONNET
In android, binaries are in /system/bin instead of /bin. BUG: 22372020 Change-Id: Ie1d94a317ad8126328db2d9bf2540bba6fbf5850
2015-07-29libchromeos: Print the error message when exec*() fails.Alex Deymo
PLOG(ERROR) will print the error message based on errno. This patch replaces "LOG(ERROR) << ... << errno" with "PLOG(ERROR) << ..." in the Process. BUG=None TEST=Running a command that doesn't exists shows the error message on stderr. Change-Id: Id55a9a37b1e478103c23b8017dc7444de3e8ed18 Reviewed-on: https://chromium-review.googlesource.com/288783 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>
2015-07-29libchromeos: Prevent closing known bad fd in Process class.Alex Deymo
When using ProcessImpl::BindFd the parent_fd is set to -1. This causes the process to call close(-1) which will silently fail. This patch avoids calling close on the parent_fd when it is -1 so we don't issue a known bad call to close. This makes it easier to debug problems when running such program with strace. BUG=None TEST=Unittests still pass. Change-Id: I3a69fca21a4ba4a5911897b13a95bdeffd53d3cf Reviewed-on: https://chromium-review.googlesource.com/288782 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>
2015-07-29bootstat: Move bootstat to its own subdirectory.Bertrand SIMONNET
bootstat should not be compiled with libchromeos. This also replaces the old Makefile with a gyp file. BUG=None TEST=Unittests TEST=trybot run on lumpy-incremental daisy link gizmo chromiumos-sdk. CQ-DEPEND=CL:289240 Change-Id: I0c11fa53edbec6c8be9aa93ba8ebc38a051fac79 Reviewed-on: https://chromium-review.googlesource.com/289214 Tested-by: Bertrand Simonnet <bsimonnet@chromium.org> Reviewed-by: Christopher Wiley <wiley@chromium.org> Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org> Trybot-Ready: Bertrand Simonnet <bsimonnet@chromium.org>
2015-07-28libchromeos: Move AsynchronousSignalHandler to an interface.Alex Deymo
Both chromeos::AsynchronousSignalHandler and chromeos::Daemon implemented the same Register/Unregister interface for signal handlers. This patch moves that functionality to an abstract interface and makes chromeos::ProcessReapper use that instead of having two methods. BUG=None TEST=Unittests still pass. Change-Id: Ib2aa8c5279b5998e7c88c2211809901fa11a8f0a Reviewed-on: https://chromium-review.googlesource.com/288752 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>
2015-07-25libchromeos: New class to watch child processes.Alex Deymo
This patch ports the ProcessReaper class previously used in germ to libchromeos with a base::Callback interface. This class allows you to wait for a child process in the message loop, similar to what the g_child_watch_add() function does in glib. This class is compatible with both GlibMessageLoop and BaseMessageLoop. BUG=chromium:361635 TEST=Added unittests. Change-Id: Ia40246729c99a487fdf0039a28b30ba92f0e7da4 Reviewed-on: https://chromium-review.googlesource.com/288259 Trybot-Ready: Alex Deymo <deymo@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org> Reviewed-by: Alex Vakulenko <avakulenko@chromium.org> Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
2015-07-24libchromeos: use chromeos::MessageLoop in AsynchronousSignalHandler.Alex Deymo
This patch makes AsynchronousSignalHandler use the chromeos::MessageLoop interface instead of rely on the message loop being the base::MessageLoopForIO. BUG=chromium:499886 TEST=FEATURES=test emerge-link libchromeos Change-Id: Ib206e99ca48098d1998725c8103c271e7b808a6d Reviewed-on: https://chromium-review.googlesource.com/287001 Reviewed-by: Alex Vakulenko <avakulenko@chromium.org> Trybot-Ready: Alex Deymo <deymo@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org>
2015-07-24libchromeos: Add a default chromeos::MessageLoop to Daemon.Alex Deymo
In order to use chromeos::MessageLoop::curent() we need to have an instance created and set as default. This patch creates the wrapper for base::MessageLoopForIO in chromeos::Daemon so daemons can use either interface. This patch also runs the base::MessageLoopForIO via the chromeos::MessageLoop wrapper so calls to chromeos::MessageLoop::BreakLoop() work as expected. This methods was updated to not use the deprecated Run/QuitNow() methods in the base::MessageLoop interface and use a base::RunLoop instead. BUG=chromium:506052 TEST=`FEATURES=test emerge-link libchromeos` still works.` Change-Id: I16188e399a48923e398fb621875debff01accea7 Reviewed-on: https://chromium-review.googlesource.com/286825 Reviewed-by: Alex Vakulenko <avakulenko@chromium.org> Trybot-Ready: Alex Deymo <deymo@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org>
2015-07-24libchromeos: HttpConnection: Check the response in the unittests.Bertrand SIMONNET
BUG=None TEST=unittests. Change-Id: I4b91d46fb23027034f13d391e8eabb116ed54535 Reviewed-on: https://chromium-review.googlesource.com/287763 Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org> Tested-by: Bertrand Simonnet <bsimonnet@chromium.org> Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
2015-07-24libchromeos: process.cc fail cleanly when no arguments are specified.Bertrand SIMONNET
If we attempt to spawn a process to run an executable, fail early instead of waiting for the call to fail. BUG=None TEST=unittests pass. TEST=trybot run on daisy, link, lumpy, mips. Change-Id: I1742101eb47787b948b20d4129a8b1893dba0568 Reviewed-on: https://chromium-review.googlesource.com/287864 Reviewed-by: Bertrand Simonnet <bsimonnet@chromium.org> Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org> Trybot-Ready: Bertrand Simonnet <bsimonnet@chromium.org> Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
2015-07-24libchromeos: Fix race condition in process_test.Bertrand SIMONNET
Running the process with Start instead of Run before checking the output make it possible to read the output before the program exits. BUG=None TEST=`FEATURES=test emerge-gizmo libchromeos --nodeps` works. Change-Id: I021b2d6d03fb8d99fd0673ed37746d23c11bf2cb Reviewed-on: https://chromium-review.googlesource.com/287891 Trybot-Ready: Bertrand Simonnet <bsimonnet@chromium.org> Tested-by: Bertrand Simonnet <bsimonnet@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org> Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
2015-07-24libchromeos: Don't use a local path in unittests.Bertrand SIMONNET
Use ScopedUniqueTempDir instead so that the unittests can be run from anywhere. BUG=None TEST=`FEATURES=test emerge-gizmo libchromeos --nodeps` works Change-Id: Ic32473835c72e268ab04c025159c67f11f0f99b0 Reviewed-on: https://chromium-review.googlesource.com/287890 Trybot-Ready: Bertrand Simonnet <bsimonnet@chromium.org> Tested-by: Bertrand Simonnet <bsimonnet@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org> Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
2015-07-23libchromeos: Added test for DBus serialization of Any{vector<vector>}Vitaly Buka
Just to highlight that this is not implemented. BUG=none TEST='FEATURES=test emerge-gizmo libchromeos' Change-Id: If498509b6a575001086613afe9402936d62be218 Reviewed-on: https://chromium-review.googlesource.com/287844 Trybot-Ready: Vitaly Buka <vitalybuka@chromium.org> Tested-by: Vitaly Buka <vitalybuka@chromium.org> Reviewed-by: Alex Vakulenko <avakulenko@chromium.org> Commit-Queue: Vitaly Buka <vitalybuka@chromium.org>
2015-07-23libchromeos: Remove modp_b64 source.Bertrand SIMONNET
modp_b64 is now compiled separately in dev-utils/modp_b64. We can remove the code from libchromeos and link against it in libchromeos.gypi. BUG=chromium:510532 TEST=`cros_run_unit_tests --board=gizmo --packages libchromeos` works. CQ-DEPEND=CL:285937 Change-Id: I8ca33009fe06151accc015bdc9c692f53c043311 Reviewed-on: https://chromium-review.googlesource.com/286012 Tested-by: Bertrand Simonnet <bsimonnet@chromium.org> Reviewed-by: Arman Uguray <armansito@chromium.org> Reviewed-by: Alex Deymo <deymo@chromium.org> Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
2015-07-22libchromeos: Don't rely on the internal of std::string.Bertrand SIMONNET
We should not rely on the fact that string copy might be done lazily. BUG=None TEST=`FEATURES=test emerge-gizmo libchromeos --nodeps` works. Change-Id: Ie0a798b9be6347a715203b291d083757f8d66510 Reviewed-on: https://chromium-review.googlesource.com/287503 Trybot-Ready: Bertrand Simonnet <bsimonnet@chromium.org> Tested-by: Bertrand Simonnet <bsimonnet@chromium.org> Reviewed-by: Christopher Wiley <wiley@chromium.org> Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org> Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
2015-07-22libchromeos: Use sh instead of bash in process_test.Bertrand SIMONNET
Don't rely on bash for sh functionality. This allows the unittests to run on system that don't have bash. BUG=None TEST=`FEATURES=test emerge-gizmo libchromeos --nodeps` works. CQ-DEPEND=CL:287404 Change-Id: Icf3ae17a9a4f0553e5c623927d25d60303b88306 Reviewed-on: https://chromium-review.googlesource.com/287405 Trybot-Ready: Bertrand Simonnet <bsimonnet@chromium.org> Tested-by: Bertrand Simonnet <bsimonnet@chromium.org> Reviewed-by: Christopher Wiley <wiley@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org> Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
2015-07-22libchromeos: Don't rely on cp's error output.Bertrand SIMONNET
Instead of relying on cp's error message to test stderr handling in chromeos/process.cc, print to stderr by redirecting echo. BUG=None TEST=`FEATURES=test emerge-gizmo libchromeos --nodeps` works. Change-Id: I2454f060ceeca4ebd2e2b276613d3d2d3730f814 Reviewed-on: https://chromium-review.googlesource.com/287404 Trybot-Ready: Bertrand Simonnet <bsimonnet@chromium.org> Tested-by: Bertrand Simonnet <bsimonnet@chromium.org> Reviewed-by: Christopher Wiley <wiley@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org> Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
2015-07-22libchromeos: Remove incorrect test.Bertrand SIMONNET
dca2caf2ea0d27d1abd0e47f1dbf509bb627dd6c changed the behaviour of Process to not fail when the output file already exists. The test should be remove too. BUG=None TEST=FEATURES=test emerge-gizmo libchromeos --nodeps Change-Id: I6495190cf347c8f7dc8eb9f8bd57f01b6d15591e Reviewed-on: https://chromium-review.googlesource.com/287403 Trybot-Ready: Bertrand Simonnet <bsimonnet@chromium.org> Tested-by: Bertrand Simonnet <bsimonnet@chromium.org> Reviewed-by: Christopher Wiley <wiley@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org> Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
2015-07-16libchromeos: MessageLoop implementation using base::MessageLoopForIO.Alex Deymo
The new chromeos::BaseMessageLoop implementation uses the existing base::MessageLoopForIO implementation, that in the Linux and ChromeOS context uses base::MessagePumpLibevent, a libevent based implementation. This chromeos::MessageLoop allows to mix calls to base::MessageLoopForIO and chromeos::MessageLoop with few limitations. This is useful when using other code in libchrome that already interacts with libchrome's MessageLoopForIO. Among the limitations, the support for canceling a task will not free the memory associated with the delayed event until it actually fires. Also, base::MessagePumpLibevent uses epoll(7) which doesn't support watching for file descriptors that would not naturally block (such as regular files). Attempting to watch for those file descriptors will return kTaskIdNull in this implementation, but would work on chromeos::GlibMessageLoop. This patch moves most of chromeos::GlibMessageLoop existing tests to a common chromeos::MessageLoop test that runs for both implementations. BUG=chromium:506052 TEST=Added unittests. Change-Id: I4553d149511806ed599fa2847af4372985456106 Reviewed-on: https://chromium-review.googlesource.com/285217 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>
2015-07-15libchromeos: Don't import from libchromeos/chromeos.Bertrand SIMONNET
When importing a libchromeos header in libchromeos or in another package, don't prefix the import path with libchromeos/. The headers for the libchromeos shared library are installed in /usr/include/chromeos. Using libchromeos/chromeos/* will use the headers from src/platform2/libchromeos which may not match the .so. BUG=None TEST=cros_workon-gizmo start libchromeos germ feedback && ./build_packages --board=gizmo TEST=`cros_run_unit_tests --board=gizmo --packages "libchromeos germ feedback"` succeeds. Change-Id: I027d41c6013872887eaed572e2065f936a7b4fd0 Reviewed-on: https://chromium-review.googlesource.com/285772 Reviewed-by: Dan Erat <derat@chromium.org> Tested-by: Bertrand Simonnet <bsimonnet@chromium.org> Trybot-Ready: Bertrand Simonnet <bsimonnet@chromium.org> Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
2015-07-15libchromeos: Include numeric for std::iota.Bertrand SIMONNET
BUG=None TEST=cros_run_unit_tests --board=gizmo libchromeos. Change-Id: I9fb3b8ce6c6f5938e39fb1bd7ede1ce2a18c9fec Reviewed-on: https://chromium-review.googlesource.com/285850 Tested-by: Bertrand Simonnet <bsimonnet@chromium.org> Reviewed-by: Alex Vakulenko <avakulenko@chromium.org> Trybot-Ready: Bertrand Simonnet <bsimonnet@chromium.org> Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
2015-07-15libchromeos: Improve VLOG(1) for async HTTP requestsAlex Vakulenko
In order to help with tracking HTTP requests and responses, moved "noise" log messages from VLOG(1) to VLOG(2) and made sure that each async request ID is logged before the request is dispatched and also when response is received, the request ID is also logged so it is easy to identify the matching request-response pairs. BUG=None TEST=`FEATURES=test emerge-link libchromeos` Change-Id: I481ce25c8b3f2867ac8036c13bbee91bc8f6f838 Reviewed-on: https://chromium-review.googlesource.com/285744 Trybot-Ready: Alex Vakulenko <avakulenko@chromium.org> Tested-by: Alex Vakulenko <avakulenko@chromium.org> Reviewed-by: Vitaly Buka <vitalybuka@chromium.org> Commit-Queue: Vitaly Buka <vitalybuka@chromium.org>
2015-07-15Add libchromeos-glib for glib dependenciesChristopher Wiley
This cleans up the dependency tree for daemons linking libchromeos so that only those that actually need glib link against it. BUG=chromium:508218 TEST=trybots Change-Id: Iec92f061ae00b81bc440f4c58082adc6cdb059a3 Reviewed-on: https://chromium-review.googlesource.com/284079 Reviewed-by: Alex Deymo <deymo@chromium.org> Commit-Queue: Christopher Wiley <wiley@chromium.org> Tested-by: Christopher Wiley <wiley@chromium.org>
2015-07-11libchromeos: Watch file descriptors on error conditions.Alex Deymo
When watching for a file descriptor, guaranties are that the callback will be called if a call to read() or write() (depending on what are you watching for) will not block even if the file descriptor doesn't have the O_NOBLOCK flag set. This is normally because there is data to read or it is possible to write data, but can also be because the file descriptor is closed (invalid) or the end of file or device is reached. In the last two cases, a read() or write() will return immediately with an error or a value of 0, but won't block. This patch makes GlibMessageLoop implementation watch for those cases as well. BUG=None TEST=Added unittests. Change-Id: I7d9d7671165ebf08b459cfff5d52bd09e6daabc1 Reviewed-on: https://chromium-review.googlesource.com/284711 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>
2015-07-01libchromeos: Add {LoadFrom,SaveTo}String to KeyValueStore.Alex Deymo
This patch extends the chromeos::KeyValueStore to support loading and saving from strings directly. BUG=None TEST=Updated unittests. Change-Id: I2b33cc9d427bba7b51733db3068cba08071c7b2b Reviewed-on: https://chromium-review.googlesource.com/282380 Tested-by: Alex Deymo <deymo@chromium.org> Trybot-Ready: Alex Deymo <deymo@chromium.org> Reviewed-by: Alex Vakulenko <avakulenko@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org>
2015-06-30libchromeos: power: Remove cmasone from OWNERS filesChris Masone
Later, kids. BUG=None TEST=None Change-Id: If9c1fdf42b38536b0fd0b4495281673d750407a3 Reviewed-on: https://chromium-review.googlesource.com/282760 Commit-Queue: Chris Masone <cmasone@chromium.org> Trybot-Ready: Chris Masone <cmasone@chromium.org> Tested-by: Chris Masone <cmasone@chromium.org> Reviewed-by: Dan Erat <derat@chromium.org>
2015-06-30libchromeos: Implement I/O watching in MessageLoop.Alex Deymo
This patch introduces a simple I/O watching method to the MessageLoop interface following the pattern used by shill and what glib and libevent can offer as implementation backend. This also includes implementations for the GlibMessageLoop and the FakeMessageLoop. BUG=brillo:91,chromium:402066 TEST=Added unittest to validate GlibMessageLoop. Change-Id: I0a0032bc40f6fd046b8b98076e0f553cdcd69051 Reviewed-on: https://chromium-review.googlesource.com/282110 Reviewed-by: Alex Deymo <deymo@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org>
2015-06-30libchromeos: Import modp_b64.Bertrand SIMONNET
Instead of using openssl's base64 encoder/decoder, import modp_b64 and use it. modp_b64 is imported from chromium. This removes the dependency of an interface of openssl that is not available in boringssl. BUG=None TEST=unittests. TEST=trybot runs. CQ-DEPEND=CL:281990 Change-Id: Idccab41cecbbe6ca5f2bec5ff20ffc75d5a0fab4 Reviewed-on: https://chromium-review.googlesource.com/281991 Tested-by: Bertrand Simonnet <bsimonnet@google.com> Tested-by: Bertrand Simonnet <bsimonnet@chromium.org> Reviewed-by: Alex Vakulenko <avakulenko@chromium.org> Commit-Queue: Bertrand Simonnet <bsimonnet@chromium.org>
2015-06-25libchromeos: Remove leaked tasks from GlibMessageLoop destructor.Alex Deymo
The GlibMessageLoop implementation uses the default context to help integrate with source that access both the glib main loop directly and via the chromeos::MessageLoop interface. This means that tasks scheduled with one GlibMessageLoop instance will run even from another instance of the same class in the same thread. To prevent leaking callbacks between GlibMessageLoop instances, such as the ones created for unittests, this patch removes and logs all the leaked pending callbacks when the instance is destroyed. BUG=chromium:499886 TEST=Ran update_engine tests that leaked callbacks and saw the warnings. Change-Id: I94ac97da1e342a3aa58400de5b2d5cf05463aa32 Reviewed-on: https://chromium-review.googlesource.com/281445 Tested-by: Alex Deymo <deymo@chromium.org> Trybot-Ready: Alex Deymo <deymo@chromium.org> Reviewed-by: Alex Vakulenko <avakulenko@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org>
2015-06-23libchromeos: Fix CancelTask from the running task.Alex Deymo
This patch removes the task_id from the map before running the user provided callback, while keeping the ScheduledTask struct alive. This makes CancelTask() return false when calling it from the same task you are running. BUG=None TEST=Added unittest. Change-Id: Id5e15a1111673f16a8ba9a0acfa2a46c1b64d5d1 Reviewed-on: https://chromium-review.googlesource.com/281060 Reviewed-by: Alex Deymo <deymo@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org>
2015-06-20libchromeos: Add Location to MessageLoop interface.Alex Deymo
This patch adds an optional first parameter Location to PostTask() and PostDelayedTask() to help track where the callbacks are being scheduled from when running with DEBUG enabled. This patch also logs these locations from the GlibMessageLoop when verbose logging >= 1 is enabled and libchromeos is compiled with debug, and logs from FakeMessageLoop when verbose logging >= 1 is enabled regardless of libchromeos being compiled with debug since FakeMessageLoop is only used from unittest code. BUG=brillo:91 TEST=Ran unittests with '--gtest_filter=*MessageLoop*' --v=1; log messages are displayed. Change-Id: I7e28c575f6f9103e7ed1aa90590cc09389134245 Reviewed-on: https://chromium-review.googlesource.com/280567 Tested-by: Alex Deymo <deymo@chromium.org> Reviewed-by: Alex Vakulenko <avakulenko@chromium.org> Reviewed-by: Christopher Wiley <wiley@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org>