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>
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 \
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
$(ALLOBJS): %.o: %.c
gcc -c $(CFLAGS) -o $@ $<
+$(PYTONOSYMLINKS):
+ ln -s ../../python/$@ $@
$(YAFFSSYMLINKS):
ln -s ../../../$@ $@
ln -s ../../basic-test/$@ $@
-quick_tests: $(SYMLINKS) $(YAFFSTESTOBJS)
- gcc $(CFLLAG) -o $@ $(YAFFSTESTOBJS)
+quick_tests: $(SYMLINKS) $(ALLOBJS)
+ gcc $(CFLLAG) -o $@ $(ALLOBJS)
#include "quick_tests.h"
-#include "yaffsfs.h"
+
int random_seed;
int simulate_power_failure = 0;
{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"},
}
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);
}
#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);
-#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;
}
}
}
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;
+ }
}