summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYi-Yo Chiang <yochiang@google.com>2022-08-03 14:01:44 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-08-03 14:01:44 +0000
commit8a6b9bf2bd20a32dba833e44dcf3902c8abc29bc (patch)
treeca0a0d54b3cb753d4afe5130860b6a34b96aa786
parent43c372993d2c8f63571504c03ac1990db8473c7c (diff)
parent269346a786e492b61bf289c2f5e8341c6da54e6e (diff)
downloadgsid-8a6b9bf2bd20a32dba833e44dcf3902c8abc29bc.tar.gz
DsuGsiIntegrationTest: Verify that storage space are freed after 'wipe' am: ff9a13dcbf am: 594289b5a8 am: 752d85df28 am: 269346a786
Original change: https://android-review.googlesource.com/c/platform/system/gsid/+/2171502 Change-Id: I14e2e5c64aad9ab8959c61a70cf05db4fc10fb5d Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--tests/DsuGsiIntegrationTest.java26
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));
}
}