X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=direct%2Ftest-framework%2Fbasic-tests%2Fdtest.c;h=420a3dcad2fa051d3169e8350eeaddebab1951b4;hb=d13e6146b4ccadd7aab2033b6cf9f4551d6abd71;hp=a6a8c9d6c10c986d57ba8167f92b36ea68c7e2c5;hpb=ffa781d6427fba6469c60d91482079d5643ca7b7;p=yaffs2.git diff --git a/direct/test-framework/basic-tests/dtest.c b/direct/test-framework/basic-tests/dtest.c index a6a8c9d..420a3dc 100644 --- a/direct/test-framework/basic-tests/dtest.c +++ b/direct/test-framework/basic-tests/dtest.c @@ -3074,7 +3074,7 @@ void large_file_test(const char *mountpt) yaffs_unmount(mountpt); - yaffs_mount_common(mountpt, 0, 1); + yaffs_mount3(mountpt, 0, 1); printf("mounted with no checkpt\n"); dumpDir(mountpt); handle = yaffs_open(fullname, O_RDONLY, 0); @@ -3082,7 +3082,7 @@ void large_file_test(const char *mountpt) yaffs_unmount(mountpt); /* Check resize by adding to the end, resizing back and verifying. */ - yaffs_mount_common(mountpt, 0, 1); + yaffs_mount3(mountpt, 0, 1); printf("checking resize\n"); dumpDir(mountpt); handle = yaffs_open(fullname, O_RDWR, 0); @@ -3300,6 +3300,106 @@ void dir_fd_test(const char *mountpt) } +void create_delete_many_files_test(const char *mountpt) +{ + + char fn[100]; + int i; + int fsize; + char buffer[1000]; + int h; + int wrote; + + + yaffs_start_up(); + yaffs_mount(mountpt); + + for(i = 1; i < 2000; i++) { + sprintf(fn,"%s/f%d",mountpt, i); + fsize = (i%10) * 10000 + 20000; + h = yaffs_open(fn, O_CREAT | O_TRUNC | O_RDWR, 0666); + while (fsize > 0) { + wrote = yaffs_write(h, buffer, sizeof(buffer)); + if (wrote != sizeof(buffer)) { + printf("Writing file %s, only wrote %d bytes\n", fn, wrote); + break; + } + fsize -= wrote; + } + yaffs_unlink(fn); + yaffs_close(h); + } + +} + +void find_device_check(void) +{ + char name[200]; + + yaffs_start_up(); + yaffs_mount("/nand"); + yaffs_mount("/"); + yaffs_mkdir("/nandxxx", 0666); + yaffs_mkdir("/nand/xxx", 0666); +} + + +void try_opendir(const char *str) +{ + yaffs_DIR *d; + + d = yaffs_opendir(str); + + printf("%s --> %p\n", str, d); + + if (d) + yaffs_closedir(d); +} + +void opendir_test(void) +{ + yaffs_start_up(); + yaffs_mount("/nand/"); + yaffs_symlink("x", "/nand/sym"); + yaffs_mkdir("/nand/x",0666); + yaffs_mkdir("/nand/y",0666); + yaffs_mkdir("/nand/x/r",0666); + yaffs_mkdir("/nand/x/s",0666); + yaffs_mkdir("/nand/x/t",0666); + + try_opendir("nand/x/."); + try_opendir("nand/x/r/.."); + try_opendir("nand/x/./"); + try_opendir("nand/x/r/../"); + try_opendir("/nand/x"); + try_opendir("/nand/x/"); + try_opendir("nand/x"); + try_opendir("nand/sym"); + try_opendir("nand/sym/"); + +} + +void try_rmdir(const char *str) +{ + int ret; + + ret= yaffs_rmdir(str); + + printf("rmdir(\"%s\") --> %d, errno %d\n", str, ret, yaffs_get_error()); + +} + +void rmdir_test2(void) +{ + yaffs_start_up(); + + yaffs_mount("/nand/"); + yaffs_mkdir("/nand/z",0666); + try_rmdir("/nand/z"); + yaffs_mkdir("/nand/z",0666); + try_rmdir("/nand/z/"); +} + int random_seed; int simulate_power_failure; @@ -3385,8 +3485,12 @@ int main(int argc, char *argv[]) //dir_fd_test("/nand"); - format_test("/nand"); + //format_test("/nand"); + + //opendir_test(); + rmdir_test2(); + //create_delete_many_files_test("/nand"); return 0; }