Move cache code to own file
[yaffs2.git] / direct / test-framework / basic-tests / dtest.c
index 863925e0c7a88f3ff66b11a701dd551800f9c9f4..8b58762351bd4fa86938cdeea7a65f7216952a71 100644 (file)
@@ -1,8 +1,7 @@
 /*
  * YAFFS: Yet another FFS. A NAND-flash specific file system.
  *
- * Copyright (C) 2002-2011 Aleph One Ltd.
- *   for Toby Churchill Ltd and Brightstar Engineering
+ * Copyright (C) 2002-2018 Aleph One Ltd.
  *
  * Created by Charles Manning <charles@aleph1.co.uk>
  *
@@ -520,7 +519,7 @@ void dumpDirFollow(const char *dname)
        yaffs_DIR *d;
        struct yaffs_dirent *de;
        struct yaffs_stat s;
-       char str[100];
+       char str[300];
 
        d = yaffs_opendir(dname);
 
@@ -971,7 +970,7 @@ int huge_directory_test_on_path(char *path)
        int total = 0;
        int lastTotal = 0;
 
-       char str[100];
+       char str[300];
 
 
        yaffs_start_up();
@@ -3407,11 +3406,33 @@ void rmdir_test2(void)
        try_rmdir("/nand/z/");
 }
 
+
+void dump_yaffs_malloc_usage(void)
+{
+       unsigned current;
+       unsigned high_water;
+
+       yaffsfs_get_malloc_values(&current, &high_water);
+
+       printf("\n"
+              "***************************************\n"
+              "Dump of yaffs malloc usage during run\n"
+              "Currently allocated : %u bytes\n"
+              "High water allocated : %u bytes\n"
+              "Note, this is not accurate on all platforms\n",
+               current, high_water);
+
+}
+
+
 int random_seed;
 int simulate_power_failure;
 
 int main(int argc, char *argv[])
 {
+
+       atexit(dump_yaffs_malloc_usage);
+
        (void) argc;
        (void) argv;
 
@@ -3455,7 +3476,7 @@ int main(int argc, char *argv[])
        //long_test_on_path("/ram2k");
        // long_test_on_path("/flash");
        //simple_rw_test("/flash/flash");
-       //fill_disk_test("/flash/flash");
+       //fill_disk_test("/nand");
        // rename_over_test("/flash");
        //lookup_test("/flash");
        //freespace_test("/flash/flash");