04e3b2ae40e93e1fbf5f489dbe8542be49316719
[yaffs2.git] / direct / yaffs_test.c
1 /*
2  * YAFFS: Yet another FFS. A NAND-flash specific file system. 
3  *
4  * Copyright (C) 2002 Aleph One Ltd.
5  *   for Toby Churchill Ltd and Brightstar Engineering
6  *
7  * Created by Charles Manning <charles@aleph1.co.uk>
8  *
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.
12  *
13  */
14
15
16
17
18 #include <stdio.h>
19 #include <string.h>
20 #include <unistd.h>
21 #include <fcntl.h>
22
23 #include "yaffsfs.h"
24
25 #include "nor_stress.h"
26
27
28
29 int random_seed;
30
31 void BadUsage(void)
32 {
33         printf("usage root_dir test_id seed \n");
34         printf(" test_id: fw_update fw_update_init\n");
35         exit(2);
36 }
37 int main(int argc, const char *argv[])
38 {
39         yaffs_StartUp();
40         if(argc == 4) {
41                 random_seed = atoi(argv[3]);
42                 if(random_seed <= 0)
43                         BadUsage();
44                         
45                 if(!strcmp(argv[2],"fw_update_init")){
46                         NorStressTestInitialise(argv[1]);
47                 }
48                 else if(!strcmp(argv[2],"fw_update")){
49                         printf("Running stress on %s with seed %d\n",argv[1],random_seed);
50                         NorStressTestRun(argv[1]);
51                 }
52                 else 
53                         BadUsage();
54         }
55         else
56                 BadUsage();
57         return 0;
58 }