2 * YAFFS: Yet another FFS. A NAND-flash specific file system.
4 * Copyright (C) 2002 Aleph One Ltd.
5 * for Toby Churchill Ltd and Brightstar Engineering
7 * Created by Charles Manning <charles@aleph1.co.uk>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
26 #include "nor_stress.h"
27 #include "yaffs_fsx.h"
29 void (*ext_fatal)(void);
33 int simulate_power_failure = 0;
41 extern int ops_multiplier;
43 char mount_point[200];
47 printf("Usage: yaffs_test [options] mountpoint\n");
49 printf(" f: do fsx testing\n");
50 printf(" i: initialise for upgrade testing\n");
51 printf(" l: multiply number of operations by 5\n");
52 printf(" n nnn: number of cycles\n");
53 printf(" p: simulate power fail testing\n");
54 printf(" s sss: set seed\n");
55 printf(" u: do upgrade test\n");
61 printf("fatal yaffs test pid %d sleeping\n",getpid());
67 void bad_ptr_handler(int sig)
69 printf("signal %d received\n",sig);
72 int main(int argc, char **argv)
76 ext_fatal = test_fatal;
77 signal(SIGSEGV,bad_ptr_handler);
78 signal(SIGBUS,bad_ptr_handler);
79 signal(SIGABRT,bad_ptr_handler);
81 while ((ch = getopt(argc,argv, "filn:ps:u"))
85 random_seed = atoi(optarg);
88 simulate_power_failure =1;
103 n_cycles = atoi(optarg);
113 strcpy(mount_point,argv[0]);
115 if(simulate_power_failure)
117 printf("Running test %s %s %s %s seed %d cycles %d\n",
118 do_upgrade ? "fw_upgrade" : "",
119 init_test ? "initialise":"",
121 simulate_power_failure ? "power_fail" : "",
122 random_seed, n_cycles);
125 yaffs_mount(mount_point);
126 printf("Mount complete\n");
128 if(do_upgrade && init_test){
129 simulate_power_failure = 0;
130 NorStressTestInitialise(mount_point);
131 } else if(do_upgrade){
132 printf("Running stress on %s with seed %d\n",mount_point,random_seed);
133 NorStressTestRun(mount_point,n_cycles,do_fsx);
135 yaffs_fsx_main(mount_point,n_cycles);
137 printf("No test to run!\n");
140 yaffs_unmount(mount_point);
142 printf("Test run completed!\n");