58536c97fe6b8d65b76648290478a9fcf701cef5
[yaffs2.git] / direct / timothy_tests / quick_tests / README.txt
1
2 Made by Timothy Manning <timothy@yaffs.net> on 04/11/2010
3
4
5 Tests made
6         test_yaffs_mount
7         test_yaffs_mount_ENODEV
8         test_yaffs_mount_ENAMETOOLONG
9         test_yaffs_mount_ENOENT
10         test_yaffs_mount_EBUSY          //called when trying to mount a new mount point with a mount point already mounted.
11
12         test_yaffs_access
13         test_yaffs_access_ENIVAL
14         test_yaffs_access_ENOTDIR
15         test_yaffs_access_ENOENT
16
17         test_yaffs_close_EBADF
18
19         test_yaffs_ftruncate
20         test_yaffs_ftruncate_EBADF
21         test_yaffs_ftruncate_ENIVAL
22         test_yaffs_ftruncate_EFBIG
23
24         test_yaffs_lseek
25         test_yaffs_lseek_EBADF
26         test_yaffs_lseek_EINVAL
27         test_yaffs_lseek_EFBIG
28
29         test_yaffs_open
30         test_yaffs_open_EEXIST
31         test_yaffs_open_EISDIR
32         test_yaffs_open_ENAMETOOLONG
33         test_yaffs_open_ENOENT
34         test_yaffs_open_ENOTDIR
35         test_yaffs_open_EINVAL
36         test_yaffs_open_EINVAL2 //the function open has two modes which can be set, so two tests modes are needed.
37
38         test_yaffs_read
39         test_yaffs_read_EBADF
40         test_yaffs_read_EINVAL
41
42         test_yaffs_stat
43
44         test_yaffs_truncate
45         test_yaffs_truncate_ENOTDIR
46         test_yaffs_truncate_EISDIR
47         test_yaffs_truncate_ENOENT
48         test_yaffs_truncate_ENIVAL
49         test_yaffs_truncate_EFBIG
50
51         test_yaffs_unlink
52         test_yaffs_unlink_EISDIR
53         test_yaffs_unlink_ENAMETOOLONG
54         test_yaffs_unlink_ENOENT
55         test_yaffs_unlink_ENOTDIR
56         test_yaffs_unlink_ENOENT
57
58         test_yaffs_unmount
59         test_yaffs_unmount_ENOENT
60         test_yaffs_unmount_ENAMETOOLONG
61
62         test_yaffs_write
63
64         
65
66 Tests to add
67         test_yaffs_mount_EACCES         //Cannot be generated with yaffs.
68         test_yaffs_mount_EINVAL         //Cannot be generated with yaffs.
69         test_yaffs_mount_ELOOP          //Cannot be generated with yaffs.
70         test_yaffs_mount_EMFILE         //Cannot be generated with yaffs.
71         test_yaffs_mount_ENOTDIR        //Cannot be generated with yaffs.
72
73         test_yaffs_umount_ENODEV        //Cannot be generated with yaffs.
74         test_yaffs_umount_ENOENT        //Cannot be generated with yaffs.
75         test_yaffs_umount_EBUSY         //when files are open and yaffs is unmounted.
76
77         test_yaffs_open_EACCES
78         test_yaffs_open_ENOSPC
79         test_yaffs_open_ELOOP   //Too many symbolic links were encountered in resolving pathname
80         test yaffs_open_running_out_of_handles error
81
82         test_yaffs_close        //This function has already been called by the time this test is reached.
83         
84         test_yaffs_stat_EBADF
85         test_yaffs_stat_ELOOP
86         test_yaffs_stat_EACCES
87         test_yaffs_stat_ENAMETOOLONG
88         test_yaffs_stat_ENOTDIR
89          
90         test_yaffs_read_EISDIR          //Cannot be generated with yaffs.
91         test what happens if you read off the end of the file?
92
93         test_yaffs_write_EBADF
94         test_yaffs_write_EFBIG
95         test_yaffs_write_EINVAL
96         What happens when you run out of space?
97
98         test_yaffs_unlink_EACCES
99         test_yaffs_unlink_ELOOP
100         test_yaffs_unlink_ENOMEM
101
102         test_yaffs_access_EACCESS
103         test_yaffs_access_ELOOP
104         test_yaffs_access_ENAMETOOLONG
105         test_yaffs_access_ENOENT_generated_with_a_dangling_symbloic_link
106
107         test_yaffs_ftruncate_EACCES     
108         test_yaffs_ftruncate_EISDIR     //Cannot be generated with yaffs.
109         test_yaffs_ftruncate_ELOOP      //Cannot be generated with yaffs.
110         test_yaffs_ftruncate_ENOENT     //Cannot be generated with yaffs.
111         test_yaffs_ftruncate_ENOTDIR    //Cannot be generated with yaffs.
112
113         test_yaffs_truncate_EACCES
114         test_yaffs_truncate_ELOOP
115         test_yaffs_truncate_ENAMETOOLONG
116         add a truncate function for truncating a file size to -1.
117
118         What happens if a handle is opened to a file and the file is then deleted?
119         Check to see if yaffs generates an error code for no reason.
120         What happens when a file is opened with no modes set?
121         Add a test where a directory is moved. /fluffy/box. move "fluffy" to "/fluffy/frog". 
122         What happens when yaffs is unmounted twice?
123
124         What happens when open a handle, unmount yaffs and then try to use the handle? 
125
126 How to add a test
127         First create the test .c and .h file.
128         The file name and test function name should be the same. 
129         This name should follow one of these formats: 
130         Test_yaffs_[function of yaffs which is been tested]
131         Test_yaffs_[function of yaffs which is been tested]_[error trying to be generated]
132         
133         The .c file needs to contain two functions.
134         The first function needs to contain the code for the main test and will 
135         return -1 on a failure and 0 or greater on a success.
136         The second function needs contain the code for cleaning up after the test. 
137         Cleaning up may include closing some open handles, recreating a file, ect. 
138         This second function needs to return -1 on a failure and 0 or greater on success.
139
140         The name of first function needs to be called the same as the file 
141         name (without the .c or .h)
142         The second function's name needs be the same as the first function but 
143         with "_clean" added on the end.
144         
145         So if a test is been created for the yaffs function yaffs_foo() then 
146         create these files
147         test_yaffs_foo.c
148                 Contains int test_yaffs_foo(void); int test_yaffs_foo_clean(void);
149         test_yaffs_foo.h
150                 Which includes "lib.h", "yaffsfs.h" header files.
151
152         Next write the test code in these files then add these files to the Makefile.
153
154         Add the name of the test files' object file (test_yaffs_foo.o ) to the 
155         TESTFILES tag around line 50 of the Makefile.   
156
157         Now add the test functions to the test_list[] array in quick_tests.h
158         The order of the tests matters. The idea is to test each yaffs_function 
159         individualy and only using tested yaffs_components before using this new 
160         yaffs_function. 
161         This array consists of: 
162         {[test function], [the clean function], [name of the tests which will be printed when the test fails]}, 
163         
164         So add this line to the test_list[]: {test_yaffs_foo, test_yaffs_foo_clean, "test_yaffs_foo"},
165
166         Also include the test's .h file in the quick_test.h file: #include "test_yaffs_foo.h"
167         
168         The test file should now make and run(you may need to make clean first). 
169
170
171
172         PS: yaffs_foo() is a made up function for this README (in case you want 
173         to find this function in yaffs). 
174
175
176
177
178
179