diff options
author | Betty Zhou <bettyzhou@google.com> | 2022-01-26 10:02:04 -0800 |
---|---|---|
committer | Betty Zhou <bettyzhou@google.com> | 2022-01-26 18:55:15 +0000 |
commit | 20234f041e66605c420272eb2ac958b8d8e01edf (patch) | |
tree | 4d5165c4ec70f927a741107a0033bb5617a081ca | |
parent | d4ef1ab769417badc4f1dc32e7bc41f0f7276ca4 (diff) | |
download | tradefederation-20234f041e66605c420272eb2ac958b8d8e01edf.tar.gz |
Move fastboot -w before fastboot erase system in GsiDeviceFlashPreparer.
Test: unit tests and GSI device flash tests.
Bug: 206157999
Change-Id: I9930a5b14e634826988a715e072fbc37fdeef378
-rw-r--r-- | javatests/com/android/tradefed/targetprep/GsiDeviceFlashPreparerTest.java | 15 | ||||
-rw-r--r-- | src/com/android/tradefed/targetprep/GsiDeviceFlashPreparer.java | 2 |
2 files changed, 9 insertions, 8 deletions
diff --git a/javatests/com/android/tradefed/targetprep/GsiDeviceFlashPreparerTest.java b/javatests/com/android/tradefed/targetprep/GsiDeviceFlashPreparerTest.java index 1ec672ed0..f3aff70bd 100644 --- a/javatests/com/android/tradefed/targetprep/GsiDeviceFlashPreparerTest.java +++ b/javatests/com/android/tradefed/targetprep/GsiDeviceFlashPreparerTest.java @@ -195,12 +195,12 @@ public class GsiDeviceFlashPreparerTest { doGetSlotExpectation(); when(mMockDevice.executeLongFastbootCommand("delete-logical-partition", "product_a")) .thenReturn(mSuccessResult); + when(mMockDevice.executeLongFastbootCommand("-w")).thenReturn(mSuccessResult); when(mMockDevice.executeLongFastbootCommand("erase", "system_a")) .thenReturn(mSuccessResult); when(mMockDevice.executeLongFastbootCommand( "flash", "system", mBuildInfo.getFile("gsi_system.img").getAbsolutePath())) .thenReturn(mSuccessResult); - when(mMockDevice.executeLongFastbootCommand("-w")).thenReturn(mSuccessResult); doSetupExpectations(); @@ -237,12 +237,12 @@ public class GsiDeviceFlashPreparerTest { doGetSlotExpectation(); when(mMockDevice.executeLongFastbootCommand("delete-logical-partition", "product_a")) .thenReturn(mSuccessResult); + when(mMockDevice.executeLongFastbootCommand("-w")).thenReturn(mSuccessResult); when(mMockDevice.executeLongFastbootCommand("erase", "system_a")) .thenReturn(mSuccessResult); when(mMockDevice.executeLongFastbootCommand( "flash", "system", mBuildInfo.getFile("gsi_system.img").getAbsolutePath())) .thenReturn(mSuccessResult); - when(mMockDevice.executeLongFastbootCommand("-w")).thenReturn(mSuccessResult); doSetupExpectations(); @@ -281,12 +281,12 @@ public class GsiDeviceFlashPreparerTest { doGetSlotExpectation(); when(mMockDevice.executeLongFastbootCommand("delete-logical-partition", "product_a")) .thenReturn(mSuccessResult); + when(mMockDevice.executeLongFastbootCommand("-w")).thenReturn(mSuccessResult); when(mMockDevice.executeLongFastbootCommand("erase", "system_a")) .thenReturn(mSuccessResult); when(mMockDevice.executeLongFastbootCommand( Mockito.eq("flash"), Mockito.eq("system"), Mockito.matches(".*system.img"))) .thenReturn(mSuccessResult); - when(mMockDevice.executeLongFastbootCommand("-w")).thenReturn(mSuccessResult); doSetupExpectations(); @@ -326,12 +326,12 @@ public class GsiDeviceFlashPreparerTest { doGetSlotExpectation(); when(mMockDevice.executeLongFastbootCommand("delete-logical-partition", "product_a")) .thenReturn(mSuccessResult); + when(mMockDevice.executeLongFastbootCommand("-w")).thenReturn(mSuccessResult); when(mMockDevice.executeLongFastbootCommand("erase", "system_a")) .thenReturn(mSuccessResult); when(mMockDevice.executeLongFastbootCommand( "flash", "system", mBuildInfo.getFile("gsi_system.img").getAbsolutePath())) .thenReturn(mSuccessResult); - when(mMockDevice.executeLongFastbootCommand("-w")).thenReturn(mSuccessResult); when(mMockDevice.executeLongFastbootCommand( "flash", "boot", mBuildInfo.getFile("gki_boot.img").getAbsolutePath())) @@ -379,6 +379,7 @@ public class GsiDeviceFlashPreparerTest { doGetSlotExpectation(); when(mMockDevice.executeLongFastbootCommand("delete-logical-partition", "product_a")) .thenReturn(mSuccessResult); + when(mMockDevice.executeLongFastbootCommand("-w")).thenReturn(mSuccessResult); when(mMockDevice.executeLongFastbootCommand("erase", "system_a")) .thenReturn(mSuccessResult); when(mMockDevice.executeLongFastbootCommand( @@ -386,7 +387,6 @@ public class GsiDeviceFlashPreparerTest { Mockito.eq("system"), Mockito.matches(".*/system.img"))) .thenReturn(mSuccessResult); - when(mMockDevice.executeLongFastbootCommand("-w")).thenReturn(mSuccessResult); when(mMockDevice.executeLongFastbootCommand( Mockito.eq("flash"), @@ -428,11 +428,11 @@ public class GsiDeviceFlashPreparerTest { mBuildInfo.getFile("gsi_vbmeta.img").getAbsolutePath())) .thenReturn(mSuccessResult); doGetEmptySlotExpectation(); + when(mMockDevice.executeLongFastbootCommand("-w")).thenReturn(mSuccessResult); when(mMockDevice.executeLongFastbootCommand("erase", "system")).thenReturn(mSuccessResult); when(mMockDevice.executeLongFastbootCommand( "flash", "system", mBuildInfo.getFile("gsi_system.img").getAbsolutePath())) .thenReturn(mSuccessResult); - when(mMockDevice.executeLongFastbootCommand("-w")).thenReturn(mSuccessResult); doSetupExpectations(); @@ -468,6 +468,7 @@ public class GsiDeviceFlashPreparerTest { doGetSlotExpectation(); when(mMockDevice.executeLongFastbootCommand("delete-logical-partition", "product_a")) .thenReturn(mSuccessResult); + when(mMockDevice.executeLongFastbootCommand("-w")).thenReturn(mSuccessResult); when(mMockDevice.executeLongFastbootCommand("erase", "system_a")) .thenReturn(mSuccessResult); when(mMockDevice.executeLongFastbootCommand( @@ -511,12 +512,12 @@ public class GsiDeviceFlashPreparerTest { when(mMockDevice.executeLongFastbootCommand("delete-logical-partition", "product_a")) .thenReturn(mSuccessResult); + when(mMockDevice.executeLongFastbootCommand("-w")).thenReturn(mSuccessResult); when(mMockDevice.executeLongFastbootCommand("erase", "system_a")) .thenReturn(mSuccessResult); when(mMockDevice.executeLongFastbootCommand( "flash", "system", mBuildInfo.getFile("gsi_system.img").getAbsolutePath())) .thenReturn(mSuccessResult); - when(mMockDevice.executeLongFastbootCommand("-w")).thenReturn(mSuccessResult); doThrow(new DeviceNotAvailableException("test", "serial")) .when(mMockDevice) diff --git a/src/com/android/tradefed/targetprep/GsiDeviceFlashPreparer.java b/src/com/android/tradefed/targetprep/GsiDeviceFlashPreparer.java index 609758b7e..75c8824c1 100644 --- a/src/com/android/tradefed/targetprep/GsiDeviceFlashPreparer.java +++ b/src/com/android/tradefed/targetprep/GsiDeviceFlashPreparer.java @@ -224,9 +224,9 @@ public class GsiDeviceFlashPreparer extends BaseTargetPreparer { "delete-logical-partition", "product" + currSlot); } } + executeFastbootCmd(device, "-w"); executeFastbootCmd(device, "erase", "system" + currSlot); executeFastbootCmd(device, "flash", "system", mSystemImg.getAbsolutePath()); - executeFastbootCmd(device, "-w"); } if (mBootImg != null) { device.rebootIntoBootloader(); |