Mercurial > yaffs-ecoscentric-gpl
annotate direct/dtest.c @ 339:50d5730d01a5
Add handle tests
| author | charles <charles> |
|---|---|
| date | Wed, 06 Jan 2010 03:56:46 +0000 |
| parents | bd02b2533ec8 |
| children | 7ee0cc4ba753 |
| rev | line source |
|---|---|
| 167 | 1 /* |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2 * YAFFS: Yet another FFS. A NAND-flash specific file system. |
| 167 | 3 * |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
4 * Copyright (C) 2002 Aleph One Ltd. |
| 167 | 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. | |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
12 * |
| 167 | 13 */ |
| 14 | |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
15 |
| 1 | 16 |
| 17 | |
| 18 #include <stdio.h> | |
| 19 #include <string.h> | |
| 20 #include <unistd.h> | |
| 21 #include <fcntl.h> | |
| 22 | |
| 23 #include "yaffsfs.h" | |
| 24 | |
| 224 | 25 |
| 1 | 26 void dumpDir(const char *dname); |
| 27 | |
| 28 char xx[600]; | |
| 29 | |
| 30 void copy_in_a_file(char *yaffsName,char *inName) | |
| 31 { | |
| 32 int inh,outh; | |
| 33 unsigned char buffer[100]; | |
| 34 int ni,no; | |
| 35 inh = open(inName,O_RDONLY); | |
| 36 outh = yaffs_open(yaffsName, O_CREAT | O_RDWR | O_TRUNC, S_IREAD | S_IWRITE); | |
| 37 | |
| 38 while((ni = read(inh,buffer,100)) > 0) | |
| 39 { | |
| 40 no = yaffs_write(outh,buffer,ni); | |
| 41 if(ni != no) | |
| 42 { | |
| 43 printf("problem writing yaffs file\n"); | |
| 44 } | |
| 45 | |
| 46 } | |
| 47 | |
| 48 yaffs_close(outh); | |
| 49 close(inh); | |
| 50 } | |
| 51 | |
| 52 void make_a_file(char *yaffsName,char bval,int sizeOfFile) | |
| 53 { | |
| 54 int outh; | |
| 55 int i; | |
| 56 unsigned char buffer[100]; | |
| 57 | |
| 58 outh = yaffs_open(yaffsName, O_CREAT | O_RDWR | O_TRUNC, S_IREAD | S_IWRITE); | |
| 59 | |
| 60 memset(buffer,bval,100); | |
| 61 | |
| 62 do{ | |
| 63 i = sizeOfFile; | |
| 64 if(i > 100) i = 100; | |
| 65 sizeOfFile -= i; | |
| 66 | |
| 67 yaffs_write(outh,buffer,i); | |
| 68 | |
| 69 } while (sizeOfFile > 0); | |
| 70 | |
| 71 | |
| 72 yaffs_close(outh); | |
| 73 | |
| 74 } | |
| 75 | |
| 76 void make_pattern_file(char *fn,int size) | |
| 77 { | |
| 78 int outh; | |
| 79 int marker; | |
| 80 int i; | |
| 81 outh = yaffs_open(fn, O_CREAT | O_RDWR | O_TRUNC, S_IREAD | S_IWRITE); | |
| 82 yaffs_lseek(outh,size-1,SEEK_SET); | |
| 83 yaffs_write(outh,"A",1); | |
| 84 | |
| 85 for(i = 0; i < size; i+=256) | |
| 86 { | |
| 87 marker = ~i; | |
| 88 yaffs_lseek(outh,i,SEEK_SET); | |
| 89 yaffs_write(outh,&marker,sizeof(marker)); | |
| 90 } | |
| 91 yaffs_close(outh); | |
| 92 | |
| 93 } | |
| 94 | |
| 95 int check_pattern_file(char *fn) | |
| 96 { | |
| 97 int h; | |
| 98 int marker; | |
| 99 int i; | |
| 100 int size; | |
| 101 int ok = 1; | |
| 102 | |
| 103 h = yaffs_open(fn, O_RDWR,0); | |
| 104 size = yaffs_lseek(h,0,SEEK_END); | |
| 105 | |
| 17 | 106 for(i = 0; i < size; i+=256) |
| 1 | 107 { |
| 108 yaffs_lseek(h,i,SEEK_SET); | |
| 109 yaffs_read(h,&marker,sizeof(marker)); | |
| 110 ok = (marker == ~i); | |
| 111 if(!ok) | |
| 112 { | |
| 113 printf("pattern check failed on file %s, size %d at position %d. Got %x instead of %x\n", | |
| 114 fn,size,i,marker,~i); | |
| 115 } | |
| 116 } | |
| 117 yaffs_close(h); | |
| 118 return ok; | |
| 119 } | |
| 120 | |
| 121 | |
| 122 | |
| 17 | 123 |
| 124 | |
| 125 int dump_file_data(char *fn) | |
| 126 { | |
| 127 int h; | |
| 128 int i = 0; | |
| 129 int ok = 1; | |
| 130 unsigned char b; | |
| 131 | |
| 132 h = yaffs_open(fn, O_RDWR,0); | |
| 133 | |
| 134 | |
| 135 printf("%s\n",fn); | |
| 136 while(yaffs_read(h,&b,1)> 0) | |
| 137 { | |
| 138 printf("%02x",b); | |
| 139 i++; | |
| 140 if(i > 32) | |
| 141 { | |
| 142 printf("\n"); | |
| 143 i = 0;; | |
| 144 } | |
| 145 } | |
| 146 printf("\n"); | |
| 147 yaffs_close(h); | |
| 148 return ok; | |
| 149 } | |
| 150 | |
| 151 | |
| 152 | |
| 1 | 153 void dump_file(const char *fn) |
| 154 { | |
| 155 int i; | |
| 156 int size; | |
| 157 int h; | |
| 158 | |
| 159 h = yaffs_open(fn,O_RDONLY,0); | |
| 160 if(h < 0) | |
| 161 { | |
| 162 printf("*****\nDump file %s does not exist\n",fn); | |
| 163 } | |
| 164 else | |
| 165 { | |
| 166 size = yaffs_lseek(h,0,SEEK_SET); | |
| 167 printf("*****\nDump file %s size %d\n",fn,size); | |
| 168 for(i = 0; i < size; i++) | |
| 169 { | |
| 170 | |
| 171 } | |
| 172 } | |
| 173 } | |
| 174 | |
| 17 | 175 void create_file_of_size(const char *fn,int syze) |
| 176 { | |
| 177 int h; | |
| 178 int n; | |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
179 int result; |
| 17 | 180 |
|
146
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
181 char xx[200]; |
| 17 | 182 |
| 183 int iterations = (syze + strlen(fn) -1)/ strlen(fn); | |
| 184 | |
| 185 h = yaffs_open(fn, O_CREAT | O_RDWR | O_TRUNC, S_IREAD | S_IWRITE); | |
| 186 | |
| 187 while (iterations > 0) | |
| 188 { | |
|
146
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
189 sprintf(xx,"%s %8d",fn,iterations); |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
190 n = strlen(xx); |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
191 result = yaffs_write(h,xx,n); |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
192 if(result != n) |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
193 printf("Wrote %d, should have been %d\n",result,n); |
|
146
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
194 iterations--; |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
195 } |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
196 yaffs_close (h); |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
197 } |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
198 |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
199 void verify_file_of_size(const char *fn,int syze) |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
200 { |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
201 int h; |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
202 int result; |
|
146
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
203 |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
204 char xx[200]; |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
205 char yy[200]; |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
206 int l; |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
207 |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
208 int iterations = (syze + strlen(fn) -1)/ strlen(fn); |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
209 |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
210 h = yaffs_open(fn, O_RDONLY, S_IREAD | S_IWRITE); |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
211 |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
212 while (iterations > 0) |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
213 { |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
214 sprintf(xx,"%s %8d",fn,iterations); |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
215 l = strlen(xx); |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
216 |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
217 result = yaffs_read(h,yy,l); |
|
146
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
218 yy[l] = 0; |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
219 |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
220 if(strcmp(xx,yy)){ |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
221 printf("=====>>>>> verification of file %s failed near position %lld\n",fn,(long long)yaffs_lseek(h,0,SEEK_CUR)); |
|
146
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
222 } |
| 17 | 223 iterations--; |
| 224 } | |
| 225 yaffs_close (h); | |
| 226 } | |
| 227 | |
| 228 void create_resized_file_of_size(const char *fn,int syze1,int reSyze, int syze2) | |
| 229 { | |
| 230 int h; | |
| 231 | |
| 232 int iterations; | |
| 233 | |
| 234 h = yaffs_open(fn, O_CREAT | O_RDWR | O_TRUNC, S_IREAD | S_IWRITE); | |
| 235 | |
| 236 iterations = (syze1 + strlen(fn) -1)/ strlen(fn); | |
| 237 while (iterations > 0) | |
| 238 { | |
| 239 yaffs_write(h,fn,strlen(fn)); | |
| 240 iterations--; | |
| 241 } | |
| 242 | |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
243 yaffs_ftruncate(h,reSyze); |
| 17 | 244 |
| 245 yaffs_lseek(h,0,SEEK_SET); | |
| 246 iterations = (syze2 + strlen(fn) -1)/ strlen(fn); | |
| 247 while (iterations > 0) | |
| 248 { | |
| 249 yaffs_write(h,fn,strlen(fn)); | |
| 250 iterations--; | |
| 251 } | |
| 252 | |
| 253 yaffs_close (h); | |
| 254 } | |
| 255 | |
| 256 | |
| 257 void do_some_file_stuff(const char *path) | |
| 258 { | |
| 259 | |
| 260 char fn[100]; | |
| 261 | |
| 262 sprintf(fn,"%s/%s",path,"f1"); | |
| 263 create_file_of_size(fn,10000); | |
| 264 | |
| 265 sprintf(fn,"%s/%s",path,"fdel"); | |
| 266 create_file_of_size(fn,10000); | |
| 267 yaffs_unlink(fn); | |
| 268 | |
| 269 sprintf(fn,"%s/%s",path,"f2"); | |
| 270 | |
| 271 create_resized_file_of_size(fn,10000,3000,4000); | |
| 272 } | |
| 273 | |
| 274 void yaffs_backward_scan_test(const char *path) | |
| 275 { | |
| 276 char fn[100]; | |
| 277 | |
| 278 yaffs_StartUp(); | |
| 279 | |
| 280 yaffs_mount(path); | |
| 281 | |
| 282 do_some_file_stuff(path); | |
| 283 | |
| 284 sprintf(fn,"%s/ddd",path); | |
| 285 | |
| 286 yaffs_mkdir(fn,0); | |
| 287 | |
| 288 do_some_file_stuff(fn); | |
| 289 | |
| 290 yaffs_unmount(path); | |
| 291 | |
| 292 yaffs_mount(path); | |
| 293 } | |
| 294 | |
| 123 | 295 char xxzz[2000]; |
| 296 | |
| 297 | |
| 298 void yaffs_device_flush_test(const char *path) | |
| 299 { | |
| 300 char fn[100]; | |
| 301 int h; | |
| 302 int i; | |
| 303 | |
| 304 yaffs_StartUp(); | |
| 305 | |
| 306 yaffs_mount(path); | |
| 307 | |
| 308 do_some_file_stuff(path); | |
| 309 | |
| 310 // Open and add some data to a few files | |
| 311 for(i = 0; i < 10; i++) { | |
| 312 | |
| 313 sprintf(fn,"%s/ff%d",path,i); | |
| 314 | |
| 315 h = yaffs_open(fn, O_CREAT | O_RDWR | O_TRUNC, S_IWRITE | S_IREAD); | |
| 316 yaffs_write(h,xxzz,2000); | |
| 317 yaffs_write(h,xxzz,2000); | |
| 318 } | |
| 319 yaffs_unmount(path); | |
| 320 | |
| 321 yaffs_mount(path); | |
| 322 } | |
| 323 | |
| 17 | 324 |
| 325 | |
| 1 | 326 void short_scan_test(const char *path, int fsize, int niterations) |
| 327 { | |
| 328 int i; | |
| 329 char fn[100]; | |
| 330 | |
| 331 sprintf(fn,"%s/%s",path,"f1"); | |
| 332 | |
| 333 yaffs_StartUp(); | |
| 334 for(i = 0; i < niterations; i++) | |
| 335 { | |
| 336 printf("\n*****************\nIteration %d\n",i); | |
| 337 yaffs_mount(path); | |
| 338 printf("\nmount: Directory look-up of %s\n",path); | |
| 339 dumpDir(path); | |
| 340 make_a_file(fn,1,fsize); | |
| 341 yaffs_unmount(path); | |
| 342 } | |
| 343 } | |
| 344 | |
| 17 | 345 |
| 346 | |
| 1 | 347 void scan_pattern_test(const char *path, int fsize, int niterations) |
| 348 { | |
| 349 int i; | |
| 350 int j; | |
| 351 char fn[3][100]; | |
| 352 int result; | |
| 353 | |
| 354 sprintf(fn[0],"%s/%s",path,"f0"); | |
| 355 sprintf(fn[1],"%s/%s",path,"f1"); | |
| 356 sprintf(fn[2],"%s/%s",path,"f2"); | |
| 357 | |
| 358 yaffs_StartUp(); | |
| 359 | |
| 360 for(i = 0; i < niterations; i++) | |
| 361 { | |
| 362 printf("\n*****************\nIteration %d\n",i); | |
| 363 yaffs_mount(path); | |
| 364 printf("\nmount: Directory look-up of %s\n",path); | |
| 365 dumpDir(path); | |
| 366 for(j = 0; j < 3; j++) | |
| 367 { | |
| 17 | 368 result = dump_file_data(fn[j]); |
| 1 | 369 result = check_pattern_file(fn[j]); |
| 370 make_pattern_file(fn[j],fsize); | |
| 17 | 371 result = dump_file_data(fn[j]); |
| 1 | 372 result = check_pattern_file(fn[j]); |
| 373 } | |
| 374 yaffs_unmount(path); | |
| 375 } | |
| 376 } | |
| 377 | |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
378 void fill_disk(const char *path,int nfiles) |
| 1 | 379 { |
| 380 int h; | |
| 381 int n; | |
| 382 int result; | |
| 383 int f; | |
| 384 | |
| 385 char str[50]; | |
| 386 | |
| 387 for(n = 0; n < nfiles; n++) | |
| 388 { | |
| 389 sprintf(str,"%s/%d",path,n); | |
| 390 | |
| 391 h = yaffs_open(str, O_CREAT | O_RDWR | O_TRUNC, S_IREAD | S_IWRITE); | |
| 392 | |
| 393 printf("writing file %s handle %d ",str, h); | |
| 394 | |
| 395 while ((result = yaffs_write(h,xx,600)) == 600) | |
| 396 { | |
|
21
68dffdfc2095
Some tinkering on test harness and st_xxx to yst_xxx changes
charles <charles>
parents:
17
diff
changeset
|
397 f = yaffs_freespace(path); |
| 1 | 398 } |
| 399 result = yaffs_close(h); | |
| 400 printf(" close %d\n",result); | |
| 401 } | |
| 402 } | |
| 403 | |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
404 void fill_disk_and_delete(const char *path, int nfiles, int ncycles) |
| 1 | 405 { |
| 406 int i,j; | |
| 407 char str[50]; | |
| 408 int result; | |
| 409 | |
| 410 for(i = 0; i < ncycles; i++) | |
| 411 { | |
| 412 printf("@@@@@@@@@@@@@@ cycle %d\n",i); | |
| 413 fill_disk(path,nfiles); | |
| 414 | |
| 415 for(j = 0; j < nfiles; j++) | |
| 416 { | |
| 417 sprintf(str,"%s/%d",path,j); | |
| 418 result = yaffs_unlink(str); | |
| 419 printf("unlinking file %s, result %d\n",str,result); | |
| 420 } | |
| 421 } | |
| 422 } | |
| 423 | |
| 424 | |
| 337 | 425 void fill_files(const char *path,int flags, int maxIterations,int siz) |
| 1 | 426 { |
| 427 int i; | |
| 428 int j; | |
| 429 char str[50]; | |
| 430 int h; | |
| 431 | |
| 432 i = 0; | |
| 433 | |
| 434 do{ | |
| 435 sprintf(str,"%s/%d",path,i); | |
| 436 h = yaffs_open(str, O_CREAT | O_TRUNC | O_RDWR,S_IREAD | S_IWRITE); | |
| 437 | |
| 438 if(h >= 0) | |
| 439 { | |
| 440 for(j = 0; j < siz; j++) | |
| 441 { | |
| 442 yaffs_write(h,str,1); | |
| 443 } | |
| 444 } | |
| 445 | |
| 446 if( flags & 1) | |
| 447 { | |
| 448 yaffs_unlink(str); | |
| 449 } | |
| 450 i++; | |
| 451 } while(h >= 0 && i < maxIterations); | |
| 452 | |
| 453 if(flags & 2) | |
| 454 { | |
| 455 i = 0; | |
| 456 do{ | |
| 457 sprintf(str,"%s/%d",path,i); | |
| 458 printf("unlink %s\n",str); | |
| 459 i++; | |
| 460 } while(yaffs_unlink(str) >= 0); | |
| 461 } | |
| 462 } | |
| 463 | |
| 464 void leave_unlinked_file(char *path,int maxIterations,int siz) | |
| 465 { | |
| 466 int i; | |
| 467 char str[50]; | |
| 468 int h; | |
| 469 | |
| 470 i = 0; | |
| 471 | |
| 472 do{ | |
| 473 sprintf(str,"%s/%d",path,i); | |
| 474 printf("create %s\n",str); | |
| 475 h = yaffs_open(str, O_CREAT | O_TRUNC | O_RDWR,S_IREAD | S_IWRITE); | |
| 476 if(h >= 0) | |
| 477 { | |
| 478 yaffs_unlink(str); | |
| 479 } | |
| 480 i++; | |
| 481 } while(h < 0 && i < maxIterations); | |
| 482 | |
| 483 if(h >= 0) | |
| 484 { | |
| 485 for(i = 0; i < siz; i++) | |
| 486 { | |
| 487 yaffs_write(h,str,1); | |
| 488 } | |
| 489 } | |
| 490 | |
| 491 printf("Leaving file %s open\n",str); | |
| 492 | |
| 493 } | |
| 494 | |
| 495 void dumpDirFollow(const char *dname) | |
| 496 { | |
| 497 yaffs_DIR *d; | |
| 498 yaffs_dirent *de; | |
| 499 struct yaffs_stat s; | |
| 500 char str[100]; | |
| 501 | |
| 502 d = yaffs_opendir(dname); | |
| 503 | |
| 504 if(!d) | |
| 505 { | |
| 506 printf("opendir failed\n"); | |
| 507 } | |
| 508 else | |
| 509 { | |
| 510 while((de = yaffs_readdir(d)) != NULL) | |
| 511 { | |
| 512 sprintf(str,"%s/%s",dname,de->d_name); | |
| 513 | |
| 514 yaffs_stat(str,&s); | |
| 515 | |
| 208 | 516 printf("%s ino %d length %d mode %X ",de->d_name,(int)s.st_ino,(int)s.st_size,s.st_mode); |
| 1 | 517 switch(s.st_mode & S_IFMT) |
| 518 { | |
| 519 case S_IFREG: printf("data file"); break; | |
| 520 case S_IFDIR: printf("directory"); break; | |
| 521 case S_IFLNK: printf("symlink -->"); | |
| 522 if(yaffs_readlink(str,str,100) < 0) | |
| 523 printf("no alias"); | |
| 524 else | |
| 525 printf("\"%s\"",str); | |
| 526 break; | |
| 527 default: printf("unknown"); break; | |
| 528 } | |
| 529 | |
| 530 printf("\n"); | |
| 531 } | |
| 532 | |
| 533 yaffs_closedir(d); | |
| 534 } | |
| 535 printf("\n"); | |
| 536 | |
| 537 printf("Free space in %s is %d\n\n",dname,(int)yaffs_freespace(dname)); | |
| 538 | |
| 539 } | |
| 540 | |
| 541 | |
| 127 | 542 void dump_directory_tree_worker(const char *dname,int recursive) |
| 1 | 543 { |
| 544 yaffs_DIR *d; | |
| 545 yaffs_dirent *de; | |
| 546 struct yaffs_stat s; | |
| 151 | 547 char str[1000]; |
| 1 | 548 |
| 549 d = yaffs_opendir(dname); | |
| 550 | |
| 551 if(!d) | |
| 552 { | |
| 553 printf("opendir failed\n"); | |
| 554 } | |
| 555 else | |
| 556 { | |
| 557 while((de = yaffs_readdir(d)) != NULL) | |
| 558 { | |
| 559 sprintf(str,"%s/%s",dname,de->d_name); | |
| 560 | |
| 561 yaffs_lstat(str,&s); | |
| 562 | |
| 151 | 563 printf("%s inode %d obj %x length %d mode %X ",str,s.st_ino,de->d_dont_use,(int)s.st_size,s.st_mode); |
| 1 | 564 switch(s.st_mode & S_IFMT) |
| 565 { | |
| 566 case S_IFREG: printf("data file"); break; | |
| 567 case S_IFDIR: printf("directory"); break; | |
| 568 case S_IFLNK: printf("symlink -->"); | |
| 569 if(yaffs_readlink(str,str,100) < 0) | |
| 570 printf("no alias"); | |
| 571 else | |
| 572 printf("\"%s\"",str); | |
| 573 break; | |
| 574 default: printf("unknown"); break; | |
| 575 } | |
| 576 | |
| 127 | 577 printf("\n"); |
| 578 | |
| 579 if((s.st_mode & S_IFMT) == S_IFDIR && recursive) | |
| 580 dump_directory_tree_worker(str,1); | |
| 581 | |
| 1 | 582 } |
| 583 | |
| 584 yaffs_closedir(d); | |
| 585 } | |
| 127 | 586 |
| 587 } | |
| 588 | |
| 589 static void dump_directory_tree(const char *dname) | |
| 590 { | |
| 591 dump_directory_tree_worker(dname,1); | |
| 1 | 592 printf("\n"); |
| 593 printf("Free space in %s is %d\n\n",dname,(int)yaffs_freespace(dname)); | |
| 127 | 594 } |
| 1 | 595 |
| 127 | 596 void dumpDir(const char *dname) |
| 597 { dump_directory_tree_worker(dname,0); | |
| 598 printf("\n"); | |
| 599 printf("Free space in %s is %d\n\n",dname,(int)yaffs_freespace(dname)); | |
| 1 | 600 } |
| 601 | |
| 602 | |
| 603 static void PermissionsCheck(const char *path, mode_t tmode, int tflags,int expectedResult) | |
| 604 { | |
| 605 int fd; | |
| 606 | |
| 607 if(yaffs_chmod(path,tmode)< 0) printf("chmod failed\n"); | |
| 608 | |
| 609 fd = yaffs_open(path,tflags,0); | |
| 610 | |
| 611 if((fd >= 0) != (expectedResult > 0)) | |
| 612 { | |
| 613 printf("Permissions check %x %x %d failed\n",tmode,tflags,expectedResult); | |
| 614 } | |
| 615 else | |
| 616 { | |
| 617 printf("Permissions check %x %x %d OK\n",tmode,tflags,expectedResult); | |
| 618 } | |
| 619 | |
| 620 | |
| 621 yaffs_close(fd); | |
| 622 | |
| 623 | |
| 624 } | |
| 625 | |
| 626 int long_test(int argc, char *argv[]) | |
| 627 { | |
| 628 | |
| 629 int f; | |
| 630 int r; | |
| 631 char buffer[20]; | |
| 632 | |
| 633 char str[100]; | |
| 634 | |
| 635 int h; | |
| 636 mode_t temp_mode; | |
| 637 struct yaffs_stat ystat; | |
| 638 | |
| 639 yaffs_StartUp(); | |
| 640 | |
| 641 yaffs_mount("/boot"); | |
| 642 yaffs_mount("/data"); | |
| 643 yaffs_mount("/flash"); | |
| 644 yaffs_mount("/ram"); | |
| 645 | |
| 646 printf("\nDirectory look-up of /boot\n"); | |
| 647 dumpDir("/boot"); | |
| 648 printf("\nDirectory look-up of /data\n"); | |
| 649 dumpDir("/data"); | |
| 650 printf("\nDirectory look-up of /flash\n"); | |
| 651 dumpDir("/flash"); | |
| 652 | |
| 653 //leave_unlinked_file("/flash",20000,0); | |
| 654 //leave_unlinked_file("/data",20000,0); | |
| 655 | |
| 656 leave_unlinked_file("/ram",20,0); | |
| 657 | |
| 658 | |
| 659 f = yaffs_open("/boot/b1", O_RDONLY,0); | |
| 660 | |
| 661 printf("open /boot/b1 readonly, f=%d\n",f); | |
| 662 | |
| 663 f = yaffs_open("/boot/b1", O_CREAT,S_IREAD | S_IWRITE); | |
| 664 | |
| 665 printf("open /boot/b1 O_CREAT, f=%d\n",f); | |
| 666 | |
| 667 | |
| 668 r = yaffs_write(f,"hello",1); | |
| 669 printf("write %d attempted to write to a read-only file\n",r); | |
| 670 | |
| 671 r = yaffs_close(f); | |
| 672 | |
| 673 printf("close %d\n",r); | |
| 674 | |
| 675 f = yaffs_open("/boot/b1", O_RDWR,0); | |
| 676 | |
| 677 printf("open /boot/b1 O_RDWR,f=%d\n",f); | |
| 678 | |
| 679 | |
| 680 r = yaffs_write(f,"hello",2); | |
| 681 printf("write %d attempted to write to a writeable file\n",r); | |
| 682 r = yaffs_write(f,"world",3); | |
| 683 printf("write %d attempted to write to a writeable file\n",r); | |
| 684 | |
| 685 r= yaffs_lseek(f,0,SEEK_END); | |
| 686 printf("seek end %d\n",r); | |
| 687 memset(buffer,0,20); | |
| 688 r = yaffs_read(f,buffer,10); | |
| 689 printf("read %d \"%s\"\n",r,buffer); | |
| 690 r= yaffs_lseek(f,0,SEEK_SET); | |
| 691 printf("seek set %d\n",r); | |
| 692 memset(buffer,0,20); | |
| 693 r = yaffs_read(f,buffer,10); | |
| 694 printf("read %d \"%s\"\n",r,buffer); | |
| 695 memset(buffer,0,20); | |
| 696 r = yaffs_read(f,buffer,10); | |
| 697 printf("read %d \"%s\"\n",r,buffer); | |
| 698 | |
| 699 // Check values reading at end. | |
| 700 // A read past end of file should return 0 for 0 bytes read. | |
| 701 | |
| 702 r= yaffs_lseek(f,0,SEEK_END); | |
| 703 r = yaffs_read(f,buffer,10); | |
| 704 printf("read at end returned %d\n",r); | |
| 705 r= yaffs_lseek(f,500,SEEK_END); | |
| 706 r = yaffs_read(f,buffer,10); | |
| 707 printf("read past end returned %d\n",r); | |
| 708 | |
| 709 r = yaffs_close(f); | |
| 710 | |
| 711 printf("close %d\n",r); | |
| 712 | |
| 713 copy_in_a_file("/boot/yyfile","xxx"); | |
| 714 | |
| 715 // Create a file with a long name | |
| 716 | |
| 717 copy_in_a_file("/boot/file with a long name","xxx"); | |
| 718 | |
| 719 | |
| 720 printf("\nDirectory look-up of /boot\n"); | |
| 721 dumpDir("/boot"); | |
| 722 | |
| 723 // Check stat | |
| 724 r = yaffs_stat("/boot/file with a long name",&ystat); | |
| 725 | |
| 726 // Check rename | |
| 727 | |
| 728 r = yaffs_rename("/boot/file with a long name","/boot/r1"); | |
| 729 | |
| 730 printf("\nDirectory look-up of /boot\n"); | |
| 731 dumpDir("/boot"); | |
| 732 | |
| 733 // Check unlink | |
| 734 r = yaffs_unlink("/boot/r1"); | |
| 735 | |
| 736 printf("\nDirectory look-up of /boot\n"); | |
| 737 dumpDir("/boot"); | |
| 738 | |
| 739 // Check mkdir | |
| 740 | |
| 741 r = yaffs_mkdir("/boot/directory1",0); | |
| 742 | |
| 743 printf("\nDirectory look-up of /boot\n"); | |
| 744 dumpDir("/boot"); | |
| 745 printf("\nDirectory look-up of /boot/directory1\n"); | |
| 746 dumpDir("/boot/directory1"); | |
| 747 | |
| 748 // add a file to the directory | |
| 749 copy_in_a_file("/boot/directory1/file with a long name","xxx"); | |
| 750 | |
| 751 printf("\nDirectory look-up of /boot\n"); | |
| 752 dumpDir("/boot"); | |
| 753 printf("\nDirectory look-up of /boot/directory1\n"); | |
| 754 dumpDir("/boot/directory1"); | |
| 755 | |
| 756 // Attempt to delete directory (should fail) | |
| 757 | |
| 758 r = yaffs_rmdir("/boot/directory1"); | |
| 759 | |
| 760 printf("\nDirectory look-up of /boot\n"); | |
| 761 dumpDir("/boot"); | |
| 762 printf("\nDirectory look-up of /boot/directory1\n"); | |
| 763 dumpDir("/boot/directory1"); | |
| 764 | |
| 765 // Delete file first, then rmdir should work | |
| 766 r = yaffs_unlink("/boot/directory1/file with a long name"); | |
| 767 r = yaffs_rmdir("/boot/directory1"); | |
| 768 | |
| 769 | |
| 770 printf("\nDirectory look-up of /boot\n"); | |
| 771 dumpDir("/boot"); | |
| 772 printf("\nDirectory look-up of /boot/directory1\n"); | |
| 773 dumpDir("/boot/directory1"); | |
| 774 | |
| 775 #if 0 | |
| 776 fill_disk_and_delete("/boot",20,20); | |
| 777 | |
| 778 printf("\nDirectory look-up of /boot\n"); | |
| 779 dumpDir("/boot"); | |
| 780 #endif | |
| 781 | |
| 782 yaffs_symlink("yyfile","/boot/slink"); | |
| 783 | |
| 784 yaffs_readlink("/boot/slink",str,100); | |
| 785 printf("symlink alias is %s\n",str); | |
| 786 | |
| 787 | |
| 788 | |
| 789 | |
| 790 printf("\nDirectory look-up of /boot\n"); | |
| 791 dumpDir("/boot"); | |
| 792 printf("\nDirectory look-up of /boot (using stat instead of lstat)\n"); | |
| 793 dumpDirFollow("/boot"); | |
| 794 printf("\nDirectory look-up of /boot/directory1\n"); | |
| 795 dumpDir("/boot/directory1"); | |
| 796 | |
| 797 h = yaffs_open("/boot/slink",O_RDWR,0); | |
| 798 | |
| 799 printf("file length is %d\n",(int)yaffs_lseek(h,0,SEEK_END)); | |
| 800 | |
| 801 yaffs_close(h); | |
| 802 | |
| 803 yaffs_unlink("/boot/slink"); | |
| 804 | |
| 805 | |
| 806 printf("\nDirectory look-up of /boot\n"); | |
| 807 dumpDir("/boot"); | |
| 808 | |
| 809 // Check chmod | |
| 810 | |
| 811 yaffs_stat("/boot/yyfile",&ystat); | |
| 812 temp_mode = ystat.st_mode; | |
| 813 | |
| 814 yaffs_chmod("/boot/yyfile",0x55555); | |
| 815 printf("\nDirectory look-up of /boot\n"); | |
| 816 dumpDir("/boot"); | |
| 817 | |
| 818 yaffs_chmod("/boot/yyfile",temp_mode); | |
| 819 printf("\nDirectory look-up of /boot\n"); | |
| 820 dumpDir("/boot"); | |
| 821 | |
| 822 // Permission checks... | |
| 823 PermissionsCheck("/boot/yyfile",0, O_WRONLY,0); | |
| 824 PermissionsCheck("/boot/yyfile",0, O_RDONLY,0); | |
| 825 PermissionsCheck("/boot/yyfile",0, O_RDWR,0); | |
| 826 | |
| 827 PermissionsCheck("/boot/yyfile",S_IREAD, O_WRONLY,0); | |
| 828 PermissionsCheck("/boot/yyfile",S_IREAD, O_RDONLY,1); | |
| 829 PermissionsCheck("/boot/yyfile",S_IREAD, O_RDWR,0); | |
| 830 | |
| 831 PermissionsCheck("/boot/yyfile",S_IWRITE, O_WRONLY,1); | |
| 832 PermissionsCheck("/boot/yyfile",S_IWRITE, O_RDONLY,0); | |
| 833 PermissionsCheck("/boot/yyfile",S_IWRITE, O_RDWR,0); | |
| 834 | |
| 835 PermissionsCheck("/boot/yyfile",S_IREAD | S_IWRITE, O_WRONLY,1); | |
| 836 PermissionsCheck("/boot/yyfile",S_IREAD | S_IWRITE, O_RDONLY,1); | |
| 837 PermissionsCheck("/boot/yyfile",S_IREAD | S_IWRITE, O_RDWR,1); | |
| 838 | |
| 839 yaffs_chmod("/boot/yyfile",temp_mode); | |
| 840 | |
| 841 //create a zero-length file and unlink it (test for scan bug) | |
| 842 | |
| 843 h = yaffs_open("/boot/zlf",O_CREAT | O_TRUNC | O_RDWR,0); | |
| 844 yaffs_close(h); | |
| 845 | |
| 846 yaffs_unlink("/boot/zlf"); | |
| 847 | |
| 848 | |
| 849 yaffs_DumpDevStruct("/boot"); | |
| 850 | |
| 851 fill_disk_and_delete("/boot",20,20); | |
| 852 | |
| 853 yaffs_DumpDevStruct("/boot"); | |
| 854 | |
| 855 fill_files("/boot",1,10000,0); | |
| 856 fill_files("/boot",1,10000,5000); | |
| 857 fill_files("/boot",2,10000,0); | |
| 858 fill_files("/boot",2,10000,5000); | |
| 859 | |
| 860 leave_unlinked_file("/data",20000,0); | |
| 861 leave_unlinked_file("/data",20000,5000); | |
| 862 leave_unlinked_file("/data",20000,5000); | |
| 863 leave_unlinked_file("/data",20000,5000); | |
| 864 leave_unlinked_file("/data",20000,5000); | |
| 865 leave_unlinked_file("/data",20000,5000); | |
| 866 | |
| 867 yaffs_DumpDevStruct("/boot"); | |
| 868 yaffs_DumpDevStruct("/data"); | |
| 869 | |
| 870 | |
| 871 | |
| 872 return 0; | |
| 873 | |
| 874 } | |
| 875 | |
| 17 | 876 int huge_directory_test_on_path(char *path) |
| 1 | 877 { |
| 878 | |
| 17 | 879 yaffs_DIR *d; |
| 880 yaffs_dirent *de; | |
| 881 struct yaffs_stat s; | |
| 882 | |
| 1 | 883 int f; |
| 17 | 884 int i; |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
885 |
| 17 | 886 int total = 0; |
| 887 int lastTotal = 0; | |
| 1 | 888 |
| 889 char str[100]; | |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
890 |
| 1 | 891 |
| 892 yaffs_StartUp(); | |
| 893 | |
| 894 yaffs_mount(path); | |
| 895 | |
| 17 | 896 // Create a large number of files |
| 1 | 897 |
| 17 | 898 for(i = 0; i < 2000; i++) |
| 899 { | |
| 900 sprintf(str,"%s/%d",path,i); | |
| 901 | |
| 902 f = yaffs_open(str,O_CREAT,S_IREAD | S_IWRITE); | |
| 903 yaffs_close(f); | |
| 904 } | |
| 1 | 905 |
| 906 | |
| 907 | |
| 17 | 908 d = yaffs_opendir(path); |
| 909 i = 0; | |
| 910 if (d) { | |
| 911 while((de = yaffs_readdir(d)) != NULL) { | |
| 912 if (total >lastTotal+100*9*1024||(i & 1023)==0){ | |
| 913 printf("files = %d, total = %d\n",i, total); | |
| 914 lastTotal = total; | |
| 915 } | |
| 916 i++; | |
| 917 sprintf(str,"%s/%s",path,de->d_name); | |
| 918 yaffs_lstat(str,&s); | |
| 919 switch(s.st_mode & S_IFMT){ | |
| 920 case S_IFREG: | |
| 921 //printf("data file"); | |
| 922 total += s.st_size; | |
| 923 break; | |
| 924 } | |
| 925 } | |
| 1 | 926 |
| 17 | 927 yaffs_closedir(d); |
| 928 } | |
| 1 | 929 |
| 930 return 0; | |
| 931 } | |
| 932 | |
| 933 int yaffs_scan_test(const char *path) | |
| 934 { | |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
935 return 0; |
| 1 | 936 } |
| 937 | |
| 938 | |
|
91
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
939 void rename_over_test(const char *mountpt) |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
940 { |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
941 int i; |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
942 char a[100]; |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
943 char b[100]; |
| 216 | 944 char c[100]; |
|
91
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
945 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
946 sprintf(a,"%s/a",mountpt); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
947 sprintf(b,"%s/b",mountpt); |
| 216 | 948 sprintf(c,"%s/c",mountpt); |
|
91
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
949 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
950 yaffs_StartUp(); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
951 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
952 yaffs_mount(mountpt); |
| 208 | 953 |
| 954 printf("Existing files\n"); | |
| 955 dumpDirFollow(mountpt); | |
| 956 | |
| 957 | |
| 216 | 958 |
| 959 i = yaffs_open(c,O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE); | |
| 960 printf("File c handle is %d\n",i); | |
|
91
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
961 yaffs_close(i); |
| 216 | 962 i = yaffs_open(a,O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE); |
| 963 yaffs_close(i); | |
| 964 i = yaffs_open(b,O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE); | |
|
91
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
965 yaffs_close(i); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
966 yaffs_rename(a,b); // rename over |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
967 yaffs_rename(b,a); // rename back again (not renaimng over) |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
968 yaffs_rename(a,b); // rename back again (not renaimng over) |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
969 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
970 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
971 yaffs_unmount(mountpt); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
972 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
973 } |
| 1 | 974 |
|
210
8a4f31e59ad8
Some cleanups, Linux 2.6.25 handling, fix handing of root permissions
charles <charles>
parents:
208
diff
changeset
|
975 |
| 1 | 976 int resize_stress_test(const char *path) |
| 977 { | |
| 978 int a,b,i,j; | |
| 979 int x; | |
| 980 int r; | |
| 981 char aname[100]; | |
| 982 char bname[100]; | |
| 983 | |
| 984 char abuffer[1000]; | |
| 985 char bbuffer[1000]; | |
| 986 | |
| 987 yaffs_StartUp(); | |
| 988 | |
| 989 yaffs_mount(path); | |
| 990 | |
| 991 sprintf(aname,"%s%s",path,"/a"); | |
| 992 sprintf(bname,"%s%s",path,"/b"); | |
| 993 | |
| 994 memset(abuffer,'a',1000); | |
| 995 memset(bbuffer,'b',1000); | |
| 996 | |
| 997 a = yaffs_open(aname, O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE); | |
| 998 b = yaffs_open(bname, O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE); | |
| 999 | |
| 1000 printf(" %s %d %s %d\n",aname,a,bname,b); | |
| 1001 | |
| 1002 x = 0; | |
| 1003 | |
| 1004 for(j = 0; j < 100; j++) | |
| 1005 { | |
| 1006 yaffs_lseek(a,0,SEEK_END); | |
| 1007 | |
| 1008 | |
| 1009 for(i = 0; i <20000; i++) | |
| 1010 { | |
| 1011 //r = yaffs_lseek(b,i,SEEK_SET); | |
| 1012 //r = yaffs_write(b,bbuffer,1000); | |
| 1013 | |
| 1014 if(x & 0x16) | |
| 1015 { | |
| 1016 // shrink | |
| 1017 int syz = yaffs_lseek(a,0,SEEK_END); | |
| 1018 | |
| 1019 syz -= 500; | |
| 1020 if(syz < 0) syz = 0; | |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
1021 yaffs_ftruncate(a,syz); |
| 1 | 1022 |
| 1023 } | |
| 1024 else | |
| 1025 { | |
| 1026 //expand | |
| 1027 r = yaffs_lseek(a,i * 500,SEEK_SET); | |
| 1028 r = yaffs_write(a,abuffer,1000); | |
| 1029 } | |
| 1030 x++; | |
| 1031 | |
| 1032 } | |
| 1033 } | |
| 1034 | |
| 1035 return 0; | |
| 1036 | |
| 1037 } | |
| 1038 | |
|
210
8a4f31e59ad8
Some cleanups, Linux 2.6.25 handling, fix handing of root permissions
charles <charles>
parents:
208
diff
changeset
|
1039 int root_perm_remount(const char *path) |
|
8a4f31e59ad8
Some cleanups, Linux 2.6.25 handling, fix handing of root permissions
charles <charles>
parents:
208
diff
changeset
|
1040 { |
|
8a4f31e59ad8
Some cleanups, Linux 2.6.25 handling, fix handing of root permissions
charles <charles>
parents:
208
diff
changeset
|
1041 struct yaffs_stat s; |
|
8a4f31e59ad8
Some cleanups, Linux 2.6.25 handling, fix handing of root permissions
charles <charles>
parents:
208
diff
changeset
|
1042 |
|
8a4f31e59ad8
Some cleanups, Linux 2.6.25 handling, fix handing of root permissions
charles <charles>
parents:
208
diff
changeset
|
1043 yaffs_StartUp(); |
|
8a4f31e59ad8
Some cleanups, Linux 2.6.25 handling, fix handing of root permissions
charles <charles>
parents:
208
diff
changeset
|
1044 |
|
8a4f31e59ad8
Some cleanups, Linux 2.6.25 handling, fix handing of root permissions
charles <charles>
parents:
208
diff
changeset
|
1045 yaffs_mount(path); |
|
8a4f31e59ad8
Some cleanups, Linux 2.6.25 handling, fix handing of root permissions
charles <charles>
parents:
208
diff
changeset
|
1046 |
|
8a4f31e59ad8
Some cleanups, Linux 2.6.25 handling, fix handing of root permissions
charles <charles>
parents:
208
diff
changeset
|
1047 yaffs_stat(path,&s); |
|
8a4f31e59ad8
Some cleanups, Linux 2.6.25 handling, fix handing of root permissions
charles <charles>
parents:
208
diff
changeset
|
1048 printf("root perms after mount %x\n",s.st_mode); |
|
8a4f31e59ad8
Some cleanups, Linux 2.6.25 handling, fix handing of root permissions
charles <charles>
parents:
208
diff
changeset
|
1049 |
|
8a4f31e59ad8
Some cleanups, Linux 2.6.25 handling, fix handing of root permissions
charles <charles>
parents:
208
diff
changeset
|
1050 yaffs_chmod(path, 0777); |
|
8a4f31e59ad8
Some cleanups, Linux 2.6.25 handling, fix handing of root permissions
charles <charles>
parents:
208
diff
changeset
|
1051 |
|
8a4f31e59ad8
Some cleanups, Linux 2.6.25 handling, fix handing of root permissions
charles <charles>
parents:
208
diff
changeset
|
1052 yaffs_stat(path,&s); |
|
8a4f31e59ad8
Some cleanups, Linux 2.6.25 handling, fix handing of root permissions
charles <charles>
parents:
208
diff
changeset
|
1053 printf("root perms after setting to 0777 is %x\n",s.st_mode); |
|
8a4f31e59ad8
Some cleanups, Linux 2.6.25 handling, fix handing of root permissions
charles <charles>
parents:
208
diff
changeset
|
1054 |
|
8a4f31e59ad8
Some cleanups, Linux 2.6.25 handling, fix handing of root permissions
charles <charles>
parents:
208
diff
changeset
|
1055 yaffs_unmount(path); |
|
8a4f31e59ad8
Some cleanups, Linux 2.6.25 handling, fix handing of root permissions
charles <charles>
parents:
208
diff
changeset
|
1056 |
|
8a4f31e59ad8
Some cleanups, Linux 2.6.25 handling, fix handing of root permissions
charles <charles>
parents:
208
diff
changeset
|
1057 return 0; |
|
8a4f31e59ad8
Some cleanups, Linux 2.6.25 handling, fix handing of root permissions
charles <charles>
parents:
208
diff
changeset
|
1058 |
|
8a4f31e59ad8
Some cleanups, Linux 2.6.25 handling, fix handing of root permissions
charles <charles>
parents:
208
diff
changeset
|
1059 } |
|
8a4f31e59ad8
Some cleanups, Linux 2.6.25 handling, fix handing of root permissions
charles <charles>
parents:
208
diff
changeset
|
1060 |
| 1 | 1061 |
| 1062 int resize_stress_test_no_grow_complex(const char *path,int iters) | |
| 1063 { | |
| 1064 int a,b,i,j; | |
| 1065 int x; | |
| 1066 int r; | |
| 1067 char aname[100]; | |
| 1068 char bname[100]; | |
| 1069 | |
| 1070 char abuffer[1000]; | |
| 1071 char bbuffer[1000]; | |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
1072 |
| 1 | 1073 |
| 1074 yaffs_StartUp(); | |
| 1075 | |
| 1076 yaffs_mount(path); | |
| 1077 | |
| 1078 sprintf(aname,"%s%s",path,"/a"); | |
| 1079 sprintf(bname,"%s%s",path,"/b"); | |
| 1080 | |
| 1081 memset(abuffer,'a',1000); | |
| 1082 memset(bbuffer,'b',1000); | |
| 1083 | |
| 1084 a = yaffs_open(aname, O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE); | |
| 1085 b = yaffs_open(bname, O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE); | |
| 1086 | |
| 1087 printf(" %s %d %s %d\n",aname,a,bname,b); | |
| 1088 | |
| 1089 x = 0; | |
| 1090 | |
| 1091 for(j = 0; j < iters; j++) | |
| 1092 { | |
| 1093 yaffs_lseek(a,0,SEEK_END); | |
| 1094 | |
| 1095 | |
| 1096 for(i = 0; i <20000; i++) | |
| 1097 { | |
| 1098 //r = yaffs_lseek(b,i,SEEK_SET); | |
| 1099 //r = yaffs_write(b,bbuffer,1000); | |
| 1100 | |
| 1101 if(!(x%20)) | |
| 1102 { | |
| 1103 // shrink | |
| 1104 int syz = yaffs_lseek(a,0,SEEK_END); | |
| 1105 | |
| 1106 while(syz > 4000) | |
| 1107 { | |
| 1108 | |
| 1109 syz -= 2050; | |
| 1110 if(syz < 0) syz = 0; | |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
1111 yaffs_ftruncate(a,syz); |
| 1 | 1112 syz = yaffs_lseek(a,0,SEEK_END); |
| 1113 printf("shrink to %d\n",syz); | |
| 1114 } | |
| 1115 | |
| 1116 | |
| 1117 } | |
| 1118 else | |
| 1119 { | |
| 1120 //expand | |
| 1121 r = yaffs_lseek(a,500,SEEK_END); | |
| 1122 r = yaffs_write(a,abuffer,1000); | |
| 1123 } | |
| 1124 x++; | |
| 1125 | |
| 1126 | |
| 1127 } | |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
1128 |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
1129 printf("file size is %lld\n",(long long)yaffs_lseek(a,0,SEEK_END)); |
| 1 | 1130 |
| 1131 } | |
| 1132 | |
| 1133 return 0; | |
| 1134 | |
| 1135 } | |
| 1136 | |
| 1137 int resize_stress_test_no_grow(const char *path,int iters) | |
| 1138 { | |
| 1139 int a,b,i,j; | |
| 1140 int x; | |
| 1141 int r; | |
| 1142 char aname[100]; | |
| 1143 char bname[100]; | |
| 1144 | |
| 1145 char abuffer[1000]; | |
| 1146 char bbuffer[1000]; | |
| 1147 | |
| 1148 yaffs_StartUp(); | |
| 1149 | |
| 1150 yaffs_mount(path); | |
| 1151 | |
| 1152 sprintf(aname,"%s%s",path,"/a"); | |
| 1153 sprintf(bname,"%s%s",path,"/b"); | |
| 1154 | |
| 1155 memset(abuffer,'a',1000); | |
| 1156 memset(bbuffer,'b',1000); | |
| 1157 | |
| 1158 a = yaffs_open(aname, O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE); | |
| 1159 b = yaffs_open(bname, O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE); | |
| 1160 | |
| 1161 printf(" %s %d %s %d\n",aname,a,bname,b); | |
| 1162 | |
| 1163 x = 0; | |
| 1164 | |
| 1165 for(j = 0; j < iters; j++) | |
| 1166 { | |
| 1167 yaffs_lseek(a,0,SEEK_END); | |
| 1168 | |
| 1169 | |
| 1170 for(i = 0; i <20000; i++) | |
| 1171 { | |
| 1172 //r = yaffs_lseek(b,i,SEEK_SET); | |
| 1173 //r = yaffs_write(b,bbuffer,1000); | |
| 1174 | |
| 1175 if(!(x%20)) | |
| 1176 { | |
| 1177 // shrink | |
| 1178 int syz = yaffs_lseek(a,0,SEEK_END); | |
| 1179 | |
| 1180 while(syz > 4000) | |
| 1181 { | |
| 1182 | |
| 1183 syz -= 2050; | |
| 1184 if(syz < 0) syz = 0; | |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
1185 yaffs_ftruncate(a,syz); |
| 1 | 1186 syz = yaffs_lseek(a,0,SEEK_END); |
| 1187 printf("shrink to %d\n",syz); | |
| 1188 } | |
| 1189 | |
| 1190 | |
| 1191 } | |
| 1192 else | |
| 1193 { | |
| 1194 //expand | |
| 1195 r = yaffs_lseek(a,-500,SEEK_END); | |
| 1196 r = yaffs_write(a,abuffer,1000); | |
| 1197 } | |
| 1198 x++; | |
| 1199 | |
| 1200 | |
| 1201 } | |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
1202 printf("file size is %lld\n",(long long)yaffs_lseek(a,0,SEEK_END)); |
| 1 | 1203 |
| 1204 } | |
| 1205 | |
| 1206 return 0; | |
| 1207 | |
| 1208 } | |
| 1209 | |
| 1210 int directory_rename_test(void) | |
| 1211 { | |
| 1212 int r; | |
| 1213 yaffs_StartUp(); | |
| 1214 | |
| 1215 yaffs_mount("/ram"); | |
| 1216 yaffs_mkdir("/ram/a",0); | |
| 1217 yaffs_mkdir("/ram/a/b",0); | |
| 1218 yaffs_mkdir("/ram/c",0); | |
| 1219 | |
| 1220 printf("\nDirectory look-up of /ram\n"); | |
| 1221 dumpDir("/ram"); | |
| 1222 dumpDir("/ram/a"); | |
| 1223 dumpDir("/ram/a/b"); | |
| 1224 | |
| 1225 printf("Do rename (should fail)\n"); | |
| 1226 | |
| 1227 r = yaffs_rename("/ram/a","/ram/a/b/d"); | |
| 1228 printf("\nDirectory look-up of /ram\n"); | |
| 1229 dumpDir("/ram"); | |
| 1230 dumpDir("/ram/a"); | |
| 1231 dumpDir("/ram/a/b"); | |
| 1232 | |
| 1233 printf("Do rename (should not fail)\n"); | |
| 1234 | |
| 1235 r = yaffs_rename("/ram/c","/ram/a/b/d"); | |
| 1236 printf("\nDirectory look-up of /ram\n"); | |
| 1237 dumpDir("/ram"); | |
| 1238 dumpDir("/ram/a"); | |
| 1239 dumpDir("/ram/a/b"); | |
| 1240 | |
| 1241 | |
| 1242 return 1; | |
| 1243 | |
| 1244 } | |
| 1245 | |
| 1246 int cache_read_test(void) | |
| 1247 { | |
| 1248 int a,b,c; | |
| 1249 int i; | |
| 1250 int sizeOfFiles = 500000; | |
| 1251 char buffer[100]; | |
| 1252 | |
| 1253 yaffs_StartUp(); | |
| 1254 | |
| 1255 yaffs_mount("/boot"); | |
| 1256 | |
| 1257 make_a_file("/boot/a",'a',sizeOfFiles); | |
| 1258 make_a_file("/boot/b",'b',sizeOfFiles); | |
| 1259 | |
| 1260 a = yaffs_open("/boot/a",O_RDONLY,0); | |
| 1261 b = yaffs_open("/boot/b",O_RDONLY,0); | |
| 1262 c = yaffs_open("/boot/c", O_CREAT | O_RDWR | O_TRUNC, S_IREAD | S_IWRITE); | |
| 1263 | |
| 1264 do{ | |
| 1265 i = sizeOfFiles; | |
| 1266 if (i > 100) i = 100; | |
| 1267 sizeOfFiles -= i; | |
| 1268 yaffs_read(a,buffer,i); | |
| 1269 yaffs_read(b,buffer,i); | |
| 1270 yaffs_write(c,buffer,i); | |
| 1271 } while(sizeOfFiles > 0); | |
| 1272 | |
| 1273 | |
| 1274 | |
| 1275 return 1; | |
| 1276 | |
| 1277 } | |
| 1278 | |
| 1279 int cache_bypass_bug_test(void) | |
| 1280 { | |
| 1281 // This test reporoduces a bug whereby YAFFS caching *was* buypassed | |
| 1282 // resulting in erroneous reads after writes. | |
| 1283 // This bug has been fixed. | |
| 1284 | |
| 1285 int a; | |
| 1286 char buffer1[1000]; | |
| 1287 char buffer2[1000]; | |
| 1288 | |
| 1289 memset(buffer1,0,sizeof(buffer1)); | |
| 1290 memset(buffer2,0,sizeof(buffer2)); | |
| 1291 | |
| 1292 yaffs_StartUp(); | |
| 1293 | |
| 1294 yaffs_mount("/boot"); | |
| 1295 | |
| 1296 // Create a file of 2000 bytes. | |
| 1297 make_a_file("/boot/a",'X',2000); | |
| 1298 | |
| 1299 a = yaffs_open("/boot/a",O_RDWR, S_IREAD | S_IWRITE); | |
| 1300 | |
| 1301 // Write a short sequence to the file. | |
| 1302 // This will go into the cache. | |
| 1303 yaffs_lseek(a,0,SEEK_SET); | |
| 1304 yaffs_write(a,"abcdefghijklmnopqrstuvwxyz",20); | |
| 1305 | |
| 1306 // Read a short sequence from the file. | |
| 1307 // This will come from the cache. | |
| 1308 yaffs_lseek(a,0,SEEK_SET); | |
| 1309 yaffs_read(a,buffer1,30); | |
| 1310 | |
| 1311 // Read a page size sequence from the file. | |
| 1312 yaffs_lseek(a,0,SEEK_SET); | |
| 1313 yaffs_read(a,buffer2,512); | |
| 1314 | |
| 1315 printf("buffer 1 %s\n",buffer1); | |
| 1316 printf("buffer 2 %s\n",buffer2); | |
| 1317 | |
| 1318 if(strncmp(buffer1,buffer2,20)) | |
| 1319 { | |
| 1320 printf("Cache bypass bug detected!!!!!\n"); | |
| 1321 } | |
| 1322 | |
| 1323 | |
| 1324 return 1; | |
| 1325 } | |
| 1326 | |
| 1327 | |
| 1328 int free_space_check(void) | |
| 1329 { | |
| 1330 int f; | |
| 1331 | |
| 1332 yaffs_StartUp(); | |
| 1333 yaffs_mount("/boot"); | |
| 1334 fill_disk("/boot/",2); | |
| 1335 f = yaffs_freespace("/boot"); | |
| 1336 | |
| 1337 printf("%d free when disk full\n",f); | |
| 1338 return 1; | |
| 1339 } | |
| 1340 | |
| 1341 int truncate_test(void) | |
| 1342 { | |
| 1343 int a; | |
| 1344 int r; | |
| 1345 int i; | |
| 1346 int l; | |
| 1347 | |
| 1348 char y[10]; | |
| 1349 | |
| 1350 yaffs_StartUp(); | |
| 1351 yaffs_mount("/boot"); | |
| 1352 | |
| 1353 yaffs_unlink("/boot/trunctest"); | |
| 1354 | |
| 1355 a = yaffs_open("/boot/trunctest", O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE); | |
| 1356 | |
| 1357 yaffs_write(a,"abcdefghijklmnopqrstuvwzyz",26); | |
| 1358 | |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
1359 yaffs_ftruncate(a,3); |
| 1 | 1360 l= yaffs_lseek(a,0,SEEK_END); |
| 1361 | |
| 1362 printf("truncated length is %d\n",l); | |
| 1363 | |
| 1364 yaffs_lseek(a,5,SEEK_SET); | |
| 1365 yaffs_write(a,"1",1); | |
| 1366 | |
| 1367 yaffs_lseek(a,0,SEEK_SET); | |
| 1368 | |
| 1369 r = yaffs_read(a,y,10); | |
| 1370 | |
| 1371 printf("read %d bytes:",r); | |
| 1372 | |
| 1373 for(i = 0; i < r; i++) printf("[%02X]",y[i]); | |
| 1374 | |
| 1375 printf("\n"); | |
| 1376 | |
| 1377 return 0; | |
| 1378 | |
| 1379 } | |
| 1380 | |
| 1381 | |
| 17 | 1382 |
| 1383 | |
|
21
68dffdfc2095
Some tinkering on test harness and st_xxx to yst_xxx changes
charles <charles>
parents:
17
diff
changeset
|
1384 |
|
68dffdfc2095
Some tinkering on test harness and st_xxx to yst_xxx changes
charles <charles>
parents:
17
diff
changeset
|
1385 void fill_disk_test(const char *mountpt) |
|
68dffdfc2095
Some tinkering on test harness and st_xxx to yst_xxx changes
charles <charles>
parents:
17
diff
changeset
|
1386 { |
|
68dffdfc2095
Some tinkering on test harness and st_xxx to yst_xxx changes
charles <charles>
parents:
17
diff
changeset
|
1387 int i; |
|
68dffdfc2095
Some tinkering on test harness and st_xxx to yst_xxx changes
charles <charles>
parents:
17
diff
changeset
|
1388 yaffs_StartUp(); |
|
68dffdfc2095
Some tinkering on test harness and st_xxx to yst_xxx changes
charles <charles>
parents:
17
diff
changeset
|
1389 |
|
68dffdfc2095
Some tinkering on test harness and st_xxx to yst_xxx changes
charles <charles>
parents:
17
diff
changeset
|
1390 for(i = 0; i < 5; i++) |
|
68dffdfc2095
Some tinkering on test harness and st_xxx to yst_xxx changes
charles <charles>
parents:
17
diff
changeset
|
1391 { |
|
68dffdfc2095
Some tinkering on test harness and st_xxx to yst_xxx changes
charles <charles>
parents:
17
diff
changeset
|
1392 yaffs_mount(mountpt); |
|
68dffdfc2095
Some tinkering on test harness and st_xxx to yst_xxx changes
charles <charles>
parents:
17
diff
changeset
|
1393 fill_disk_and_delete(mountpt,100,i+1); |
|
68dffdfc2095
Some tinkering on test harness and st_xxx to yst_xxx changes
charles <charles>
parents:
17
diff
changeset
|
1394 yaffs_unmount(mountpt); |
|
68dffdfc2095
Some tinkering on test harness and st_xxx to yst_xxx changes
charles <charles>
parents:
17
diff
changeset
|
1395 } |
|
68dffdfc2095
Some tinkering on test harness and st_xxx to yst_xxx changes
charles <charles>
parents:
17
diff
changeset
|
1396 |
|
68dffdfc2095
Some tinkering on test harness and st_xxx to yst_xxx changes
charles <charles>
parents:
17
diff
changeset
|
1397 } |
| 74 | 1398 |
|
91
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1399 |
|
284
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1400 void fill_files_test(const char *mountpt) |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1401 { |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1402 int i; |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1403 yaffs_StartUp(); |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1404 |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1405 for(i = 0; i < 5; i++) |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1406 { |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1407 yaffs_mount(mountpt); |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1408 fill_files(mountpt,2,3,100); |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1409 yaffs_unmount(mountpt); |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1410 } |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1411 |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1412 } |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1413 |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1414 void fill_empty_files_test(const char *mountpt) |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1415 { |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1416 int i; |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1417 yaffs_StartUp(); |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1418 char name[100]; |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1419 int result = 0; |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1420 |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1421 int d,f; |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1422 |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1423 for(i = 0; i < 5; i++) |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1424 { |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1425 yaffs_mount(mountpt); |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1426 for(d = 0; result >= 0 && d < 1000; d++){ |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1427 sprintf(name,"%s/%d",mountpt,d); |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1428 result= yaffs_mkdir(name,0); |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1429 printf("creating directory %s result %d\n",name,result); |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1430 |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1431 for(f = 0; result >= 0 && f < 100; f++){ |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1432 sprintf(name,"%s/%d/%d",mountpt,d,f); |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1433 result= yaffs_open(name,O_CREAT, 0); |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1434 yaffs_close(result); |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1435 printf("creating file %s result %d\n",name,result); |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1436 } |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1437 } |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1438 yaffs_unmount(mountpt); |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1439 } |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1440 |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1441 } |
|
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1442 |
|
286
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1443 void long_name_test(const char *mountpt) |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1444 { |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1445 int i; |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1446 yaffs_StartUp(); |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1447 char fullName[1000]; |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1448 char name[300]; |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1449 int result = 0; |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1450 |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1451 int d,f; |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1452 |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1453 // Make a 256 byte name |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1454 memset(name,0,sizeof(name)); |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1455 for(i = 0; i < 256; i++) |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1456 name[i] = '0' + i % 10; |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1457 |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1458 sprintf(fullName,"%s/%s",mountpt,name); |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1459 |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1460 for(i = 0; i < 1; i++) |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1461 { |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1462 yaffs_mount(mountpt); |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1463 |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1464 printf("Files at start\n"); |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1465 dumpDir(mountpt); |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1466 |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1467 printf("Creating file %s\n",fullName); |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1468 |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1469 f = yaffs_open(fullName,O_CREAT | O_RDWR,0); |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1470 yaffs_close(f); |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1471 |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1472 printf("Result %d\n",f); |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1473 |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1474 printf("Files\n"); |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1475 dumpDir(mountpt); |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1476 |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1477 printf("Deleting %s\n",fullName); |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1478 result = yaffs_unlink(fullName); |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1479 printf("Result %d\n",result); |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1480 |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1481 printf("Files\n"); |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1482 |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1483 dumpDir(mountpt); |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1484 |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1485 yaffs_unmount(mountpt); |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1486 } |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1487 |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1488 } |
|
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
1489 |
|
284
a1cf385eb14c
Fix problem where object creation fills flash
charles <charles>
parents:
257
diff
changeset
|
1490 |
|
91
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1491 void lookup_test(const char *mountpt) |
| 74 | 1492 { |
| 1493 int i; | |
|
91
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1494 int h; |
| 74 | 1495 char a[100]; |
| 1496 | |
|
91
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1497 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1498 yaffs_DIR *d; |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1499 yaffs_dirent *de; |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1500 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1501 yaffs_StartUp(); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1502 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1503 yaffs_mount(mountpt); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1504 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1505 d = yaffs_opendir(mountpt); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1506 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1507 if(!d) |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1508 { |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1509 printf("opendir failed\n"); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1510 } |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1511 else |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1512 { |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1513 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1514 for(i = 0; (de = yaffs_readdir(d)) != NULL; i++) |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1515 { |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1516 printf("unlinking %s\n",de->d_name); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1517 yaffs_unlink(de->d_name); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1518 } |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1519 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1520 printf("%d files deleted\n",i); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1521 } |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1522 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1523 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1524 for(i = 0; i < 2000; i++){ |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1525 sprintf(a,"%s/%d",mountpt,i); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1526 h = yaffs_open(a,O_CREAT | O_TRUNC | O_RDWR, 0); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1527 yaffs_close(h); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1528 } |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1529 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1530 yaffs_rewinddir(d); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1531 for(i = 0; (de = yaffs_readdir(d)) != NULL; i++) |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1532 { |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1533 printf("%d %s\n",i,de->d_name); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1534 } |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1535 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1536 printf("%d files listed\n\n\n",i); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1537 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1538 yaffs_rewinddir(d); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1539 yaffs_readdir(d); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1540 yaffs_readdir(d); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1541 yaffs_readdir(d); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1542 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1543 for(i = 0; i < 2000; i++){ |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1544 sprintf(a,"%s/%d",mountpt,i); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1545 yaffs_unlink(a); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1546 } |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1547 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1548 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1549 yaffs_unmount(mountpt); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1550 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1551 } |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1552 |
| 337 | 1553 void link_test0(const char *mountpt) |
| 1554 { | |
| 1555 int i; | |
| 1556 char namea[300]; | |
| 1557 char nameb[300]; | |
| 1558 int result = 0; | |
| 1559 | |
| 1560 | |
| 1561 yaffs_StartUp(); | |
| 1562 yaffs_mount(mountpt); | |
| 1563 | |
| 1564 | |
| 1565 sprintf(namea,"%s/a",mountpt); | |
| 1566 sprintf(nameb,"%s/b",mountpt); | |
| 1567 | |
| 1568 printf("mounted\n"); | |
| 1569 dumpDir(mountpt); | |
| 1570 | |
| 1571 yaffs_unlink(namea); | |
| 1572 printf("a unlinked\n"); | |
| 1573 dumpDir(mountpt); | |
| 1574 | |
| 1575 yaffs_unlink(nameb); | |
| 1576 printf("b unlinked\n"); | |
| 1577 dumpDir(mountpt); | |
| 1578 | |
| 1579 result = yaffs_open(namea,O_CREAT| O_RDWR,0666); | |
| 1580 yaffs_close(result); | |
| 1581 printf("a created\n"); | |
| 1582 dumpDir(mountpt); | |
| 1583 | |
| 1584 yaffs_link(namea,nameb); | |
| 1585 printf("linked\n"); | |
| 1586 dumpDir(mountpt); | |
| 1587 yaffs_unlink(namea); | |
| 1588 printf("a ulinked\n"); | |
| 1589 dumpDir(mountpt); | |
| 1590 yaffs_unlink(nameb); | |
| 1591 printf("b unlinked\n"); | |
| 1592 dumpDir(mountpt); | |
| 1593 | |
| 1594 yaffs_unmount(mountpt); | |
| 1595 } | |
| 1596 | |
| 1597 | |
| 1598 void link_test1(const char *mountpt) | |
| 119 | 1599 { |
| 1600 int i; | |
| 1601 int h; | |
| 1602 char a[100]; | |
| 1603 char b[100]; | |
| 1604 char c[100]; | |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
1605 |
| 119 | 1606 sprintf(a,"%s/aaa",mountpt); |
| 1607 sprintf(b,"%s/bbb",mountpt); | |
| 1608 sprintf(c,"%s/ccc",mountpt); | |
| 1609 | |
| 1610 yaffs_StartUp(); | |
| 1611 | |
| 1612 yaffs_mount(mountpt); | |
| 1613 | |
| 1614 | |
| 1615 h = yaffs_open(a, O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE); | |
| 1616 for(i = 0; i < 100; i++) | |
| 1617 yaffs_write(h,a,100); | |
| 1618 | |
| 1619 yaffs_close(h); | |
| 1620 | |
| 1621 yaffs_unlink(b); | |
| 1622 yaffs_unlink(c); | |
| 1623 yaffs_link(a,b); | |
| 1624 yaffs_link(a,c); | |
| 1625 yaffs_unlink(b); | |
| 1626 yaffs_unlink(c); | |
| 1627 yaffs_unlink(a); | |
| 1628 | |
| 1629 | |
| 1630 yaffs_unmount(mountpt); | |
| 1631 yaffs_mount(mountpt); | |
| 1632 | |
| 1633 printf("link test done\n"); | |
| 339 | 1634 } |
| 1635 | |
| 1636 void handle_test(const char *mountpt) | |
| 1637 { | |
| 1638 int i; | |
| 1639 int h; | |
| 1640 int cycle; | |
| 1641 char a[100]; | |
| 1642 | |
| 1643 sprintf(a,"%s/aaa",mountpt); | |
| 119 | 1644 |
| 339 | 1645 yaffs_StartUp(); |
| 1646 | |
| 1647 yaffs_mount(mountpt); | |
| 1648 | |
| 1649 for(cycle = 0; cycle < 5; cycle++){ | |
| 1650 printf("Start cycle %d\n",cycle); | |
| 1651 i = 0; | |
| 1652 do { | |
| 1653 h = yaffs_open(a, O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE); | |
| 1654 printf("%d handle %d\n",i,h); | |
| 1655 i++; | |
| 1656 } while(h >= 0); | |
| 1657 | |
| 1658 while(i >= -1) { | |
| 1659 yaffs_close(i); | |
| 1660 i--; | |
| 1661 } | |
| 1662 } | |
| 1663 | |
| 1664 yaffs_unmount(mountpt); | |
| 119 | 1665 } |
| 1666 | |
|
91
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1667 void freespace_test(const char *mountpt) |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1668 { |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1669 int i; |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1670 int h; |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1671 char a[100]; |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1672 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1673 int f0; |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1674 int f1; |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1675 int f2; |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1676 int f3; |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1677 sprintf(a,"%s/aaa",mountpt); |
| 74 | 1678 |
| 1679 yaffs_StartUp(); | |
| 1680 | |
| 1681 yaffs_mount(mountpt); | |
|
91
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1682 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1683 f0 = yaffs_freespace(mountpt); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1684 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1685 h = yaffs_open(a, O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1686 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1687 for(i = 0; i < 100; i++) |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1688 yaffs_write(h,a,100); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1689 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1690 yaffs_close(h); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1691 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1692 f1 = yaffs_freespace(mountpt); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1693 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1694 yaffs_unlink(a); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1695 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1696 f2 = yaffs_freespace(mountpt); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1697 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1698 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1699 yaffs_unmount(mountpt); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1700 yaffs_mount(mountpt); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1701 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1702 f3 = yaffs_freespace(mountpt); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1703 |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1704 printf("%d\n%d\n%d\n%d\n",f0, f1,f2,f3); |
| 74 | 1705 |
| 1706 | |
| 1707 } | |
|
91
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1708 |
| 102 | 1709 void simple_rw_test(const char *mountpt) |
| 1710 { | |
| 1711 int i; | |
| 1712 int h; | |
| 1713 char a[100]; | |
| 1714 | |
| 1715 int x; | |
| 1716 int result; | |
| 1717 | |
| 1718 sprintf(a,"%s/aaa",mountpt); | |
| 1719 | |
| 1720 yaffs_StartUp(); | |
| 1721 | |
| 1722 yaffs_mount(mountpt); | |
| 1723 | |
| 1724 yaffs_unlink(a); | |
| 1725 | |
| 1726 h = yaffs_open(a,O_CREAT| O_TRUNC | O_RDWR, S_IREAD | S_IWRITE); | |
| 1727 | |
| 1728 for(i = 100000;i < 200000; i++){ | |
| 1729 result = yaffs_write(h,&i,sizeof(i)); | |
| 1730 | |
| 1731 if(result != 4) | |
| 1732 { | |
| 1733 printf("write error\n"); | |
| 1734 exit(1); | |
| 1735 } | |
| 1736 } | |
| 1737 | |
| 1738 //yaffs_close(h); | |
| 1739 | |
| 1740 // h = yaffs_open(a,O_RDWR, S_IREAD | S_IWRITE); | |
| 1741 | |
| 1742 | |
| 1743 yaffs_lseek(h,0,SEEK_SET); | |
| 1744 | |
| 1745 for(i = 100000; i < 200000; i++){ | |
| 1746 result = yaffs_read(h,&x,sizeof(x)); | |
| 1747 | |
| 1748 if(result != 4 || x != i){ | |
| 1749 printf("read error %d %x %x\n",i,result,x); | |
| 1750 } | |
| 1751 } | |
| 1752 | |
| 1753 printf("Simple rw test passed\n"); | |
| 1754 | |
| 1755 | |
| 1756 | |
| 1757 } | |
| 1758 | |
|
91
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1759 |
| 17 | 1760 void scan_deleted_files_test(const char *mountpt) |
| 1761 { | |
| 1762 char fn[100]; | |
| 1763 char sub[100]; | |
| 1764 | |
| 1765 const char *p; | |
| 1766 | |
| 1767 int i; | |
| 1768 int j; | |
| 1769 int k; | |
| 1770 int h; | |
| 1771 | |
| 1772 sprintf(sub,"%s/sdir",mountpt); | |
| 1773 yaffs_StartUp(); | |
| 1774 | |
| 1775 for(j = 0; j < 10; j++) | |
| 1776 { | |
| 1777 printf("\n\n>>>>>>> Run %d <<<<<<<<<<<<<\n\n",j); | |
| 1778 yaffs_mount(mountpt); | |
| 1779 yaffs_mkdir(sub,0); | |
| 1780 | |
| 1781 | |
| 1782 p = (j & 0) ? mountpt: sub; | |
| 1783 | |
| 1784 for(i = 0; i < 100; i++) | |
| 1785 { | |
| 1786 sprintf(fn,"%s/%d",p,i); | |
| 1787 | |
| 1788 if(i & 1) | |
| 1789 { | |
| 1790 h = yaffs_open(fn,O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE); | |
| 1791 for(k = 0; k < 1000; k++) | |
| 1792 yaffs_write(h,fn,100); | |
| 1793 yaffs_close(h); | |
| 1794 } | |
| 1795 else | |
| 1796 yaffs_mkdir(fn,0); | |
| 1797 } | |
| 1798 | |
| 1799 for(i = 0; i < 10; i++) | |
| 1800 { | |
| 1801 sprintf(fn,"%s/%d",p,i); | |
| 1802 if(i & 1) | |
| 1803 yaffs_unlink(fn); | |
| 1804 else | |
| 1805 yaffs_rmdir(fn); | |
| 1806 | |
| 1807 } | |
| 1808 | |
| 1809 yaffs_unmount(mountpt); | |
| 1810 } | |
| 1811 | |
| 1812 | |
| 1813 | |
| 1814 | |
| 1815 } | |
| 1816 | |
| 74 | 1817 |
| 1818 void write_10k(int h) | |
| 1819 { | |
| 1820 int i; | |
| 1821 const char *s="0123456789"; | |
| 1822 for(i = 0; i < 1000; i++) | |
| 1823 yaffs_write(h,s,10); | |
| 1824 | |
| 1825 } | |
| 1826 void write_200k_file(const char *fn, const char *fdel, const char *fdel1) | |
| 1827 { | |
| 1828 int h1; | |
| 1829 int i; | |
| 127 | 1830 int offs; |
| 74 | 1831 |
| 1832 h1 = yaffs_open(fn, O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE); | |
| 1833 | |
| 1834 for(i = 0; i < 100000; i+= 10000) | |
| 1835 { | |
| 1836 write_10k(h1); | |
| 1837 } | |
| 1838 | |
| 127 | 1839 offs = yaffs_lseek(h1,0,SEEK_CUR); |
| 1840 if( offs != 100000) | |
| 74 | 1841 { |
| 1842 printf("Could not write file\n"); | |
| 1843 } | |
| 1844 | |
| 1845 yaffs_unlink(fdel); | |
| 1846 for(i = 0; i < 100000; i+= 10000) | |
| 1847 { | |
| 1848 write_10k(h1); | |
| 1849 } | |
| 1850 | |
| 127 | 1851 offs = yaffs_lseek(h1,0,SEEK_CUR); |
| 1852 if( offs != 200000) | |
| 74 | 1853 { |
| 1854 printf("Could not write file\n"); | |
| 1855 } | |
| 1856 | |
| 1857 yaffs_close(h1); | |
| 1858 yaffs_unlink(fdel1); | |
| 1859 | |
| 1860 } | |
| 1861 | |
|
91
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1862 |
| 74 | 1863 void verify_200k_file(const char *fn) |
| 1864 { | |
| 1865 int h1; | |
| 1866 int i; | |
| 1867 char x[11]; | |
| 1868 const char *s="0123456789"; | |
| 127 | 1869 int errCount = 0; |
| 74 | 1870 |
| 1871 h1 = yaffs_open(fn, O_RDONLY, 0); | |
| 1872 | |
| 127 | 1873 for(i = 0; i < 200000 && errCount < 10; i+= 10) |
| 74 | 1874 { |
| 1875 yaffs_read(h1,x,10); | |
| 1876 if(strncmp(x,s,10) != 0) | |
| 1877 { | |
| 127 | 1878 printf("File %s verification failed at %d\n",fn,i); |
| 1879 errCount++; | |
| 74 | 1880 } |
| 1881 } | |
| 127 | 1882 if(errCount >= 10) |
| 1883 printf("Too many errors... aborted\n"); | |
| 74 | 1884 |
|
91
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
1885 yaffs_close(h1); |
| 74 | 1886 |
| 1887 } | |
| 1888 | |
| 1889 | |
| 1890 void check_resize_gc_bug(const char *mountpt) | |
| 1891 { | |
| 1892 | |
| 1893 char a[30]; | |
| 1894 char b[30]; | |
| 1895 char c[30]; | |
| 1896 | |
| 1897 int i; | |
| 1898 | |
| 1899 sprintf(a,"%s/a",mountpt); | |
| 1900 sprintf(b,"%s/b",mountpt); | |
| 1901 sprintf(c,"%s/c",mountpt); | |
| 1902 | |
| 1903 | |
| 1904 | |
| 1905 | |
| 1906 yaffs_StartUp(); | |
| 1907 yaffs_mount(mountpt); | |
| 1908 yaffs_unlink(a); | |
| 1909 yaffs_unlink(b); | |
| 1910 | |
| 1911 for(i = 0; i < 50; i++) | |
| 1912 { | |
| 1913 printf("A\n");write_200k_file(a,"",c); | |
| 1914 printf("B\n");verify_200k_file(a); | |
| 1915 printf("C\n");write_200k_file(b,a,c); | |
| 1916 printf("D\n");verify_200k_file(b); | |
| 1917 yaffs_unmount(mountpt); | |
| 1918 yaffs_mount(mountpt); | |
| 1919 printf("E\n");verify_200k_file(a); | |
| 1920 printf("F\n");verify_200k_file(b); | |
| 1921 } | |
| 1922 | |
| 1923 } | |
| 1924 | |
| 1925 | |
| 127 | 1926 void multi_mount_test(const char *mountpt,int nmounts) |
| 1927 { | |
| 1928 | |
| 1929 char a[30]; | |
| 1930 | |
| 1931 int i; | |
| 1932 int j; | |
| 1933 | |
| 1934 sprintf(a,"%s/a",mountpt); | |
| 1935 | |
| 1936 yaffs_StartUp(); | |
| 1937 | |
| 1938 for(i = 0; i < nmounts; i++){ | |
| 151 | 1939 int h0; |
| 1940 int h1; | |
| 154 | 1941 int len0; |
| 1942 int len1; | |
| 1943 | |
| 151 | 1944 static char xx[1000]; |
| 1945 | |
| 127 | 1946 printf("############### Iteration %d Start\n",i); |
| 151 | 1947 if(1 || i == 0 || i == 5) |
| 1948 yaffs_mount(mountpt); | |
| 127 | 1949 |
| 1950 dump_directory_tree(mountpt); | |
| 1951 | |
| 151 | 1952 |
| 1953 yaffs_mkdir(a,0); | |
| 1954 | |
| 1955 sprintf(xx,"%s/0",a); | |
| 1956 h0 = yaffs_open(xx, O_RDWR | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE); | |
| 1957 | |
| 1958 sprintf(xx,"%s/1",a); | |
| 1959 h1 = yaffs_open(xx, O_RDWR | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE); | |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
1960 |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
1961 #if 0 |
| 151 | 1962 for(j = 0; j < 200; j++){ |
| 1963 yaffs_write(h0,xx,1000); | |
| 1964 yaffs_write(h1,xx,1000); | |
| 1965 } | |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
1966 #else |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
1967 while(yaffs_write(h0,xx,1000) > 0){ |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
1968 |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
1969 yaffs_write(h1,xx,1000); |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
1970 } |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
1971 #endif |
| 154 | 1972 len0 = yaffs_lseek(h0,0,SEEK_END); |
| 1973 len1 = yaffs_lseek(h1,0,SEEK_END); | |
| 1974 | |
| 1975 yaffs_lseek(h0,0,SEEK_SET); | |
| 1976 yaffs_lseek(h1,0,SEEK_SET); | |
| 1977 | |
| 1978 for(j = 0; j < 200; j++){ | |
| 1979 yaffs_read(h0,xx,1000); | |
| 1980 yaffs_read(h1,xx,1000); | |
| 1981 } | |
| 1982 | |
| 1983 | |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
1984 // yaffs_truncate(h0,0); |
| 151 | 1985 yaffs_close(h0); |
| 1986 yaffs_close(h1); | |
| 1987 | |
| 1988 printf("########### %d\n",i); | |
| 1989 dump_directory_tree(mountpt); | |
| 1990 | |
| 1991 if(1 || i == 4 || i == nmounts -1) | |
| 1992 yaffs_unmount(mountpt); | |
| 127 | 1993 } |
| 1994 } | |
| 1995 | |
| 1996 | |
| 161 | 1997 void small_mount_test(const char *mountpt,int nmounts) |
| 1998 { | |
| 1999 | |
| 2000 char a[30]; | |
| 2001 | |
| 2002 int i; | |
| 2003 int j; | |
| 2004 | |
| 2005 int h0; | |
| 2006 int h1; | |
| 2007 int len0; | |
| 2008 int len1; | |
| 2009 int nread; | |
| 2010 | |
| 2011 sprintf(a,"%s/a",mountpt); | |
| 2012 | |
| 2013 yaffs_StartUp(); | |
| 2014 | |
| 2015 | |
| 2016 | |
| 2017 for(i = 0; i < nmounts; i++){ | |
| 2018 | |
| 2019 static char xx[1000]; | |
| 2020 | |
| 2021 printf("############### Iteration %d Start\n",i); | |
| 2022 if(1 || i == 0 || i == 5) | |
| 2023 yaffs_mount(mountpt); | |
| 2024 | |
| 2025 dump_directory_tree(mountpt); | |
| 2026 | |
| 2027 yaffs_mkdir(a,0); | |
| 2028 | |
| 2029 sprintf(xx,"%s/0",a); | |
| 2030 if(i ==0){ | |
| 2031 | |
| 2032 h0 = yaffs_open(xx, O_RDWR | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE); | |
| 2033 for(j = 0; j < 130; j++) | |
| 2034 yaffs_write(h0,xx,1000); | |
| 2035 yaffs_close(h0); | |
| 2036 } | |
| 2037 | |
| 2038 h0 = yaffs_open(xx,O_RDONLY,0); | |
| 2039 | |
| 2040 sprintf(xx,"%s/1",a); | |
| 2041 h1 = yaffs_open(xx, O_RDWR | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE); | |
| 2042 | |
| 2043 while((nread = yaffs_read(h0,xx,1000)) > 0) | |
| 2044 yaffs_write(h1,xx,nread); | |
| 2045 | |
| 2046 | |
| 2047 len0 = yaffs_lseek(h0,0,SEEK_END); | |
| 2048 len1 = yaffs_lseek(h1,0,SEEK_END); | |
| 2049 | |
| 2050 yaffs_lseek(h0,0,SEEK_SET); | |
| 2051 yaffs_lseek(h1,0,SEEK_SET); | |
| 2052 | |
| 2053 for(j = 0; j < 200; j++){ | |
| 2054 yaffs_read(h0,xx,1000); | |
| 2055 yaffs_read(h1,xx,1000); | |
| 2056 } | |
| 2057 | |
| 2058 yaffs_close(h0); | |
| 2059 yaffs_close(h1); | |
| 2060 | |
| 2061 printf("########### %d\n",i); | |
| 2062 dump_directory_tree(mountpt); | |
| 2063 | |
| 2064 if(1 || i == 4 || i == nmounts -1) | |
| 2065 yaffs_unmount(mountpt); | |
| 2066 } | |
| 2067 } | |
| 2068 | |
| 2069 | |
|
162
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2070 int early_exit; |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2071 |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2072 void small_overwrite_test(const char *mountpt,int nmounts) |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2073 { |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2074 |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2075 char a[30]; |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2076 int i; |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2077 int j; |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2078 |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2079 int h0; |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2080 int h1; |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2081 |
|
162
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2082 |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2083 sprintf(a,"%s/a",mountpt); |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2084 |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2085 yaffs_StartUp(); |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2086 |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2087 |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2088 |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2089 for(i = 0; i < nmounts; i++){ |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2090 |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2091 static char xx[8000]; |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2092 |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2093 printf("############### Iteration %d Start\n",i); |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2094 if(1) |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2095 yaffs_mount(mountpt); |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2096 |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2097 dump_directory_tree(mountpt); |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2098 |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2099 yaffs_mkdir(a,0); |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2100 |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2101 sprintf(xx,"%s/0",a); |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2102 h0 = yaffs_open(xx, O_RDWR | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE); |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2103 sprintf(xx,"%s/1",a); |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2104 h1 = yaffs_open(xx, O_RDWR | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE); |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2105 |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2106 for(j = 0; j < 1000000; j+=1000){ |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2107 yaffs_ftruncate(h0,j); |
|
162
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2108 yaffs_lseek(h0,j,SEEK_SET); |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2109 yaffs_write(h0,xx,7000); |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2110 yaffs_write(h1,xx,7000); |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2111 |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2112 if(early_exit) |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2113 exit(0); |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2114 } |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2115 |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2116 yaffs_close(h0); |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2117 |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2118 printf("########### %d\n",i); |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2119 dump_directory_tree(mountpt); |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2120 |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2121 if(1) |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2122 yaffs_unmount(mountpt); |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2123 } |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2124 } |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2125 |
|
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2126 |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2127 void seek_overwrite_test(const char *mountpt,int nmounts) |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2128 { |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2129 |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2130 char a[30]; |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2131 |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2132 int i; |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2133 int j; |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2134 |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2135 int h0; |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2136 |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2137 |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2138 sprintf(a,"%s/f",mountpt); |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2139 |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2140 yaffs_StartUp(); |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2141 |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2142 yaffs_mount(mountpt); |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2143 |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2144 |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2145 for(i = 0; i < nmounts; i++){ |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2146 |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2147 h0 = yaffs_open(a, O_RDWR | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE); |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2148 |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2149 for(j = 0; j < 100000; j++){ |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2150 yaffs_lseek(h0,0,SEEK_SET); |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2151 yaffs_write(h0,xx,5000); |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2152 yaffs_lseek(h0,0x100000,SEEK_SET); |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2153 yaffs_write(h0,xx,5000); |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2154 |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2155 if(early_exit) |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2156 exit(0); |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2157 } |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2158 |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2159 yaffs_close(h0); |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2160 |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2161 } |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2162 } |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2163 |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2164 |
| 131 | 2165 void yaffs_touch(const char *fn) |
| 2166 { | |
| 2167 yaffs_chmod(fn, S_IREAD | S_IWRITE); | |
| 2168 } | |
| 2169 | |
| 2170 void checkpoint_fill_test(const char *mountpt,int nmounts) | |
| 2171 { | |
| 2172 | |
| 2173 char a[50]; | |
| 2174 char b[50]; | |
| 2175 char c[50]; | |
| 2176 | |
| 2177 int i; | |
| 2178 int j; | |
| 2179 int h; | |
| 2180 | |
| 2181 sprintf(a,"%s/a",mountpt); | |
| 2182 | |
| 2183 | |
| 2184 | |
| 2185 | |
| 2186 yaffs_StartUp(); | |
| 2187 | |
| 2188 for(i = 0; i < nmounts; i++){ | |
| 2189 printf("############### Iteration %d Start\n",i); | |
| 2190 yaffs_mount(mountpt); | |
| 2191 dump_directory_tree(mountpt); | |
| 2192 yaffs_mkdir(a,0); | |
| 2193 | |
| 2194 sprintf(b,"%s/zz",a); | |
| 2195 | |
| 2196 h = yaffs_open(b,O_CREAT | O_RDWR,S_IREAD |S_IWRITE); | |
| 2197 | |
| 2198 | |
| 2199 while(yaffs_write(h,c,50) == 50){} | |
| 2200 | |
| 2201 yaffs_close(h); | |
| 2202 | |
|
132
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2203 for(j = 0; j < 2; j++){ |
| 131 | 2204 printf("touch %d\n",j); |
| 2205 yaffs_touch(b); | |
| 2206 yaffs_unmount(mountpt); | |
| 2207 yaffs_mount(mountpt); | |
| 2208 } | |
| 2209 | |
| 2210 dump_directory_tree(mountpt); | |
| 2211 yaffs_unmount(mountpt); | |
| 2212 } | |
| 2213 } | |
| 2214 | |
| 2215 | |
|
132
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2216 int make_file2(const char *name1, const char *name2,int syz) |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2217 { |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2218 |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2219 char xx[2500]; |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2220 int i; |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2221 int h1=-1,h2=-1; |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2222 int n = 1; |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2223 |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2224 |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2225 if(name1) |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2226 h1 = yaffs_open(name1,O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2227 if(name2) |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2228 h2 = yaffs_open(name2,O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2229 |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2230 while(syz > 0 && n > 0){ |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2231 i = (syz > 2500) ? 2500 : syz; |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2232 n = yaffs_write(h1,xx,i); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2233 n = yaffs_write(h2,xx,i); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2234 syz -= 500; |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2235 } |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2236 yaffs_close(h1); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2237 yaffs_close(h2); |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2238 return 0; |
|
132
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2239 } |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2240 |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2241 |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2242 extern void SetCheckpointReservedBlocks(int n); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2243 |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2244 void checkpoint_upgrade_test(const char *mountpt,int nmounts) |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2245 { |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2246 |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2247 char a[50]; |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2248 char b[50]; |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2249 char c[50]; |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2250 char d[50]; |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2251 |
|
132
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2252 int j; |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2253 |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2254 sprintf(a,"%s/a",mountpt); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2255 |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2256 |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2257 |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2258 |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2259 printf("Create start condition\n"); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2260 yaffs_StartUp(); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2261 SetCheckpointReservedBlocks(0); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2262 yaffs_mount(mountpt); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2263 yaffs_mkdir(a,0); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2264 sprintf(b,"%s/zz",a); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2265 sprintf(c,"%s/xx",a); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2266 make_file2(b,c,2000000); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2267 sprintf(d,"%s/aa",a); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2268 make_file2(d,NULL,500000000); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2269 dump_directory_tree(mountpt); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2270 |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2271 printf("Umount/mount attempt full\n"); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2272 yaffs_unmount(mountpt); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2273 |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2274 SetCheckpointReservedBlocks(10); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2275 yaffs_mount(mountpt); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2276 |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2277 printf("unlink small file\n"); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2278 yaffs_unlink(c); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2279 dump_directory_tree(mountpt); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2280 |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2281 printf("Umount/mount attempt\n"); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2282 yaffs_unmount(mountpt); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2283 yaffs_mount(mountpt); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2284 |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2285 for(j = 0; j < 500; j++){ |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2286 printf("***** touch %d\n",j); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2287 dump_directory_tree(mountpt); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2288 yaffs_touch(b); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2289 yaffs_unmount(mountpt); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2290 yaffs_mount(mountpt); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2291 } |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2292 |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2293 for(j = 0; j < 500; j++){ |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2294 printf("***** touch %d\n",j); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2295 dump_directory_tree(mountpt); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2296 yaffs_touch(b); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2297 yaffs_unmount(mountpt); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2298 yaffs_mount(mountpt); |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2299 } |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2300 } |
|
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2301 |
|
146
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2302 void huge_array_test(const char *mountpt,int n) |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2303 { |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2304 |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2305 char a[50]; |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2306 |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2307 |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2308 int i; |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2309 int space; |
|
146
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2310 |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2311 int fnum; |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2312 |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2313 sprintf(a,"mount point %s",mountpt); |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2314 |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2315 |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2316 |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2317 yaffs_StartUp(); |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2318 |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2319 yaffs_mount(mountpt); |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2320 |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2321 while(n>0){ |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2322 n--; |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2323 fnum = 0; |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2324 printf("\n\n START run\n\n"); |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2325 while((space = yaffs_freespace(mountpt)) > 25000000){ |
|
146
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2326 sprintf(a,"%s/file%d",mountpt,fnum); |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2327 fnum++; |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2328 printf("create file %s, free space %d\n",a,space); |
|
146
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2329 create_file_of_size(a,10000000); |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2330 printf("verifying file %s\n",a); |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2331 verify_file_of_size(a,10000000); |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2332 } |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2333 |
| 151 | 2334 printf("\n\n verification/deletion\n\n"); |
|
146
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2335 |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2336 for(i = 0; i < fnum; i++){ |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2337 sprintf(a,"%s/file%d",mountpt,i); |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2338 printf("verifying file %s\n",a); |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2339 verify_file_of_size(a,10000000); |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2340 printf("deleting file %s\n",a); |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2341 yaffs_unlink(a); |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2342 } |
| 151 | 2343 printf("\n\n done \n\n"); |
|
146
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2344 |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2345 |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2346 } |
|
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2347 } |
|
176
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2348 |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2349 |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2350 void random_write(int h) |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2351 { |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2352 static char buffer[12000]; |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2353 int n; |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2354 |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2355 n = random() & 0x1FFF; |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2356 yaffs_write(h,buffer,n); |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2357 } |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2358 |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2359 void random_seek(int h) |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2360 { |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2361 int n; |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2362 n = random() & 0xFFFFF; |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2363 yaffs_lseek(h,n,SEEK_SET); |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2364 } |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2365 |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2366 void random_truncate(int h, char * name) |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2367 { |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2368 int n; |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2369 int flen; |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2370 n = random() & 0xFFFFF; |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2371 flen = yaffs_lseek(h,0,SEEK_END); |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2372 if(n > flen) |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2373 n = flen / 2; |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2374 yaffs_ftruncate(h,n); |
|
176
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2375 yaffs_lseek(h,n,SEEK_SET); |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2376 } |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2377 |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2378 |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2379 #define NSMALLFILES 10 |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2380 void random_small_file_test(const char *mountpt,int iterations) |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2381 { |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2382 |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2383 char a[NSMALLFILES][50]; |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2384 |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2385 |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2386 int i; |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2387 int n; |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2388 int h[NSMALLFILES]; |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2389 int r; |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2390 |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2391 |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2392 yaffs_StartUp(); |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2393 |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2394 yaffs_mount(mountpt); |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2395 |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2396 for(i = 0; i < NSMALLFILES; i++){ |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2397 h[i]=-1; |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2398 strcpy(a[i],""); |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2399 } |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2400 |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2401 for(n = 0; n < iterations; n++){ |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2402 |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2403 for(i = 0; i < NSMALLFILES; i++) { |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2404 r = random(); |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2405 |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2406 if(strlen(a[i]) == 0){ |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2407 sprintf(a[i],"%s/%dx%d",mountpt,n,i); |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2408 h[i] = yaffs_open(a[i],O_RDWR | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE); |
|
176
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2409 } |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2410 |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2411 if(h[i] < -1) |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2412 printf("Could not open yaffs file %d %d error %d\n",n,i,h[i]); |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2413 else { |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2414 r = r & 7; |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2415 switch(r){ |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2416 case 0: |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2417 case 1: |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2418 case 2: |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2419 random_write(h[i]); |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2420 break; |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2421 case 3: |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2422 random_truncate(h[i],a[i]); |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2423 break; |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2424 case 4: |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2425 case 5: random_seek(h[i]); |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2426 break; |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2427 case 6: |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2428 yaffs_close(h[i]); |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2429 h[i] = -1; |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2430 break; |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2431 case 7: |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2432 yaffs_close(h[i]); |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2433 yaffs_unlink(a[i]); |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2434 strcpy(a[i],""); |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2435 h[i] = -1; |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2436 } |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2437 } |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2438 } |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2439 |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2440 } |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2441 |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2442 for(i = 0; i < NSMALLFILES; i++) |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2443 yaffs_close(h[i]); |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2444 |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2445 yaffs_unmount(mountpt); |
|
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2446 } |
| 234 | 2447 |
| 2448 void rmdir_test(const char *mountpt) | |
| 2449 { | |
| 2450 char name[100]; | |
| 2451 yaffs_StartUp(); | |
| 2452 | |
| 2453 yaffs_mount(mountpt); | |
| 2454 | |
| 2455 strcpy(name,mountpt); | |
| 2456 strcat(name,"/"); | |
| 2457 strcat(name,"hello"); | |
| 2458 yaffs_mkdir(name,0666); | |
| 2459 yaffs_rmdir(name); | |
| 2460 yaffs_unmount(mountpt); | |
| 2461 } | |
|
146
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2462 |
|
132
f0d1a05787e4
Fix problem with checkpoint free space handling
charles <charles>
parents:
131
diff
changeset
|
2463 |
|
230
7da3205ba874
Tweaks to nor stress simulation. Save random seed so that we can do better debugging
charles <charles>
parents:
224
diff
changeset
|
2464 int random_seed; |
| 234 | 2465 int simulate_power_failure; |
| 131 | 2466 |
| 1 | 2467 int main(int argc, char *argv[]) |
| 2468 { | |
|
230
7da3205ba874
Tweaks to nor stress simulation. Save random seed so that we can do better debugging
charles <charles>
parents:
224
diff
changeset
|
2469 random_seed = time(NULL); |
| 1 | 2470 //return long_test(argc,argv); |
| 2471 | |
| 2472 //return cache_read_test(); | |
| 2473 | |
|
210
8a4f31e59ad8
Some cleanups, Linux 2.6.25 handling, fix handing of root permissions
charles <charles>
parents:
208
diff
changeset
|
2474 // resize_stress_test_no_grow("/flash/flash",20); |
|
8a4f31e59ad8
Some cleanups, Linux 2.6.25 handling, fix handing of root permissions
charles <charles>
parents:
208
diff
changeset
|
2475 //root_perm_remount("/flash/flash"); |
| 17 | 2476 |
| 2477 //huge_directory_test_on_path("/ram2k"); | |
| 1 | 2478 |
| 123 | 2479 //yaffs_backward_scan_test("/flash/flash"); |
| 127 | 2480 // yaffs_device_flush_test("/flash/flash"); |
| 123 | 2481 |
| 234 | 2482 //rename_over_test("//////////////////flash///////////////////yaffs1///////////"); |
| 2483 | |
|
286
179e9b69f377
Fix 2 problems: rmdir of non-empty dir, handling 255 char names better
charles <charles>
parents:
284
diff
changeset
|
2484 //fill_empty_files_test("/yaffs2/"); |
| 337 | 2485 //long_name_test("/yaffs2"); |
| 339 | 2486 //link_test0("/yaffs2"); |
| 2487 //link_test1("yaffs2"); | |
| 17 | 2488 //scan_pattern_test("/flash",10000,10); |
| 127 | 2489 //short_scan_test("/flash/flash",40000,200); |
|
162
5d6744904e2c
Fix issue with rescan of pending retired blocks
charles <charles>
parents:
161
diff
changeset
|
2490 //small_mount_test("/flash/flash",1000); |
|
176
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2491 //small_overwrite_test("/flash/flash",1000); |
|
204
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2492 //seek_overwrite_test("/flash/flash",1000); |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2493 //checkpoint_fill_test("/flash/flash",20); |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2494 //checkpoint_upgrade_test("/flash/flash",20); |
|
0f70320a2274
Check in inband tags, some extra yaffs direct functions and some other changes
charles <charles>
parents:
193
diff
changeset
|
2495 //small_overwrite_test("/flash/flash",1000); |
|
176
570d9d4cac30
Adding checkpoint and robustness improvements
charles <charles>
parents:
171
diff
changeset
|
2496 //checkpoint_fill_test("/flash/flash",20); |
| 193 | 2497 // random_small_file_test("/flash/flash",10000); |
| 151 | 2498 // huge_array_test("/flash/flash",10); |
|
146
1a32267ef1c1
Add large NAND support and improve retirement handling
charles <charles>
parents:
132
diff
changeset
|
2499 |
| 127 | 2500 |
| 339 | 2501 handle_test("yaffs2/"); |
| 1 | 2502 |
| 17 | 2503 //long_test_on_path("/ram2k"); |
| 74 | 2504 // long_test_on_path("/flash"); |
| 119 | 2505 //simple_rw_test("/flash/flash"); |
| 2506 //fill_disk_test("/flash/flash"); | |
|
91
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
2507 // rename_over_test("/flash"); |
|
07a42c94dda5
Improve YDI lookup and device prefic handling
charles <charles>
parents:
74
diff
changeset
|
2508 //lookup_test("/flash"); |
| 119 | 2509 //freespace_test("/flash/flash"); |
| 2510 | |
| 123 | 2511 //link_test("/flash/flash"); |
| 119 | 2512 |
| 1 | 2513 |
| 17 | 2514 |
| 1 | 2515 |
| 2516 // cache_bypass_bug_test(); | |
| 2517 | |
| 17 | 2518 //free_space_check(); |
| 1 | 2519 |
| 74 | 2520 //check_resize_gc_bug("/flash"); |
| 2521 | |
| 1 | 2522 return 0; |
| 2523 | |
| 2524 } |
