From 9b883d3c3ec0ff93bbea776572afb54d2a9b3524 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 14 Mar 2014 09:15:49 +0000 Subject: [PATCH] tests/discard: Ensure a significant number of blocks are freed up on the host. It's reasonable to expect megabytes will be freed up and given back to the host. Previously we just tested that at least 1 block was released. This test checks that at least 1000 blocks are released (since stat(2) returns blocks of 512 bytes: 512 bytes * 1000 = approx 0.5 MB). --- tests/discard/test-blkdiscard.pl | 2 +- tests/discard/test-discard.pl | 2 +- tests/discard/test-fstrim.pl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/discard/test-blkdiscard.pl b/tests/discard/test-blkdiscard.pl index 77b72b9f6..e080350d7 100755 --- a/tests/discard/test-blkdiscard.pl +++ b/tests/discard/test-blkdiscard.pl @@ -114,4 +114,4 @@ my $trimmed_size = (stat ($disk))[12]; print "trimmed size:\t$trimmed_size (blocks)\n"; die "$0: looks like the blkdiscard operation did not work\n" - if $trimmed_size >= $full_size; + if $full_size - $trimmed_size < 1000; diff --git a/tests/discard/test-discard.pl b/tests/discard/test-discard.pl index 3f350b3a1..5e2f879c0 100755 --- a/tests/discard/test-discard.pl +++ b/tests/discard/test-discard.pl @@ -114,4 +114,4 @@ print "trimmed size:\t$trimmed_size (blocks)\n"; #system "du -sh $disk"; die "$0: looks like the -o discard mount option did not work\n" - if $trimmed_size >= $full_size; + if $full_size - $trimmed_size < 1000; diff --git a/tests/discard/test-fstrim.pl b/tests/discard/test-fstrim.pl index 54451b8e2..30bb855b3 100755 --- a/tests/discard/test-fstrim.pl +++ b/tests/discard/test-fstrim.pl @@ -122,4 +122,4 @@ print "trimmed size:\t$trimmed_size (blocks)\n"; #system "du -sh $disk"; die "$0: looks like the fstrim operation did not work\n" - if $trimmed_size >= $full_size; + if $full_size - $trimmed_size < 1000;