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 <[email protected]>
Commit-Queue: Chris Sosa <[email protected]>
Reviewed-by: Chris Sosa <[email protected]>
diff --git a/omaha_request_params_unittest.cc b/omaha_request_params_unittest.cc
index 31ccd66..c12abcb 100644
--- a/omaha_request_params_unittest.cc
+++ b/omaha_request_params_unittest.cc
@@ -8,6 +8,7 @@
#include "base/file_util.h"
#include "gtest/gtest.h"
+#include "update_engine/constants.h"
#include "update_engine/install_plan.h"
#include "update_engine/mock_system_state.h"
#include "update_engine/omaha_request_params.h"
@@ -31,7 +32,7 @@
virtual void SetUp() {
ASSERT_EQ(0, System(string("mkdir -p ") + kTestDir + "/etc"));
ASSERT_EQ(0, System(string("mkdir -p ") + kTestDir +
- utils::kStatefulPartition + "/etc"));
+ kStatefulPartition + "/etc"));
// Create a fresh copy of the params for each test, so there's no
// unintended reuse of state across tests.
MockSystemState mock_system_state;
@@ -258,7 +259,7 @@
"CHROMEOS_RELEASE_TRACK=dev-channel\n"
"CHROMEOS_AUSERVER=http://www.google.com"));
ASSERT_TRUE(WriteFileString(
- kTestDir + utils::kStatefulPartition + "/etc/lsb-release",
+ kTestDir + kStatefulPartition + "/etc/lsb-release",
"CHROMEOS_RELEASE_BOARD=x86-generic\n"
"CHROMEOS_RELEASE_TRACK=beta-channel\n"
"CHROMEOS_AUSERVER=https://www.google.com"));
@@ -286,7 +287,7 @@
"CHROMEOS_RELEASE_TRACK=dev-channel\n"
"CHROMEOS_AUSERVER=https://www.google.com"));
ASSERT_TRUE(WriteFileString(
- kTestDir + utils::kStatefulPartition + "/etc/lsb-release",
+ kTestDir + kStatefulPartition + "/etc/lsb-release",
"CHROMEOS_RELEASE_BOARD=x86-generic\n"
"CHROMEOS_RELEASE_TRACK=stable-channel\n"
"CHROMEOS_AUSERVER=http://www.google.com"));
@@ -312,7 +313,7 @@
"CHROMEOS_RELEASE_TRACK=dev-channel\n"
"CHROMEOS_AUSERVER=http://www.google.com"));
ASSERT_TRUE(WriteFileString(
- kTestDir + utils::kStatefulPartition + "/etc/lsb-release",
+ kTestDir + kStatefulPartition + "/etc/lsb-release",
"CHROMEOS_RELEASE_BOARD=x86-generic\n"
"CHROMEOS_RELEASE_TRACK=dev-channel"));
MockSystemState mock_system_state;
@@ -474,7 +475,7 @@
// Set a different channel in stateful LSB release.
ASSERT_TRUE(WriteFileString(
- kTestDir + utils::kStatefulPartition + "/etc/lsb-release",
+ kTestDir + kStatefulPartition + "/etc/lsb-release",
"CHROMEOS_RELEASE_TRACK=stable-channel\n"
"CHROMEOS_IS_POWERWASH_ALLOWED=true\n"));
@@ -518,7 +519,7 @@
"CHROMEOS_RELEASE_TRACK=canary-channel\n"
"CHROMEOS_AUSERVER=http://www.google.com"));
ASSERT_TRUE(WriteFileString(
- kTestDir + utils::kStatefulPartition + "/etc/lsb-release",
+ kTestDir + kStatefulPartition + "/etc/lsb-release",
"CHROMEOS_RELEASE_BOARD=x86-generic\n"
"CHROMEOS_RELEASE_TRACK=stable-channel\n"
"CHROMEOS_AUSERVER=https://www.google.com"));