yaffs Still chasing the bug.
authorTimothy Manning <tfhmanning@gmail.com>
Wed, 3 Nov 2010 02:22:56 +0000 (15:22 +1300)
committerTimothy Manning <tfhmanning@gmail.com>
Wed, 3 Nov 2010 03:27:09 +0000 (16:27 +1300)
test_yaffs_write is not writing to the file.
when the file is wred it returns a ENOENT error.
Signed-off-by: Timothy Manning <tfhmanning@gmail.com>
direct/timothy_tests/quick_tests/Makefile
direct/timothy_tests/quick_tests/quick_tests.c
direct/timothy_tests/quick_tests/quick_tests.h
direct/timothy_tests/quick_tests/test_yaffs_read.c
direct/timothy_tests/quick_tests/test_yaffs_write.c

index f240695630bc735860c7dd74a1dfe071fe1103ec..8b1cdc18e527bbf0e97793a4ccbca5fbbf87883f 100644 (file)
@@ -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)
 
 
 
index 6a65287109fff15bf258917c3a809e8900f39f16..61168be9f3d82dc69649dec869d737b0724e938d 100644 (file)
@@ -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);
 }
 
index 70c9d06207a40f51f53a53a312113d914e112947..6a6ffad96ce710555f3d19dcf3dd00a893f7723c 100644 (file)
 #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);
index d396ff607efa8075169568411b2b55dfb0bf9724..41cc07f5399165db56bcc40e45fff837dcaf1320 100644 (file)
@@ -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;
                        }
                }
index 08ff7659aee5fe0ea27a950fb82fd1fb7469776e..336473c223ef4bdc61c4b2d971d25969de5bebeb 100644 (file)
@@ -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;
+       }
 }