diff options
author | Yi-Yo Chiang <yochiang@google.com> | 2022-08-03 12:56:14 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-08-03 12:56:14 +0000 |
commit | 594289b5a840258ae6a9f312d3239028d14563bc (patch) | |
tree | ca0a0d54b3cb753d4afe5130860b6a34b96aa786 | |
parent | edf4232f5964f7fdb346a51c4d75e4138d63b1b9 (diff) | |
parent | ff9a13dcbfcd31b8b302ffc62bd82682156a86e0 (diff) | |
download | gsid-594289b5a840258ae6a9f312d3239028d14563bc.tar.gz |
DsuGsiIntegrationTest: Verify that storage space are freed after 'wipe' am: ff9a13dcbf
Original change: https://android-review.googlesource.com/c/platform/system/gsid/+/2171502
Change-Id: I65075cfca646e6abb6fd0c2ce43b2b6e6be2f190
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | tests/DsuGsiIntegrationTest.java | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/DsuGsiIntegrationTest.java b/tests/DsuGsiIntegrationTest.java index b5d2b1e..18bafd3 100644 --- a/tests/DsuGsiIntegrationTest.java +++ b/tests/DsuGsiIntegrationTest.java @@ -146,6 +146,7 @@ public class DsuGsiIntegrationTest extends DsuTestBase { CLog.i("Pushing '%s' -> '%s'", mSystemImageZip, DSU_IMAGE_ZIP_PUSH_PATH); getDevice().pushFile(mSystemImageZip, DSU_IMAGE_ZIP_PUSH_PATH); + final long freeSpaceBeforeInstall = getDevice().getPartitionFreeSpace("/data") << 10; assertShellCommand(getDsuInstallCommand()); CLog.i("Wait for DSU installation complete and reboot"); assertTrue( @@ -160,6 +161,16 @@ public class DsuGsiIntegrationTest extends DsuTestBase { CLog.i("Test 'gsi_tool enable -s' and 'gsi_tool enable'"); getDevice().reboot(); assertDsuNotRunning(); + + final long freeSpaceAfterInstall = getDevice().getPartitionFreeSpace("/data") << 10; + final long estimatedDsuSize = freeSpaceBeforeInstall - freeSpaceAfterInstall; + assertTrue( + String.format( + "Expected DSU installation to consume some storage space, free space before" + + " install: %d, free space after install: %d, delta: %d", + freeSpaceBeforeInstall, freeSpaceAfterInstall, estimatedDsuSize), + estimatedDsuSize > 0); + assertShellCommand("gsi_tool enable"); getDevice().reboot(); assertDsuRunning(); @@ -200,9 +211,22 @@ public class DsuGsiIntegrationTest extends DsuTestBase { assertDsuRunning(); assertDevicePathNotExist(REMOUNT_TEST_PATH); - CLog.i("Testing is done, clean up the device"); + CLog.i("Test 'gsi_tool wipe'"); assertShellCommand("gsi_tool wipe"); getDevice().reboot(); assertDsuNotRunning(); + + final double dampeningCoefficient = 0.9; + final long freeSpaceAfterWipe = getDevice().getPartitionFreeSpace("/data") << 10; + final long freeSpaceReturnedByWipe = freeSpaceAfterWipe - freeSpaceAfterInstall; + assertTrue( + String.format( + "Expected 'gsi_tool wipe' to return roughly %d of storage space, free space" + + " before wipe: %d, free space after wipe: %d, delta: %d", + estimatedDsuSize, + freeSpaceAfterInstall, + freeSpaceAfterWipe, + freeSpaceReturnedByWipe), + freeSpaceReturnedByWipe > (long) (estimatedDsuSize * dampeningCoefficient)); } } |