yaffs Found and fixed the bugs in quick tests.
authorTimothy Manning <tfhmanning@gmail.com>
Sun, 7 Nov 2010 21:12:35 +0000 (10:12 +1300)
committerTimothy Manning <tfhmanning@gmail.com>
Sun, 7 Nov 2010 23:43:06 +0000 (12:43 +1300)
Signed-off-by: Timothy Manning <tfhmanning@gmail.com>
direct/timothy_tests/quick_tests/quick_tests.c
direct/timothy_tests/quick_tests/test_yaffs_ftruncate.c
direct/timothy_tests/quick_tests/test_yaffs_lseek.c
direct/timothy_tests/quick_tests/test_yaffs_open_ENAMETOOLONG.c
direct/timothy_tests/quick_tests/test_yaffs_truncate.c

index 71a11f8..2415082 100644 (file)
@@ -31,7 +31,7 @@ int main(){
 
        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)));
@@ -50,6 +50,7 @@ int main(){
                        num_of_tests_failed ++; 
 
                        if (EXIT_ON_ERROR){
+                               get_error();
                                printf("\n\n");
                                quit_quick_tests(1);
                        }
@@ -79,9 +80,6 @@ void quit_quick_tests(int exit_code){
        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);
index fec910d..a6d661b 100644 (file)
@@ -16,7 +16,7 @@
 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 {
@@ -28,7 +28,7 @@ int test_yaffs_ftruncate(void){
 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);
index 5e063ef..588635e 100644 (file)
@@ -18,7 +18,7 @@ int test_yaffs_lseek(void){
        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;
                }
index e896abc..44fd562 100644 (file)
@@ -33,7 +33,7 @@ int test_yaffs_open_ENAMETOOLONG(void){
 
 
        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);
@@ -46,6 +46,7 @@ int test_yaffs_open_ENAMETOOLONG(void){
                }
        }
        else if (output >=0){
+               printf("handle %d \n",handle);
                printf("non existant file opened.(which is a bad thing)\n");
                return -1;
        }
index 1b19bd5..c1ae528 100644 (file)
@@ -16,7 +16,7 @@ static int handle=0;
 
 int test_yaffs_truncate(void){
        handle=test_yaffs_open();
-       if (handle>0){
+       if (handle>=0){
                return yaffs_truncate(FILE_PATH,FILE_SIZE_TRUNCATED );
        }
        else {
@@ -27,9 +27,8 @@ int test_yaffs_truncate(void){
 
 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);