summaryrefslogtreecommitdiff
path: root/tests/fs-tests/integrity
diff options
context:
space:
mode:
authorAdrian Hunter <ext-adrian.hunter@nokia.com>2007-10-22 14:06:07 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-06-16 18:02:31 +0300
commit1db3a302e91faedca5fa51330eb80404b8909993 (patch)
treedf2dc64730d1a239427c3a0130c407e89c810b93 /tests/fs-tests/integrity
parenta6ed599706664a0343e0b754213ade4b63665a4d (diff)
fs-tests: make integrity test shrink better
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Diffstat (limited to 'tests/fs-tests/integrity')
-rw-r--r--tests/fs-tests/integrity/integck.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/fs-tests/integrity/integck.c b/tests/fs-tests/integrity/integck.c
index 753a317..3da4bac 100644
--- a/tests/fs-tests/integrity/integck.c
+++ b/tests/fs-tests/integrity/integck.c
@@ -1211,7 +1211,7 @@ static void operate_on_open_file(struct fd_info *fdi)
size_t r;
r = tests_random_no(1000);
- if (shrink && r == 0)
+ if (shrink && r < 5)
file_truncate(fdi->file, fdi->fd);
else if (r < 21)
file_close(fdi);
@@ -1227,6 +1227,17 @@ static void operate_on_an_open_file(void)
size_t r;
struct open_file_info *ofi;
+ /* When shrinking, close all open files 1 time in 128 */
+ if (shrink) {
+ static int x = 0;
+
+ x += 1;
+ x &= 127;
+ if (x == 0) {
+ close_open_files();
+ return;
+ }
+ }
/* Close any open files that have errored */
ofi = open_files;
while (ofi) {