From: Timothy Manning Date: Wed, 3 Nov 2010 02:22:56 +0000 (+1300) Subject: yaffs Still chasing the bug. X-Git-Tag: linux-mainline-patchset-4~121 X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=commitdiff_plain;h=98fdd77e12f7a14163568906da90b11f90f9f3e8 yaffs Still chasing the bug. test_yaffs_write is not writing to the file. when the file is wred it returns a ENOENT error. Signed-off-by: Timothy Manning --- diff --git a/direct/timothy_tests/quick_tests/Makefile b/direct/timothy_tests/quick_tests/Makefile index f240695..8b1cdc1 100644 --- a/direct/timothy_tests/quick_tests/Makefile +++ b/direct/timothy_tests/quick_tests/Makefile @@ -47,9 +47,10 @@ COMMONTESTOBJS = yaffscfg2k.o yaffs_ecc.o yaffs_fileem.o yaffs_fileem2k.o yaffsf YAFFSTESTOBJS = $(COMMONTESTOBJS) quick_tests.o lib.o test_mount_yaffs.o test_yaffs_unlinking.o test_open_file.o test_yaffs_ftruncate.o test_yaffs_truncate.o \ test_yaffs_write.o test_yaffs_read.o test_yaffs_lseek.o test_yaffs_access.o test_yaffs_stat.o +PYTONOSYMLINKS = yaffs_error_converter.c yaffs_error_converter.h +PYTHONOBJS = yaffs_error_converter.o - -ALLOBJS = $(sort $(YAFFSTESTOBJS)) +ALLOBJS = $(sort $(YAFFSTESTOBJS)) $(PYTHONOBJS) YAFFSSYMLINKS = devextras.h yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yportenv.h yaffs_tagscompat.c yaffs_tagscompat.h \ yaffs_packedtags1.c yaffs_packedtags1.h yaffs_packedtags2.c yaffs_packedtags2.h \ @@ -74,7 +75,7 @@ DIRECTEXTRASYMLINKS = yaffscfg2k.c yaffs_fileem2k.c yaffs_fileem2k.h\ yaffs_ramdisk.c yaffs_ramdisk.h yaffs_ramem2k.c \ ynorsim.h ynorsim.c -SYMLINKS = $(YAFFSSYMLINKS) $(YAFFSDIRECTSYMLINKS) $(DIRECTEXTRASYMLINKS) +SYMLINKS = $(YAFFSSYMLINKS) $(YAFFSDIRECTSYMLINKS) $(DIRECTEXTRASYMLINKS) $(PYTONOSYMLINKS) #all: directtest2k boottest all: quick_tests @@ -82,6 +83,8 @@ all: quick_tests $(ALLOBJS): %.o: %.c gcc -c $(CFLAGS) -o $@ $< +$(PYTONOSYMLINKS): + ln -s ../../python/$@ $@ $(YAFFSSYMLINKS): ln -s ../../../$@ $@ @@ -93,8 +96,8 @@ $(DIRECTEXTRASYMLINKS): ln -s ../../basic-test/$@ $@ -quick_tests: $(SYMLINKS) $(YAFFSTESTOBJS) - gcc $(CFLLAG) -o $@ $(YAFFSTESTOBJS) +quick_tests: $(SYMLINKS) $(ALLOBJS) + gcc $(CFLLAG) -o $@ $(ALLOBJS) diff --git a/direct/timothy_tests/quick_tests/quick_tests.c b/direct/timothy_tests/quick_tests/quick_tests.c index 6a65287..61168be 100644 --- a/direct/timothy_tests/quick_tests/quick_tests.c +++ b/direct/timothy_tests/quick_tests/quick_tests.c @@ -1,6 +1,6 @@ #include "quick_tests.h" -#include "yaffsfs.h" + int random_seed; int simulate_power_failure = 0; @@ -37,8 +37,9 @@ test_template test_list[]={ {test_yaffs_unlinking, test_yaffs_unlinking_clean,"test_yaffs_unlinking"}, {test_yaffs_lseek,test_yaffs_lseek_clean,"test_yaffs_lseek"}, - {test_yaffs_read,test_yaffs_read_clean,"test_yaffs_read"}, {test_yaffs_write,test_yaffs_write_clean,"test_yaffs_write"}, + {test_yaffs_read,test_yaffs_read_clean,"test_yaffs_read"}, + {test_yaffs_stat,test_yaffs_stat_clean,"test_yaffs_stat"}, {test_yaffs_ftruncate,test_yaffs_ftruncate_clean,"test_yaffs_ftruncate"}, @@ -92,10 +93,17 @@ int main(){ } void quit_quick_tests(int exit_code){ + int error_code=0; if (num_of_tests_pass==total_number_of_tests && num_of_tests_failed==0){ printf("\t OK \n"); } + else { + error_code=yaffs_get_error(); + printf("yaffs_error code %d\n",error_code); + printf("error is : %s\n",yaffs_error_to_str(error_code)); + } 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/quick_tests.h b/direct/timothy_tests/quick_tests/quick_tests.h index 70c9d06..6a6ffad 100644 --- a/direct/timothy_tests/quick_tests/quick_tests.h +++ b/direct/timothy_tests/quick_tests/quick_tests.h @@ -12,6 +12,11 @@ #include "test_yaffs_lseek.h" #include "test_yaffs_access.h" #include "test_yaffs_stat.h" +#include "yaffsfs.h" +#include "yaffs_error_converter.h" +#include "lib.h" + + #define YAFFS_MOUNT_POINT "/yaffs2/" void init_quick_tests(void); diff --git a/direct/timothy_tests/quick_tests/test_yaffs_read.c b/direct/timothy_tests/quick_tests/test_yaffs_read.c index d396ff6..41cc07f 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_read.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_read.c @@ -1,18 +1,20 @@ -#include "test_yaffs_write.h" +#include "test_yaffs_read.h" int test_yaffs_read(void){ int handle=test_open_file(); char text[20]="\0"; int output=0; + printf("handle %d\n",handle); if (handle>0){ output=yaffs_read(handle, text, FILE_TEXT_NBYTES); - printf("output: %d\n",output); + printf("yaffs_test_read output: %d\n",output); + printf("text in file is: %s\n",text); if (output>0){ if (text==FILE_TEXT){ return 1; } else { - printf("text does not match the the text that should be in the file\n"); + printf("returned text does not match the the expected text that should be in the file\n"); return -1; } } diff --git a/direct/timothy_tests/quick_tests/test_yaffs_write.c b/direct/timothy_tests/quick_tests/test_yaffs_write.c index 08ff765..336473c 100644 --- a/direct/timothy_tests/quick_tests/test_yaffs_write.c +++ b/direct/timothy_tests/quick_tests/test_yaffs_write.c @@ -13,6 +13,10 @@ int test_yaffs_write(void){ } int test_yaffs_write_clean(void){ - test_yaffs_lseek_to_beginning(); - return 1; + if (0==test_yaffs_lseek_to_beginning()){ + return 1; + } + else { + return -1; + } }