From f2d4dfa2c923765689724dc8e9328017e895beb3 Mon Sep 17 00:00:00 2001 From: Timothy Manning Date: Mon, 8 Nov 2010 10:12:35 +1300 Subject: [PATCH] yaffs Found and fixed the bugs in quick tests. Signed-off-by: Timothy Manning --- direct/timothy_tests/quick_tests/quick_tests.c | 6 ++---- direct/timothy_tests/quick_tests/test_yaffs_ftruncate.c | 4 ++-- direct/timothy_tests/quick_tests/test_yaffs_lseek.c | 2 +- .../quick_tests/test_yaffs_open_ENAMETOOLONG.c | 3 ++- direct/timothy_tests/quick_tests/test_yaffs_truncate.c | 5 ++--- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/direct/timothy_tests/quick_tests/quick_tests.c b/direct/timothy_tests/quick_tests/quick_tests.c index 71a11f8..2415082 100644 --- a/direct/timothy_tests/quick_tests/quick_tests.c +++ b/direct/timothy_tests/quick_tests/quick_tests.c @@ -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); diff --git a/direct/timothy_tests/quick_tests/test_yaffs_ftruncate.c b/direct/timothy_tests/quick_tests/test_yaffs_ftruncate.c index fec910d..a6d661b 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_ftruncate.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_ftruncate.c @@ -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); diff --git a/direct/timothy_tests/quick_tests/test_yaffs_lseek.c b/direct/timothy_tests/quick_tests/test_yaffs_lseek.c index 5e063ef..588635e 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_lseek.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_lseek.c @@ -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; } diff --git a/direct/timothy_tests/quick_tests/test_yaffs_open_ENAMETOOLONG.c b/direct/timothy_tests/quick_tests/test_yaffs_open_ENAMETOOLONG.c index e896abc..44fd562 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_open_ENAMETOOLONG.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_open_ENAMETOOLONG.c @@ -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; } diff --git a/direct/timothy_tests/quick_tests/test_yaffs_truncate.c b/direct/timothy_tests/quick_tests/test_yaffs_truncate.c index 1b19bd5..c1ae528 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_truncate.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_truncate.c @@ -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); -- 2.30.2