Enable test mode updates.
* Uses the GPIO module to deduce whether a current update session needs
to be treated as a controlled test, which allows a few relaxations.
* LibcurlHttpFetcher is extended to relax some of its security lock down
provisions.
* Fix: a test mode flag remains persistent throughout an update attempt,
so that it can be delegated to the various HttpFetcher instances used
in the same attempt.
BUG=chromium-os:25397
TEST=Builds and unittests; automated test script works w/ servo
connected Alex
Change-Id: I8a29d1a21a0632912c10f01f69a26d9c659472fd
Reviewed-on: https://gerrit.chromium.org/gerrit/25128
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Ready: Gilad Arnold <garnold@chromium.org>
diff --git a/main.cc b/main.cc
index 84b6c11..596b04d 100644
--- a/main.cc
+++ b/main.cc
@@ -21,6 +21,7 @@
#include "update_engine/dbus_constants.h"
#include "update_engine/dbus_interface.h"
#include "update_engine/dbus_service.h"
+#include "update_engine/gpio_handler.h"
#include "update_engine/prefs.h"
#include "update_engine/subprocess.h"
#include "update_engine/terminator.h"
@@ -181,13 +182,22 @@
chromeos_update_engine::CertificateChecker::set_openssl_wrapper(
&openssl_wrapper);
+ // Initialize a GPIO handler. Defer GPIO discovery to ensure the udev has
+ // ample time to export the devices. Also require that test mode is physically
+ // queries at most once and the result cached, for a more consistent update
+ // behavior.
+ chromeos_update_engine::StandardUdevInterface udev_iface;
+ chromeos_update_engine::EintrSafeFileDescriptor file_descriptor;
+ chromeos_update_engine::StandardGpioHandler
+ gpio_handler(&udev_iface, &file_descriptor, true, true);
+
// Create the update attempter:
chromeos_update_engine::ConcreteDbusGlib dbus;
chromeos_update_engine::RealSystemState real_system_state;
chromeos_update_engine::UpdateAttempter update_attempter(&prefs,
&metrics_lib,
&dbus,
- NULL,
+ &gpio_handler,
&real_system_state);
// Create the dbus service object:
@@ -201,7 +211,7 @@
// Schedule periodic update checks.
chromeos_update_engine::UpdateCheckScheduler scheduler(&update_attempter,
- NULL,
+ &gpio_handler,
&real_system_state);
scheduler.Run();