unsigned int x=0;
init_quick_tests();
- printf("\n\nrunning quick tests for yaffs\n");
+ printf("\n\nrunning quick tests for yaffs\n\n");
//printf("testing yaffs\n");
//printf("len function %d",(sizeof(test_list)/sizeof(test_template)));
num_of_tests_failed ++;
if (EXIT_ON_ERROR){
+ get_error();
printf("\n\n");
quit_quick_tests(1);
}
if (num_of_tests_pass==total_number_of_tests && num_of_tests_failed==0){
printf("\t OK \n");
}
- else {
- get_error();
- }
printf("tests: %d passed %d failed\n\n\n",num_of_tests_pass,num_of_tests_failed);
yaffs_unmount(YAFFS_MOUNT_POINT);
exit(exit_code);
static int handle=0;
int test_yaffs_ftruncate(void){
handle=test_yaffs_open();
- if (handle>0){
+ if (handle>=0){
return yaffs_ftruncate(handle,FILE_SIZE_TRUNCATED );
}
else {
int test_yaffs_ftruncate_clean(void){
/* change file size back to orignal size */
int output=0;
- if (handle>0){
+ if (handle>=0){
output=yaffs_ftruncate(handle,FILE_SIZE );
if (output>=0){
return yaffs_close(handle);
handle=test_yaffs_open();
char text[20]="\0";
int output=0;
- if (handle>0){
+ if (handle>=0){
if (0==yaffs_lseek(handle, 0, SEEK_SET)){
return 1;
}
handle=yaffs_open(file_name, O_CREAT | O_TRUNC| O_RDWR ,FILE_MODE );
- printf("handle %d \n",handle);
+
if (handle==-1){
error_code=yaffs_get_error();
//printf("ENAMETOOLONG def %d, Error code %d\n", ENAMETOOLONG,error_code);
}
}
else if (output >=0){
+ printf("handle %d \n",handle);
printf("non existant file opened.(which is a bad thing)\n");
return -1;
}
int test_yaffs_truncate(void){
handle=test_yaffs_open();
- if (handle>0){
+ if (handle>=0){
return yaffs_truncate(FILE_PATH,FILE_SIZE_TRUNCATED );
}
else {
int test_yaffs_truncate_clean(void){
/* change file size back to orignal size */
- int handle=test_yaffs_open();
int output=0;
- if (handle>0){
+ if (handle>=0){
output= yaffs_truncate(FILE_PATH,FILE_SIZE );
if (output>=0){
return yaffs_close(handle);