Commit 0ec4e032 authored by Zach Kirschenbaum's avatar Zach Kirschenbaum Committed by Chromium LUCI CQ

Revert "[fuchsia] handle RetrySystemUpdate reboot reason"

This reverts commit 394a78b4.

Reason for revert: this breaks something

Original change's description:
> [fuchsia] handle RetrySystemUpdate reboot reason
>
> In this change, we add support for RetrySystemUpdate. Also, we stop
> mapping `RebootSource::OTA` to `StateControlRebootReason::SystemUpdate`
> because reboots for system updates should only be called from
> fuchsia.git -- the code we remove isn't being run anyway.
>
> BUG=fuchsia:64591
> TEST=cast_reboot_unittests
>
> Change-Id: Ic15f86d31d3985d2fa5a2a3957c5ca61066cd476
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2600053
> Reviewed-by: Sergey Volk <servolk@chromium.org>
> Commit-Queue: Zach Kirschenbaum <zkbaum@google.com>
> Cr-Commit-Position: refs/heads/master@{#838871}

TBR=spang@chromium.org,servolk@chromium.org,chromium-scoped@luci-project-accounts.iam.gserviceaccount.com,zkbaum@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: fuchsia:64591
Change-Id: I9a2dd0fe105b1750c733925a8320a2f4e71cded2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2611448Reviewed-by: default avatarSergey Volk <servolk@chromium.org>
Commit-Queue: Zach Kirschenbaum <zkbaum@google.com>
Cr-Commit-Position: refs/heads/master@{#840361}
parent c91496b9
...@@ -91,10 +91,8 @@ bool RebootShlib::RebootNow(RebootSource reboot_source) { ...@@ -91,10 +91,8 @@ bool RebootShlib::RebootNow(RebootSource reboot_source) {
reason = StateControlRebootReason::USER_REQUEST; reason = StateControlRebootReason::USER_REQUEST;
break; break;
case RebootSource::OTA: case RebootSource::OTA:
// We are only expecting OTAs initiated by the platform via the reason = StateControlRebootReason::SYSTEM_UPDATE;
// fuchsia.hardware.power.statecontrol/Admin FIDL service. break;
NOTREACHED();
return false;
case RebootSource::OVERHEAT: case RebootSource::OVERHEAT:
reason = StateControlRebootReason::HIGH_TEMPERATURE; reason = StateControlRebootReason::HIGH_TEMPERATURE;
break; break;
...@@ -177,7 +175,6 @@ RebootShlib::RebootSource RebootUtil::GetLastRebootSource() { ...@@ -177,7 +175,6 @@ RebootShlib::RebootSource RebootUtil::GetLastRebootSource() {
case RebootReason::USER_REQUEST: case RebootReason::USER_REQUEST:
return RebootShlib::RebootSource::API; return RebootShlib::RebootSource::API;
case RebootReason::SYSTEM_UPDATE: case RebootReason::SYSTEM_UPDATE:
case RebootReason::RETRY_SYSTEM_UPDATE:
return RebootShlib::RebootSource::OTA; return RebootShlib::RebootSource::OTA;
case RebootReason::HIGH_TEMPERATURE: case RebootReason::HIGH_TEMPERATURE:
return RebootShlib::RebootSource::OVERHEAT; return RebootShlib::RebootSource::OVERHEAT;
......
...@@ -66,6 +66,8 @@ const RebootReasonParam kRebootReasonParams[] = { ...@@ -66,6 +66,8 @@ const RebootReasonParam kRebootReasonParams[] = {
// Graceful reboot reasons. // Graceful reboot reasons.
{RebootReason::USER_REQUEST, RebootShlib::RebootSource::API, true, {RebootReason::USER_REQUEST, RebootShlib::RebootSource::API, true,
StateControlRebootReason::USER_REQUEST}, StateControlRebootReason::USER_REQUEST},
{RebootReason::SYSTEM_UPDATE, RebootShlib::RebootSource::OTA, true,
StateControlRebootReason::SYSTEM_UPDATE},
{RebootReason::HIGH_TEMPERATURE, RebootShlib::RebootSource::OVERHEAT, true, {RebootReason::HIGH_TEMPERATURE, RebootShlib::RebootSource::OVERHEAT, true,
StateControlRebootReason::HIGH_TEMPERATURE}, StateControlRebootReason::HIGH_TEMPERATURE},
{RebootReason::SESSION_FAILURE, RebootShlib::RebootSource::SW_OTHER, true}, {RebootReason::SESSION_FAILURE, RebootShlib::RebootSource::SW_OTHER, true},
...@@ -234,33 +236,6 @@ TEST_F(RebootFuchsiaTest, GetLastRebootSourceWithoutGranularReason) { ...@@ -234,33 +236,6 @@ TEST_F(RebootFuchsiaTest, GetLastRebootSourceWithoutGranularReason) {
Eq(RebootShlib::RebootSource::SW_OTHER)); Eq(RebootShlib::RebootSource::SW_OTHER));
} }
TEST_F(RebootFuchsiaTest, RebootSourceOtaNotSupported) {
EXPECT_DEATH(RebootShlib::RebootNow(RebootShlib::RebootSource::OTA), "");
}
fuchsia::feedback::LastReboot GenerateLastReboot(bool graceful,
RebootReason reason) {
fuchsia::feedback::LastReboot last_reboot;
last_reboot.set_graceful(graceful);
last_reboot.set_reason(reason);
return last_reboot;
}
// SystemUpdate-related reasons must be handled separately. Otherwise, they will
// fail RebootNowSendsFidlRebootReason because RebootNow panics when given
// RebootShlib::RebootSource::OTA.
TEST_F(RebootFuchsiaTest, RebootReasonSystemUpdate) {
SetLastReboot(GenerateLastReboot(true, RebootReason::SYSTEM_UPDATE));
EXPECT_THAT(RebootUtil::GetLastRebootSource(),
Eq(RebootShlib::RebootSource::OTA));
}
TEST_F(RebootFuchsiaTest, RebootReasonRetrySystemUpdate) {
SetLastReboot(GenerateLastReboot(true, RebootReason::RETRY_SYSTEM_UPDATE));
EXPECT_THAT(RebootUtil::GetLastRebootSource(),
Eq(RebootShlib::RebootSource::OTA));
}
class RebootFuchsiaParamTest : public RebootFuchsiaTest, class RebootFuchsiaParamTest : public RebootFuchsiaTest,
public ::testing::WithParamInterface<RebootReasonParam> { public ::testing::WithParamInterface<RebootReasonParam> {
public: public:
...@@ -274,7 +249,12 @@ TEST_P(RebootFuchsiaParamTest, RebootNowSendsFidlRebootReason) { ...@@ -274,7 +249,12 @@ TEST_P(RebootFuchsiaParamTest, RebootNowSendsFidlRebootReason) {
} }
TEST_P(RebootFuchsiaParamTest, GetLastRebootSourceTranslatesReasonFromFuchsia) { TEST_P(RebootFuchsiaParamTest, GetLastRebootSourceTranslatesReasonFromFuchsia) {
SetLastReboot(GenerateLastReboot(GetParam().graceful, GetParam().reason)); fuchsia::feedback::LastReboot last_reboot;
last_reboot.set_graceful(GetParam().graceful);
last_reboot.set_reason(GetParam().reason);
EXPECT_TRUE(last_reboot.has_graceful());
EXPECT_TRUE(last_reboot.has_reason());
SetLastReboot(std::move(last_reboot));
EXPECT_THAT(RebootUtil::GetLastRebootSource(), Eq(GetParam().source)); EXPECT_THAT(RebootUtil::GetLastRebootSource(), Eq(GetParam().source));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment