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