From bcab240cbc44f6519f4617506a7b183cc19c7160 Mon Sep 17 00:00:00 2001 From: Hridya Valsaraju Date: Fri, 15 Mar 2019 20:46:59 -0700 Subject: [PATCH] Fuzzy_fastboot must set back the original slot after test Test: ./fuzzy_fastboot --gtest_filter=Conformance.SetActive Bug: 117220134 Change-Id: I1fb6975dda52ace3e6d2a81a50cba5ff55310818 --- fastboot/fuzzy_fastboot/fixtures.cpp | 5 +++++ fastboot/fuzzy_fastboot/fixtures.h | 1 + 2 files changed, 6 insertions(+) diff --git a/fastboot/fuzzy_fastboot/fixtures.cpp b/fastboot/fuzzy_fastboot/fixtures.cpp index 280cfb691..2da452d25 100644 --- a/fastboot/fuzzy_fastboot/fixtures.cpp +++ b/fastboot/fuzzy_fastboot/fixtures.cpp @@ -128,10 +128,14 @@ void FastBootTest::SetUp() { ASSERT_EQ(device_path, cb_scratch); // The path can not change } fb = std::unique_ptr(new FastBootDriver(transport.get(), {}, true)); + // No error checking since non-A/B devices may not support the command + fb->GetVar("current-slot", &initial_slot); } void FastBootTest::TearDown() { EXPECT_TRUE(UsbStillAvailible()) << USB_PORT_GONE; + // No error checking since non-A/B devices may not support the command + fb->SetActive(initial_slot); TearDownSerial(); @@ -227,6 +231,7 @@ void FastBootTest::SetLockState(bool unlock, bool assert_change) { std::string FastBootTest::device_path = ""; std::string FastBootTest::cb_scratch = ""; +std::string FastBootTest::initial_slot = ""; int FastBootTest::serial_port = 0; template diff --git a/fastboot/fuzzy_fastboot/fixtures.h b/fastboot/fuzzy_fastboot/fixtures.h index e0f829e48..1f73d2d58 100644 --- a/fastboot/fuzzy_fastboot/fixtures.h +++ b/fastboot/fuzzy_fastboot/fixtures.h @@ -69,6 +69,7 @@ class FastBootTest : public testing::Test { // This is an annoying hack static std::string cb_scratch; static std::string device_path; + static std::string initial_slot; }; template