update_engine: Providing testing capability for periodic update checks
Currently, we are not able to properly test periodic update checks
because these update checks are disabled on test images. To solve this
problem this CL introduces a new pref test-update-check-interval-timeout
that contains the number of seconds between periodic update checks. The
tests can put this file in /var/lib/update_engine/prefs and restart the
update_engine. The update_engine should start checking for update after
the number of seconds identified in the above pref and continue checking
for update with that interval. The tests also need to make sure this
file is deleted at the end so it doesn't interfere with future device
updates. This pref internally is deleted after it has been read/used 3
times so it can't be abused. For the same reason, the maximum value that
can be set in the pref is limited to 10 minutes.
BUG=chromium:953471
TEST=FEATURES=test emerge-reef update_engine
TEST=flashed a device with this new image, put the pref with value of 10
seconds and restarted the update_engine, the update check happened.
Change-Id: I3ad0e300f7908f17da26b0eb0d1510348a2d2435
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2333308
Commit-Queue: Amin Hassani <ahassani@chromium.org>
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
Reviewed-by: Andrew Lassalle <andrewlassalle@chromium.org>
diff --git a/common/constants.cc b/common/constants.cc
index ac652ea..ad511d5 100644
--- a/common/constants.cc
+++ b/common/constants.cc
@@ -64,6 +64,8 @@
const char kPrefsP2PFirstAttemptTimestamp[] = "p2p-first-attempt-timestamp";
const char kPrefsP2PNumAttempts[] = "p2p-num-attempts";
const char kPrefsPayloadAttemptNumber[] = "payload-attempt-number";
+const char kPrefsTestUpdateCheckIntervalTimeout[] =
+ "test-update-check-interval-timeout";
// Keep |kPrefsPingActive| in sync with |kDlcMetadataFilePingActive| in
// dlcservice.
const char kPrefsPingActive[] = "active";