X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blobdiff_plain;f=direct%2Fdtest.c;h=66b8db1d43f8fde54da682c4fc7c4212d51f596b;hp=8ccadbb4920dad78dd18b3ac08842114f8e3db83;hb=170ea32c52fd2d9b7cbda9b169ad44038b1d15cf;hpb=3c86d69aed35d33bd7b348fbbf9810419395eacc diff --git a/direct/dtest.c b/direct/dtest.c index 8ccadbb..66b8db1 100644 --- a/direct/dtest.c +++ b/direct/dtest.c @@ -1,3 +1,17 @@ +/* + * YAFFS: Yet Another Flash File System. A NAND-flash specific file system. + * + * Copyright (C) 2002-2007 Aleph One Ltd. + * for Toby Churchill Ltd and Brightstar Engineering + * + * Created by Charles Manning + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + /* * Test code for the "direct" interface. */ @@ -1866,6 +1880,68 @@ void small_mount_test(const char *mountpt,int nmounts) } +int early_exit; + +void small_overwrite_test(const char *mountpt,int nmounts) +{ + + char a[30]; + char b[30]; + char c[30]; + + int i; + int j; + + int h0; + int h1; + int len0; + int len1; + int nread; + + sprintf(a,"%s/a",mountpt); + + yaffs_StartUp(); + + + + for(i = 0; i < nmounts; i++){ + + static char xx[8000]; + + printf("############### Iteration %d Start\n",i); + if(1) + yaffs_mount(mountpt); + + dump_directory_tree(mountpt); + + yaffs_mkdir(a,0); + + sprintf(xx,"%s/0",a); + h0 = yaffs_open(xx, O_RDWR | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE); + sprintf(xx,"%s/1",a); + h1 = yaffs_open(xx, O_RDWR | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE); + + for(j = 0; j < 1000000; j+=1000){ + yaffs_truncate(h0,j); + yaffs_lseek(h0,j,SEEK_SET); + yaffs_write(h0,xx,7000); + yaffs_write(h1,xx,7000); + + if(early_exit) + exit(0); + } + + yaffs_close(h0); + + printf("########### %d\n",i); + dump_directory_tree(mountpt); + + if(1) + yaffs_unmount(mountpt); + } +} + + void yaffs_touch(const char *fn) { yaffs_chmod(fn, S_IREAD | S_IWRITE); @@ -2071,7 +2147,8 @@ int main(int argc, char *argv[]) //scan_pattern_test("/flash",10000,10); //short_scan_test("/flash/flash",40000,200); - small_mount_test("/flash/flash",1000); + //small_mount_test("/flash/flash",1000); + small_overwrite_test("/flash/flash",1000); //checkpoint_fill_test("/flash/flash",20); //checkpoint_upgrade_test("/flash/flash",20); // huge_array_test("/flash/flash",10);