From 121c055437f23d9d6bc7b57d36ecf128b447013f Mon Sep 17 00:00:00 2001 From: Timothy Manning Date: Fri, 16 Dec 2011 13:28:52 +1300 Subject: [PATCH] Have updated yaffs direct tests and added README files to the tests. Signed-off-by: Timothy Manning --- direct/timothy_tests/handle_tests/Makefile | 6 +- direct/timothy_tests/handle_tests/README.txt | 7 ++ .../is_yaffs_working_tests/Makefile | 115 ++++++++++++++++++ .../is_yaffs_working_tests/README.txt | 11 ++ .../test_1_yaffs_mount.c | 97 +++++++++++++++ direct/timothy_tests/linux_tests/Makefile | 15 ++- direct/timothy_tests/linux_tests/README.txt | 26 +++- direct/timothy_tests/linux_tests/linux_test.c | 4 + .../mirror_tests/current_bugs.txt | 5 - direct/timothy_tests/quick_tests/Makefile | 10 +- direct/timothy_tests/quick_tests/README.txt | 16 ++- .../quick_tests/current_bugs.txt | 28 ----- .../{dev => stress_tester}/Makefile | 6 +- direct/timothy_tests/stress_tester/README.txt | 8 ++ .../{dev => stress_tester}/error_handler.c | 0 .../{dev => stress_tester}/error_handler.h | 0 .../{dev => stress_tester}/message_buffer.c | 0 .../{dev => stress_tester}/message_buffer.h | 0 .../{dev => stress_tester}/yaffs_tester.c | 23 ++-- .../{dev => stress_tester}/yaffs_tester.h | 2 +- direct/timothy_tests/threading/Makefile | 6 +- direct/timothy_tests/threading/README.txt | 12 ++ .../Makefile | 6 +- .../README.txt | 23 ++-- .../lib.c | 0 .../lib.h | 0 .../linux_test_open.c | 0 .../linux_test_open.h | 0 .../linux_test_truncate.c | 0 .../linux_test_truncate.h | 0 .../linux_test_unlink.c | 0 .../linux_test_unlink.h | 0 .../linux_test_write.c | 0 .../linux_test_write.h | 0 .../mirror_tests.c | 0 .../mirror_tests.h | 0 .../yaffs_test_open.c | 0 .../yaffs_test_open.h | 0 .../yaffs_test_truncate.c | 0 .../yaffs_test_truncate.h | 0 .../yaffs_test_unlink.c | 0 .../yaffs_test_unlink.h | 0 .../yaffs_test_write.c | 0 .../yaffs_test_write.h | 0 44 files changed, 352 insertions(+), 74 deletions(-) create mode 100644 direct/timothy_tests/handle_tests/README.txt create mode 100644 direct/timothy_tests/is_yaffs_working_tests/Makefile create mode 100644 direct/timothy_tests/is_yaffs_working_tests/README.txt create mode 100644 direct/timothy_tests/is_yaffs_working_tests/test_1_yaffs_mount.c delete mode 100644 direct/timothy_tests/mirror_tests/current_bugs.txt delete mode 100644 direct/timothy_tests/quick_tests/current_bugs.txt rename direct/timothy_tests/{dev => stress_tester}/Makefile (96%) create mode 100644 direct/timothy_tests/stress_tester/README.txt rename direct/timothy_tests/{dev => stress_tester}/error_handler.c (100%) rename direct/timothy_tests/{dev => stress_tester}/error_handler.h (100%) rename direct/timothy_tests/{dev => stress_tester}/message_buffer.c (100%) rename direct/timothy_tests/{dev => stress_tester}/message_buffer.h (100%) rename direct/timothy_tests/{dev => stress_tester}/yaffs_tester.c (96%) rename direct/timothy_tests/{dev => stress_tester}/yaffs_tester.h (97%) create mode 100644 direct/timothy_tests/threading/README.txt rename direct/timothy_tests/{mirror_tests => yaffs_and_linux_mirror_tests}/Makefile (96%) rename direct/timothy_tests/{mirror_tests => yaffs_and_linux_mirror_tests}/README.txt (51%) rename direct/timothy_tests/{mirror_tests => yaffs_and_linux_mirror_tests}/lib.c (100%) rename direct/timothy_tests/{mirror_tests => yaffs_and_linux_mirror_tests}/lib.h (100%) rename direct/timothy_tests/{mirror_tests => yaffs_and_linux_mirror_tests}/linux_test_open.c (100%) rename direct/timothy_tests/{mirror_tests => yaffs_and_linux_mirror_tests}/linux_test_open.h (100%) rename direct/timothy_tests/{mirror_tests => yaffs_and_linux_mirror_tests}/linux_test_truncate.c (100%) rename direct/timothy_tests/{mirror_tests => yaffs_and_linux_mirror_tests}/linux_test_truncate.h (100%) rename direct/timothy_tests/{mirror_tests => yaffs_and_linux_mirror_tests}/linux_test_unlink.c (100%) rename direct/timothy_tests/{mirror_tests => yaffs_and_linux_mirror_tests}/linux_test_unlink.h (100%) rename direct/timothy_tests/{mirror_tests => yaffs_and_linux_mirror_tests}/linux_test_write.c (100%) rename direct/timothy_tests/{mirror_tests => yaffs_and_linux_mirror_tests}/linux_test_write.h (100%) rename direct/timothy_tests/{mirror_tests => yaffs_and_linux_mirror_tests}/mirror_tests.c (100%) rename direct/timothy_tests/{mirror_tests => yaffs_and_linux_mirror_tests}/mirror_tests.h (100%) rename direct/timothy_tests/{mirror_tests => yaffs_and_linux_mirror_tests}/yaffs_test_open.c (100%) rename direct/timothy_tests/{mirror_tests => yaffs_and_linux_mirror_tests}/yaffs_test_open.h (100%) rename direct/timothy_tests/{mirror_tests => yaffs_and_linux_mirror_tests}/yaffs_test_truncate.c (100%) rename direct/timothy_tests/{mirror_tests => yaffs_and_linux_mirror_tests}/yaffs_test_truncate.h (100%) rename direct/timothy_tests/{mirror_tests => yaffs_and_linux_mirror_tests}/yaffs_test_unlink.c (100%) rename direct/timothy_tests/{mirror_tests => yaffs_and_linux_mirror_tests}/yaffs_test_unlink.h (100%) rename direct/timothy_tests/{mirror_tests => yaffs_and_linux_mirror_tests}/yaffs_test_write.c (100%) rename direct/timothy_tests/{mirror_tests => yaffs_and_linux_mirror_tests}/yaffs_test_write.h (100%) diff --git a/direct/timothy_tests/handle_tests/Makefile b/direct/timothy_tests/handle_tests/Makefile index 8ca9c1d..a2e9a5e 100644 --- a/direct/timothy_tests/handle_tests/Makefile +++ b/direct/timothy_tests/handle_tests/Makefile @@ -42,7 +42,8 @@ COMMONTESTOBJS = yaffscfg2k.o yaffs_osglue.o yaffs_hweight.o \ yaffs_yaffs1.o \ yaffs_yaffs2.o \ yaffs_verify.o \ - yaffs_error.o + yaffs_error.o \ + yaffs_summary.o # yaffs_checkptrwtest.o\ @@ -66,7 +67,8 @@ YAFFSSYMLINKS = yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yaffs_tagscomp yaffs_yaffs1.c yaffs_yaffs1.h \ yaffs_yaffs2.c yaffs_yaffs2.h \ yaffs_bitmap.c yaffs_bitmap.h \ - yaffs_verify.c yaffs_verify.h + yaffs_verify.c yaffs_verify.h \ + yaffs_summary.c yaffs_summary.h YAFFSDIRECTSYMLINKS = yaffsfs.c yaffs_flashif.h yaffs_flashif2.h\ yaffsfs.h ydirectenv.h \ diff --git a/direct/timothy_tests/handle_tests/README.txt b/direct/timothy_tests/handle_tests/README.txt new file mode 100644 index 0000000..bce7a6c --- /dev/null +++ b/direct/timothy_tests/handle_tests/README.txt @@ -0,0 +1,7 @@ +handle_tests.c opens and closes random handles, in an effot to stress test yaffs. + +Command line options: + No commands. + +compile command: make +run command: ./handle_test diff --git a/direct/timothy_tests/is_yaffs_working_tests/Makefile b/direct/timothy_tests/is_yaffs_working_tests/Makefile new file mode 100644 index 0000000..8cc1f44 --- /dev/null +++ b/direct/timothy_tests/is_yaffs_working_tests/Makefile @@ -0,0 +1,115 @@ +# Makefile for YAFFS direct stress tests +# +# +# YAFFS: Yet another Flash File System. A NAND-flash specific file system. +# +# Copyright (C) 2003-2010 Aleph One Ltd. +# +# +# Created by Charles Manning +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# NB Warning this Makefile does not include header dependencies. +# +# $Id: Makefile,v 1.7 2010-02-25 22:34:47 charles Exp $ + +#EXTRA_COMPILE_FLAGS = -DYAFFS_IGNORE_TAGS_ECC + +CFLAGS = -DCONFIG_YAFFS_DIRECT -DCONFIG_YAFFS_YAFFS2 +CFLAGS += -DCONFIG_YAFFS_PROVIDE_DEFS -DCONFIG_YAFFSFS_PROVIDE_VALUES +CFLAGS += -Wall -g $(EXTRA_COMPILE_FLAGS) -Wstrict-aliasing +#CFLAGS += -fno-strict-aliasing +CFLAGS += -O0 +CFLAGS += -Wextra -Wpointer-arith +#CFLAGS += -DCONFIG_YAFFS_VALGRIND_TEST + +#CFLAGS+= -Wshadow -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Wmissing-declarations +#CFLAGS+= -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Winline + + +COMMONTESTOBJS = yaffscfg2k.o yaffs_osglue.o yaffs_hweight.o \ + yaffs_ecc.o yaffs_fileem.o yaffs_fileem2k.o yaffsfs.o yaffs_guts.o \ + yaffs_packedtags1.o yaffs_ramdisk.o yaffs_ramem2k.o \ + yaffs_tagscompat.o yaffs_packedtags2.o yaffs_nand.o \ + yaffs_checkptrw.o yaffs_qsort.o\ + yaffs_nameval.o yaffs_attribs.o \ + yaffs_norif1.o ynorsim.o \ + yaffs_allocator.o \ + yaffs_bitmap.o \ + yaffs_yaffs1.o \ + yaffs_yaffs2.o \ + yaffs_verify.o \ + yaffs_error.o \ + yaffs_summary.o + +# yaffs_checkptrwtest.o\ + +TESTFILES = test_1_yaffs_mount.o + + + + +YAFFSTESTOBJS = $(COMMONTESTOBJS) $(TESTFILES) + + +ALLOBJS = $(sort $(YAFFSTESTOBJS)) $(PYTHONOBJS) + +YAFFSSYMLINKS = yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yaffs_tagscompat.c yaffs_tagscompat.h \ + yaffs_packedtags1.c yaffs_packedtags1.h yaffs_packedtags2.c yaffs_packedtags2.h \ + yaffs_nand.c yaffs_nand.h yaffs_getblockinfo.h \ + yaffs_checkptrw.h yaffs_checkptrw.c \ + yaffs_nameval.c yaffs_nameval.h \ + yaffs_trace.h yaffs_attribs.h \ + yaffs_allocator.c yaffs_allocator.h \ + yaffs_yaffs1.c yaffs_yaffs1.h \ + yaffs_yaffs2.c yaffs_yaffs2.h \ + yaffs_bitmap.c yaffs_bitmap.h \ + yaffs_verify.c yaffs_verify.h \ + yaffs_summary.c yaffs_summary.h + +YAFFSDIRECTSYMLINKS = yaffsfs.c yaffs_flashif.h yaffs_flashif2.h\ + yaffsfs.h ydirectenv.h \ + yaffs_flashif.c yaffscfg.h yaffs_qsort.c \ + yaffs_nandemul2k.h yaffs_list.h \ + yaffs_attribs.c yaffs_osglue.h \ + yaffs_nandif.c yaffs_nandif.h yportenv.h \ + yaffs_hweight.h yaffs_hweight.c \ + yaffs_error.c + + +DIRECTEXTRASYMLINKS = yaffscfg2k.c yaffs_fileem2k.c yaffs_fileem2k.h\ + yaffs_fileem.c yaffs_norif1.c yaffs_norif1.h \ + yaffs_ramdisk.c yaffs_ramdisk.h yaffs_ramem2k.c \ + ynorsim.h ynorsim.c yaffs_osglue.c + +SYMLINKS = $(YAFFSSYMLINKS) $(YAFFSDIRECTSYMLINKS) $(DIRECTEXTRASYMLINKS) $(PYTONOSYMLINKS) +#all: directtest2k boottest + +all: test_1_yaffs_mount + +$(ALLOBJS): %.o: %.c + gcc -c $(CFLAGS) -o $@ $< + +$(PYTONOSYMLINKS): + ln -s ../../python/$@ $@ + +$(YAFFSSYMLINKS): + ln -s ../../../$@ $@ + +$(YAFFSDIRECTSYMLINKS): + ln -s ../../$@ $@ + +$(DIRECTEXTRASYMLINKS): + ln -s ../../basic-test/$@ $@ + + +test_1_yaffs_mount: $(SYMLINKS) $(ALLOBJS) + gcc $(CFLLAG) -o $@ $(ALLOBJS) + + + +clean: + rm -f test_1_yaffs_mount $(ALLOBJS) core $(SYMLINKS) diff --git a/direct/timothy_tests/is_yaffs_working_tests/README.txt b/direct/timothy_tests/is_yaffs_working_tests/README.txt new file mode 100644 index 0000000..0cdddbd --- /dev/null +++ b/direct/timothy_tests/is_yaffs_working_tests/README.txt @@ -0,0 +1,11 @@ +is_yaffs_working_tests folder contains the very simple tests to check that yaffs has been installed properly. + +test_1_yaffs_mount.c mounts yaffs, creates a file, unmounts and then mounts yaffs and checks that the file is still there. + + + +compile command: make +run command: ./test_1_yaffs_mount + +command line options: + No commands. diff --git a/direct/timothy_tests/is_yaffs_working_tests/test_1_yaffs_mount.c b/direct/timothy_tests/is_yaffs_working_tests/test_1_yaffs_mount.c new file mode 100644 index 0000000..b7726ba --- /dev/null +++ b/direct/timothy_tests/is_yaffs_working_tests/test_1_yaffs_mount.c @@ -0,0 +1,97 @@ +/* + * YAFFS: Yet another FFS. A NAND-flash specific file system. + * + * Copyright (C) 2002-2011 Aleph One Ltd. + * for Toby Churchill Ltd and Brightstar Engineering + * + * Created by Timothy Manning + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + + +#include "yaffsfs.h" +#define YAFFS_MOUNT_POINT "/yaffs2/" +#define FILE_PATH "/yaffs2/foo.txt" + +int random_seed; +int simulate_power_failure = 0; + + +int main() +{ + int output = 0; + int output2 = 0; + yaffs_start_up(); + + printf("\n\n starting test\n"); + yaffs_set_trace(0); + output = yaffs_mount(YAFFS_MOUNT_POINT); + + if (output>=0){ + printf("yaffs mounted: %s\n",YAFFS_MOUNT_POINT); + } else { + printf("error\n yaffs failed to mount: %s\nerror\n",YAFFS_MOUNT_POINT); + return (0); + } + //now create a file. + output = yaffs_open(FILE_PATH,O_CREAT | O_RDWR, S_IREAD | S_IWRITE); + if (output>=0){ + printf("file created: %s\n",FILE_PATH); + } else { + printf("error\n yaffs failed to create the file: %s\nerror\n",FILE_PATH); + return (0); + } + output2 = yaffs_close(output); + if (output2>=0){ + printf("file closed: %s\n",FILE_PATH); + } else { + printf("error\n yaffs failed to close the file: %s\nerror\n",FILE_PATH); + return (0); + } + //unmount and remount the mount point. + output = yaffs_unmount(YAFFS_MOUNT_POINT); + if (output>=0){ + printf("yaffs unmounted: %s\n",YAFFS_MOUNT_POINT); + } else { + printf("error\n yaffs failed to unmount: %s\nerror\n",YAFFS_MOUNT_POINT); + return (0); + } + output = yaffs_mount(YAFFS_MOUNT_POINT); + if (output>=0){ + printf("yaffs mounted: %s\n",YAFFS_MOUNT_POINT); + } else { + printf("error\n yaffs failed to mount: %s\nerror\n",YAFFS_MOUNT_POINT); + return (0); + } + //now open the existing file. + output = yaffs_open(FILE_PATH, O_RDWR, S_IREAD | S_IWRITE); + if (output>=0){ + printf("file created: %s\n",FILE_PATH); + } else { + printf("error\n yaffs failed to create the file: %s\nerror\n",FILE_PATH); + return (0); + } + //close the file. + output2 = yaffs_close(output); + if (output2>=0){ + printf("file closed: %s\n",FILE_PATH); + } else { + printf("error\n yaffs failed to close the file: %s\nerror\n",FILE_PATH); + return (0); + } + + //unmount the mount point. + output = yaffs_unmount(YAFFS_MOUNT_POINT); + if (output>=0){ + printf("yaffs unmounted: %s\n",YAFFS_MOUNT_POINT); + } else { + printf("error\n yaffs failed to unmount: %s\nerror\n",YAFFS_MOUNT_POINT); + return (0); + } + + printf("test passed. yay!\n"); + +} diff --git a/direct/timothy_tests/linux_tests/Makefile b/direct/timothy_tests/linux_tests/Makefile index 6910788..c80ef4d 100644 --- a/direct/timothy_tests/linux_tests/Makefile +++ b/direct/timothy_tests/linux_tests/Makefile @@ -33,8 +33,8 @@ CFLAGS += -Wextra -Wpointer-arith COMMONTESTOBJS = yaffscfg2k.o yaffs_osglue.o yaffs_hweight.o \ yaffs_ecc.o yaffs_fileem.o yaffs_fileem2k.o yaffsfs.o yaffs_guts.o \ yaffs_packedtags1.o yaffs_ramdisk.o yaffs_ramem2k.o \ - yaffs_tagscompat.o yaffs_packedtags2.o yaffs_tagsvalidity.o yaffs_nand.o \ - yaffs_checkptrw.o yaffs_qsort.o\ + yaffs_tagscompat.o yaffs_packedtags2.o yaffs_nand.o \ + yaffs_checkptrw.o yaffs_qsort.o \ yaffs_nameval.o yaffs_attribs.o \ yaffs_norif1.o ynorsim.o \ yaffs_allocator.o \ @@ -42,8 +42,9 @@ COMMONTESTOBJS = yaffscfg2k.o yaffs_osglue.o yaffs_hweight.o \ yaffs_yaffs1.o \ yaffs_yaffs2.o \ yaffs_verify.o \ - yaffs_error.o - + yaffs_error.o \ + yaffs_summary.o +# yaffs_tagsvalidity.o # yaffs_checkptrwtest.o\ TESTFILES = linux_test.o lib.o @@ -59,14 +60,16 @@ ALLOBJS = $(sort $(YAFFSTESTOBJS)) $(PYTHONOBJS) YAFFSSYMLINKS = yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yaffs_tagscompat.c yaffs_tagscompat.h \ yaffs_packedtags1.c yaffs_packedtags1.h yaffs_packedtags2.c yaffs_packedtags2.h \ yaffs_nand.c yaffs_nand.h yaffs_getblockinfo.h \ - yaffs_tagsvalidity.c yaffs_tagsvalidity.h yaffs_checkptrw.h yaffs_checkptrw.c \ + yaffs_checkptrw.h yaffs_checkptrw.c \ yaffs_nameval.c yaffs_nameval.h \ yaffs_trace.h yaffs_attribs.h \ yaffs_allocator.c yaffs_allocator.h \ yaffs_yaffs1.c yaffs_yaffs1.h \ yaffs_yaffs2.c yaffs_yaffs2.h \ yaffs_bitmap.c yaffs_bitmap.h \ - yaffs_verify.c yaffs_verify.h + yaffs_verify.c yaffs_verify.h \ + yaffs_summary.c yaffs_summary.h +#yaffs_tagsvalidity.c yaffs_tagsvalidity.h YAFFSDIRECTSYMLINKS = yaffsfs.c yaffs_flashif.h yaffs_flashif2.h\ yaffsfs.h ydirectenv.h \ diff --git a/direct/timothy_tests/linux_tests/README.txt b/direct/timothy_tests/linux_tests/README.txt index 0c3fa84..be8b831 100644 --- a/direct/timothy_tests/linux_tests/README.txt +++ b/direct/timothy_tests/linux_tests/README.txt @@ -1,11 +1,17 @@ +linux_test.c tests yaffs running under linux using the nandsim generator. + + +If a segmentation fault happens during the test then check that +the nandsim has been initilised properly. + How to initilise the nandsim $ make $ sudo -s ...password.. -# now have a root shell +# now you have a root shell $ ./linux-tests/initnandsim 128MiB-2048 $ insmod yaffs2multi.ko $ mkdir /mnt/y @@ -24,7 +30,19 @@ How to clean the folder $ rm -rf /mnt/y -The test must be run in sudo to work +The test must be run in sudo to work to allow the files to be +created in the root folders. -$ make -$ sudo ./linux_test +compile command: make +run command: sudo ./linux_test + +command line options: + -h display the command line options. + -s [number] seeds the rand with the number. + -p [number] sets the print level to the number. + the higher the number the more low level commands are printed. + the number should be between 0 and 5. + -v verbose mode. everything is printed. + -q quite mode. nothing is printed. + + diff --git a/direct/timothy_tests/linux_tests/linux_test.c b/direct/timothy_tests/linux_tests/linux_test.c index 429e74f..e450236 100644 --- a/direct/timothy_tests/linux_tests/linux_test.c +++ b/direct/timothy_tests/linux_tests/linux_test.c @@ -149,6 +149,10 @@ dir_struct * scan_dir(void) open_dir=opendir(ROOT_PATH); + if (open_dir < 0){ + sprintf(message,"failed to find the directory: %s",ROOT_PATH); + print_message(1,message); + } dir_data=readdir(open_dir); while(dir_data){ dir->path_list=linked_list_add_node(HEAD,dir->path_list); diff --git a/direct/timothy_tests/mirror_tests/current_bugs.txt b/direct/timothy_tests/mirror_tests/current_bugs.txt deleted file mode 100644 index 8e3251a..0000000 --- a/direct/timothy_tests/mirror_tests/current_bugs.txt +++ /dev/null @@ -1,5 +0,0 @@ - -BUGS - NO Bugs. - - diff --git a/direct/timothy_tests/quick_tests/Makefile b/direct/timothy_tests/quick_tests/Makefile index ef339c5..49ecd7a 100644 --- a/direct/timothy_tests/quick_tests/Makefile +++ b/direct/timothy_tests/quick_tests/Makefile @@ -42,8 +42,8 @@ COMMONTESTOBJS = yaffscfg2k.o yaffs_osglue.o yaffs_hweight.o \ yaffs_yaffs1.o \ yaffs_yaffs2.o \ yaffs_verify.o \ - yaffs_error.o - + yaffs_error.o \ + yaffs_summary.o # yaffs_checkptrwtest.o\ TESTFILES = quick_tests.o lib.o \ @@ -108,7 +108,8 @@ TESTFILES = quick_tests.o lib.o \ test_yaffs_lstat.o test_yaffs_lstat_ENOENT.o test_yaffs_lstat_ENOTDIR.o test_yaffs_lstat_ENAMETOOLONG.o \ test_yaffs_lstat_NULL.o \ test_yaffs_flush.o test_yaffs_flush_EBADF.o test_yaffs_flush_EROFS.o \ - test_yaffs_dup.o test_yaffs_dup_EBADF.o + test_yaffs_dup.o test_yaffs_dup_EBADF.o + @@ -127,7 +128,8 @@ YAFFSSYMLINKS = yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yaffs_tagscomp yaffs_yaffs1.c yaffs_yaffs1.h \ yaffs_yaffs2.c yaffs_yaffs2.h \ yaffs_bitmap.c yaffs_bitmap.h \ - yaffs_verify.c yaffs_verify.h + yaffs_verify.c yaffs_verify.h \ + yaffs_summary.c yaffs_summary.h YAFFSDIRECTSYMLINKS = yaffsfs.c yaffs_flashif.h yaffs_flashif2.h\ yaffsfs.h ydirectenv.h \ diff --git a/direct/timothy_tests/quick_tests/README.txt b/direct/timothy_tests/quick_tests/README.txt index 1744392..55b670e 100644 --- a/direct/timothy_tests/quick_tests/README.txt +++ b/direct/timothy_tests/quick_tests/README.txt @@ -1,6 +1,20 @@ - Made by Timothy Manning on 04/11/2010 +This test is designed to test the response and error handling of the yaffs functions. + +compile command: make +run command: ./quick_tests + +command line options: + -h prints the available command line options. + -c tests will continue even if a test fails, rather than exiting the test. + -v verbose mode. will print all messages. + -q quiet mode. will not print any messages. + -t [number] sets the yaffs_trace() function to the number. + -n [number] sets the number of randomly selected tests to run after the test has run through + after running all of listed tests. + +############################# development infomation #################################################################### Tests made diff --git a/direct/timothy_tests/quick_tests/current_bugs.txt b/direct/timothy_tests/quick_tests/current_bugs.txt deleted file mode 100644 index a8a88c4..0000000 --- a/direct/timothy_tests/quick_tests/current_bugs.txt +++ /dev/null @@ -1,28 +0,0 @@ - -Made by Timothy Manning on 08/11/2010 - - -Current BUGS - - -Current WARNINGS - - WARNING- If yaffs is unmounted then most of yaffs' functions return ENODIR. - But some function return EBADF instead. - Functions which return ENOTDIR: open, close, access, unlink, lseek, write, read - - Functions which return ENOENT: access, stat - - - - WARNING-the function yaffs_open does not check the mode passed to it. - This means that yaffs open does not return EINVAL if a bad mode is passed to it. - However this causes the error EEXIST to happen instead, because both O_CREAT and O_EXCL flags are set. - - WARNING- yaffs_open will work with either of the two mode set to 255. - However there are only 4 or 5 flags that can be set for each of the modes. - This means that the programmer may not be setting the flags properly. - - WARNING- When mounting a non-existing mount point the error ENODEV is returned. - The quick tests have been altered to accommodate this error code. - With standard access function in linux the error returned is ENOENT. diff --git a/direct/timothy_tests/dev/Makefile b/direct/timothy_tests/stress_tester/Makefile similarity index 96% rename from direct/timothy_tests/dev/Makefile rename to direct/timothy_tests/stress_tester/Makefile index 6e774ab..b6d8cf8 100644 --- a/direct/timothy_tests/dev/Makefile +++ b/direct/timothy_tests/stress_tester/Makefile @@ -40,7 +40,8 @@ COMMONTESTOBJS = yaffscfg2k.o yaffs_osglue.o yaffs_hweight.o\ yaffs_bitmap.o \ yaffs_yaffs1.o \ yaffs_yaffs2.o \ - yaffs_verify.o + yaffs_verify.o \ + yaffs_summary.o SSCOMMONTESTOBJS = yaffscfg2k.o yaffs_ecc.o yaffs_fileem.o yaffs_fileem2k.o yaffsfs.o yaffs_guts.o \ @@ -73,7 +74,8 @@ YAFFSSYMLINKS = yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yaffs_tagscomp yaffs_yaffs1.c yaffs_yaffs1.h \ yaffs_yaffs2.c yaffs_yaffs2.h \ yaffs_bitmap.c yaffs_bitmap.h \ - yaffs_verify.c yaffs_verify.h + yaffs_verify.c yaffs_verify.h \ + yaffs_summary.c yaffs_summary.h YAFFSDIRECTSYMLINKS = yaffsfs.c yaffs_flashif.h yaffs_flashif2.h\ yaffsfs.h yaffs_osglue.h ydirectenv.h \ diff --git a/direct/timothy_tests/stress_tester/README.txt b/direct/timothy_tests/stress_tester/README.txt new file mode 100644 index 0000000..364d975 --- /dev/null +++ b/direct/timothy_tests/stress_tester/README.txt @@ -0,0 +1,8 @@ +The stress_tester program opens and closes files at random in an effort to break yaffs. + +compile command: make +run command: ./yaffs_tester + +command line options: + -seed [number] sets the random seed generator to the number. + diff --git a/direct/timothy_tests/dev/error_handler.c b/direct/timothy_tests/stress_tester/error_handler.c similarity index 100% rename from direct/timothy_tests/dev/error_handler.c rename to direct/timothy_tests/stress_tester/error_handler.c diff --git a/direct/timothy_tests/dev/error_handler.h b/direct/timothy_tests/stress_tester/error_handler.h similarity index 100% rename from direct/timothy_tests/dev/error_handler.h rename to direct/timothy_tests/stress_tester/error_handler.h diff --git a/direct/timothy_tests/dev/message_buffer.c b/direct/timothy_tests/stress_tester/message_buffer.c similarity index 100% rename from direct/timothy_tests/dev/message_buffer.c rename to direct/timothy_tests/stress_tester/message_buffer.c diff --git a/direct/timothy_tests/dev/message_buffer.h b/direct/timothy_tests/stress_tester/message_buffer.h similarity index 100% rename from direct/timothy_tests/dev/message_buffer.h rename to direct/timothy_tests/stress_tester/message_buffer.h diff --git a/direct/timothy_tests/dev/yaffs_tester.c b/direct/timothy_tests/stress_tester/yaffs_tester.c similarity index 96% rename from direct/timothy_tests/dev/yaffs_tester.c rename to direct/timothy_tests/stress_tester/yaffs_tester.c index 65d2d17..86dcf46 100644 --- a/direct/timothy_tests/dev/yaffs_tester.c +++ b/direct/timothy_tests/stress_tester/yaffs_tester.c @@ -171,7 +171,7 @@ void open_random_file(char *yaffs_test_dir, handle_regster *P_open_handles_array { generate_random_string(name,MAX_FILE_NAME_SIZE); printf("before %d %d %d\n",strlen(yaffs_test_dir),strlen(name),strlen(path)); - join_paths(yaffs_test_dir,name,path);//bug###################### here + join_paths(yaffs_test_dir,name,path); printf("after %d %d %d\n",strlen(yaffs_test_dir),strlen(name),strlen(path)); add_to_buffer(&message_buffer,"trying to open file: ",MESSAGE_LEVEL_BASIC_TASKS,NPRINT); append_to_buffer(&message_buffer,path,MESSAGE_LEVEL_BASIC_TASKS,PRINT); @@ -202,7 +202,7 @@ void open_random_file(char *yaffs_test_dir, handle_regster *P_open_handles_array P_open_handles_array->number_of_open_handles++; } - else close_random_file(P_open_handles_array); + else close_random_file(P_open_handles_array); } @@ -271,11 +271,17 @@ void close_random_file(handle_regster *P_open_handles_array){ int x=0; int output=0; int start=0; + printf("trying to clear handle"); if (P_open_handles_array->number_of_open_handles>0){ start=rand() % (MAX_NUMBER_OF_OPENED_HANDLES-1); - for (x=start;P_open_handles_array->handle[x] !=-3 &&(x+1>start ||xstart ||xMAX_NUMBER_OF_OPENED_HANDLES-1) x=0; + if (x>MAX_NUMBER_OF_OPENED_HANDLES-1) x=0; + if (P_open_handles_array->handle[x] !=-3 ){ + //the handle is open, so try to close it. + break; + } } if (P_open_handles_array->handle[x]!=-3) @@ -341,14 +347,17 @@ void test(char*yaffs_test_dir){ open_handles_array.path[x][0]='\0'; } + while(1) { + x=rand() % 3; + printf("running test: %d",x); switch(x){ case 0 :open_random_file(yaffs_test_dir,&open_handles_array);break; - //case 1 :write_to_random_file(&open_handles_array);break; - case 2 :close_random_file(&open_handles_array);break; - case 3 :truncate_random_file(&open_handles_array);break; + case 3 :write_to_random_file(&open_handles_array);break; +// case 1 :close_random_file(&open_handles_array);break; + case 2 :truncate_random_file(&open_handles_array);break; } } } diff --git a/direct/timothy_tests/dev/yaffs_tester.h b/direct/timothy_tests/stress_tester/yaffs_tester.h similarity index 97% rename from direct/timothy_tests/dev/yaffs_tester.h rename to direct/timothy_tests/stress_tester/yaffs_tester.h index a703175..11a0815 100644 --- a/direct/timothy_tests/dev/yaffs_tester.h +++ b/direct/timothy_tests/stress_tester/yaffs_tester.h @@ -25,7 +25,7 @@ #include "message_buffer.h" #include "error_handler.h" -#define MAX_NUMBER_OF_OPENED_HANDLES 50 +#define MAX_NUMBER_OF_OPENED_HANDLES 70 #define MAX_FILE_NAME_SIZE 51 typedef struct handle_regster_template{ diff --git a/direct/timothy_tests/threading/Makefile b/direct/timothy_tests/threading/Makefile index e733471..cb3c1e4 100644 --- a/direct/timothy_tests/threading/Makefile +++ b/direct/timothy_tests/threading/Makefile @@ -42,7 +42,8 @@ COMMONTESTOBJS = yaffscfg2k.o yaffs_osglue.o yaffs_hweight.o \ yaffs_yaffs1.o \ yaffs_yaffs2.o \ yaffs_verify.o \ - yaffs_error.o + yaffs_error.o \ + yaffs_summary.o # yaffs_checkptrwtest.o\ @@ -65,7 +66,8 @@ YAFFSSYMLINKS = yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yaffs_tagscomp yaffs_yaffs1.c yaffs_yaffs1.h \ yaffs_yaffs2.c yaffs_yaffs2.h \ yaffs_bitmap.c yaffs_bitmap.h \ - yaffs_verify.c yaffs_verify.h + yaffs_verify.c yaffs_verify.h \ + yaffs_summary.c yaffs_summary.h YAFFSDIRECTSYMLINKS = yaffsfs.c yaffs_flashif.h yaffs_flashif2.h\ yaffsfs.h ydirectenv.h \ diff --git a/direct/timothy_tests/threading/README.txt b/direct/timothy_tests/threading/README.txt new file mode 100644 index 0000000..68c1a61 --- /dev/null +++ b/direct/timothy_tests/threading/README.txt @@ -0,0 +1,12 @@ +Created by Timothy Manning on 7/01/11 + +This test is designed to test the locking ability of yaffs functions. + +compile command: make +run command: ./threading + + +command line arguments are: + -h displays the help contents + -t sets the number of threads + diff --git a/direct/timothy_tests/mirror_tests/Makefile b/direct/timothy_tests/yaffs_and_linux_mirror_tests/Makefile similarity index 96% rename from direct/timothy_tests/mirror_tests/Makefile rename to direct/timothy_tests/yaffs_and_linux_mirror_tests/Makefile index 05e41f4..0ba8539 100644 --- a/direct/timothy_tests/mirror_tests/Makefile +++ b/direct/timothy_tests/yaffs_and_linux_mirror_tests/Makefile @@ -42,7 +42,8 @@ COMMONTESTOBJS = yaffscfg2k.o yaffs_osglue.o yaffs_hweight.o \ yaffs_yaffs1.o \ yaffs_yaffs2.o \ yaffs_verify.o \ - yaffs_error.o + yaffs_error.o \ + yaffs_summary.o # yaffs_checkptrwtest.o\ @@ -70,7 +71,8 @@ YAFFSSYMLINKS = yaffs_ecc.c yaffs_ecc.h yaffs_guts.c yaffs_guts.h yaffs_tagscomp yaffs_yaffs1.c yaffs_yaffs1.h \ yaffs_yaffs2.c yaffs_yaffs2.h \ yaffs_bitmap.c yaffs_bitmap.h \ - yaffs_verify.c yaffs_verify.h + yaffs_verify.c yaffs_verify.h \ + yaffs_summary.c yaffs_summary.h YAFFSDIRECTSYMLINKS = yaffsfs.c yaffs_flashif.h yaffs_flashif2.h\ yaffsfs.h ydirectenv.h \ diff --git a/direct/timothy_tests/mirror_tests/README.txt b/direct/timothy_tests/yaffs_and_linux_mirror_tests/README.txt similarity index 51% rename from direct/timothy_tests/mirror_tests/README.txt rename to direct/timothy_tests/yaffs_and_linux_mirror_tests/README.txt index 1edc620..2c03959 100644 --- a/direct/timothy_tests/mirror_tests/README.txt +++ b/direct/timothy_tests/yaffs_and_linux_mirror_tests/README.txt @@ -1,4 +1,4 @@ -Made by Timothy Manning on 24/12/10 +Made by Timothy Manning on 24/12/2010 mirror_tests is designed to check that yaffs behaves the same way as linux. @@ -11,14 +11,17 @@ Made by Timothy Manning on 24/12/10 rm test/*;rmdir test/;./mirror_tests -n 100 -v +compile command: make +run command: mirror_tests + Command line arguments - -yaffs_path [PATH] //sets the path for yaffs. - -linux_path [PATH] //sets the path for linux. - -p [NUMBER] //sets the print level for mirror_tests. - -v //verbose mode everything is printed - -q //quiet mode nothing is printed. - -n [number] //sets the number of random tests to run. - -s [number] //seeds rand with the number - -t [number] //sets yaffs_trace to the number - -clean //removes emfile and test dir + -yaffs_path [PATH] sets the path for yaffs. + -linux_path [PATH] sets the path for linux. + -p [NUMBER] sets the print level for mirror_tests. + -v verbose mode everything is printed + -q quiet mode nothing is printed. + -n [number] sets the number of random tests to run. + -s [number] seeds rand with the number + -t [number] sets yaffs_trace to the number + -clean removes emfile and test dir diff --git a/direct/timothy_tests/mirror_tests/lib.c b/direct/timothy_tests/yaffs_and_linux_mirror_tests/lib.c similarity index 100% rename from direct/timothy_tests/mirror_tests/lib.c rename to direct/timothy_tests/yaffs_and_linux_mirror_tests/lib.c diff --git a/direct/timothy_tests/mirror_tests/lib.h b/direct/timothy_tests/yaffs_and_linux_mirror_tests/lib.h similarity index 100% rename from direct/timothy_tests/mirror_tests/lib.h rename to direct/timothy_tests/yaffs_and_linux_mirror_tests/lib.h diff --git a/direct/timothy_tests/mirror_tests/linux_test_open.c b/direct/timothy_tests/yaffs_and_linux_mirror_tests/linux_test_open.c similarity index 100% rename from direct/timothy_tests/mirror_tests/linux_test_open.c rename to direct/timothy_tests/yaffs_and_linux_mirror_tests/linux_test_open.c diff --git a/direct/timothy_tests/mirror_tests/linux_test_open.h b/direct/timothy_tests/yaffs_and_linux_mirror_tests/linux_test_open.h similarity index 100% rename from direct/timothy_tests/mirror_tests/linux_test_open.h rename to direct/timothy_tests/yaffs_and_linux_mirror_tests/linux_test_open.h diff --git a/direct/timothy_tests/mirror_tests/linux_test_truncate.c b/direct/timothy_tests/yaffs_and_linux_mirror_tests/linux_test_truncate.c similarity index 100% rename from direct/timothy_tests/mirror_tests/linux_test_truncate.c rename to direct/timothy_tests/yaffs_and_linux_mirror_tests/linux_test_truncate.c diff --git a/direct/timothy_tests/mirror_tests/linux_test_truncate.h b/direct/timothy_tests/yaffs_and_linux_mirror_tests/linux_test_truncate.h similarity index 100% rename from direct/timothy_tests/mirror_tests/linux_test_truncate.h rename to direct/timothy_tests/yaffs_and_linux_mirror_tests/linux_test_truncate.h diff --git a/direct/timothy_tests/mirror_tests/linux_test_unlink.c b/direct/timothy_tests/yaffs_and_linux_mirror_tests/linux_test_unlink.c similarity index 100% rename from direct/timothy_tests/mirror_tests/linux_test_unlink.c rename to direct/timothy_tests/yaffs_and_linux_mirror_tests/linux_test_unlink.c diff --git a/direct/timothy_tests/mirror_tests/linux_test_unlink.h b/direct/timothy_tests/yaffs_and_linux_mirror_tests/linux_test_unlink.h similarity index 100% rename from direct/timothy_tests/mirror_tests/linux_test_unlink.h rename to direct/timothy_tests/yaffs_and_linux_mirror_tests/linux_test_unlink.h diff --git a/direct/timothy_tests/mirror_tests/linux_test_write.c b/direct/timothy_tests/yaffs_and_linux_mirror_tests/linux_test_write.c similarity index 100% rename from direct/timothy_tests/mirror_tests/linux_test_write.c rename to direct/timothy_tests/yaffs_and_linux_mirror_tests/linux_test_write.c diff --git a/direct/timothy_tests/mirror_tests/linux_test_write.h b/direct/timothy_tests/yaffs_and_linux_mirror_tests/linux_test_write.h similarity index 100% rename from direct/timothy_tests/mirror_tests/linux_test_write.h rename to direct/timothy_tests/yaffs_and_linux_mirror_tests/linux_test_write.h diff --git a/direct/timothy_tests/mirror_tests/mirror_tests.c b/direct/timothy_tests/yaffs_and_linux_mirror_tests/mirror_tests.c similarity index 100% rename from direct/timothy_tests/mirror_tests/mirror_tests.c rename to direct/timothy_tests/yaffs_and_linux_mirror_tests/mirror_tests.c diff --git a/direct/timothy_tests/mirror_tests/mirror_tests.h b/direct/timothy_tests/yaffs_and_linux_mirror_tests/mirror_tests.h similarity index 100% rename from direct/timothy_tests/mirror_tests/mirror_tests.h rename to direct/timothy_tests/yaffs_and_linux_mirror_tests/mirror_tests.h diff --git a/direct/timothy_tests/mirror_tests/yaffs_test_open.c b/direct/timothy_tests/yaffs_and_linux_mirror_tests/yaffs_test_open.c similarity index 100% rename from direct/timothy_tests/mirror_tests/yaffs_test_open.c rename to direct/timothy_tests/yaffs_and_linux_mirror_tests/yaffs_test_open.c diff --git a/direct/timothy_tests/mirror_tests/yaffs_test_open.h b/direct/timothy_tests/yaffs_and_linux_mirror_tests/yaffs_test_open.h similarity index 100% rename from direct/timothy_tests/mirror_tests/yaffs_test_open.h rename to direct/timothy_tests/yaffs_and_linux_mirror_tests/yaffs_test_open.h diff --git a/direct/timothy_tests/mirror_tests/yaffs_test_truncate.c b/direct/timothy_tests/yaffs_and_linux_mirror_tests/yaffs_test_truncate.c similarity index 100% rename from direct/timothy_tests/mirror_tests/yaffs_test_truncate.c rename to direct/timothy_tests/yaffs_and_linux_mirror_tests/yaffs_test_truncate.c diff --git a/direct/timothy_tests/mirror_tests/yaffs_test_truncate.h b/direct/timothy_tests/yaffs_and_linux_mirror_tests/yaffs_test_truncate.h similarity index 100% rename from direct/timothy_tests/mirror_tests/yaffs_test_truncate.h rename to direct/timothy_tests/yaffs_and_linux_mirror_tests/yaffs_test_truncate.h diff --git a/direct/timothy_tests/mirror_tests/yaffs_test_unlink.c b/direct/timothy_tests/yaffs_and_linux_mirror_tests/yaffs_test_unlink.c similarity index 100% rename from direct/timothy_tests/mirror_tests/yaffs_test_unlink.c rename to direct/timothy_tests/yaffs_and_linux_mirror_tests/yaffs_test_unlink.c diff --git a/direct/timothy_tests/mirror_tests/yaffs_test_unlink.h b/direct/timothy_tests/yaffs_and_linux_mirror_tests/yaffs_test_unlink.h similarity index 100% rename from direct/timothy_tests/mirror_tests/yaffs_test_unlink.h rename to direct/timothy_tests/yaffs_and_linux_mirror_tests/yaffs_test_unlink.h diff --git a/direct/timothy_tests/mirror_tests/yaffs_test_write.c b/direct/timothy_tests/yaffs_and_linux_mirror_tests/yaffs_test_write.c similarity index 100% rename from direct/timothy_tests/mirror_tests/yaffs_test_write.c rename to direct/timothy_tests/yaffs_and_linux_mirror_tests/yaffs_test_write.c diff --git a/direct/timothy_tests/mirror_tests/yaffs_test_write.h b/direct/timothy_tests/yaffs_and_linux_mirror_tests/yaffs_test_write.h similarity index 100% rename from direct/timothy_tests/mirror_tests/yaffs_test_write.h rename to direct/timothy_tests/yaffs_and_linux_mirror_tests/yaffs_test_write.h -- 2.30.2