51344782d0da30aa90e6ff76017bb5d10c71802c
[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        //when the mode is incorrect.
14         test_yaffs_access_ENOTDIR
15         test_yaffs_access_ENOENT
16
17         test_yaffs_close_EBADF
18         test_yaffs_ftruncate
19         test_yaffs_lseek
20
21         test_yaffs_open
22         test_yaffs_open_EEXIST
23         test_yaffs_open_EISDIR
24         test_yaffs_open_ENAMETOOLONG
25         test_yaffs_open_ENOENT
26         test_yaffs_open_ENOTDIR
27
28         test_yaffs_read
29         test_yaffs_stat
30
31         test_yaffs_truncate
32         test_yaffs_truncate_ENOTDIR
33         test_yaffs_truncate_EISDIR
34         test_yaffs_truncate_ENOENT
35         test_yaffs_truncate_ENIVAL
36
37         test_yaffs_unlink
38         test_yaffs_unlink_EISDIR
39         test_yaffs_unlink_ENAMETOOLONG
40         test_yaffs_unlink_ENOENT
41         test_yaffs_unlink_ENOTDIR
42         test_yaffs_unlink_ENOENT
43
44         test_yaffs_unmount
45         test_yaffs_write
46
47
48 Tests to add
49         test_yaffs_mount_EACCES         //Cannot be generated with yaffs.
50         test_yaffs_mount_EINVAL         //Cannot be generated with yaffs.
51         test_yaffs_mount_ELOOP          //Cannot be generated with yaffs.
52         test_yaffs_mount_EMFILE         //Cannot be generated with yaffs.
53         test_yaffs_mount_ENOTDIR        //Cannot be generated with yaffs.
54
55         test_yaffs_umount_ENODEV
56         test_yaffs_umount_ENAMETOOLONG
57         test_yaffs_umount_ENOENT
58         test_yaffs_umount_EBUSY
59
60         test_yaffs_open_EACCES
61         test_yaffs_open_ENOSPC
62         test_yaffs_open_ELOOP   //Too many symbolic links were encountered in resolving pathname
63         test yaffs_open_running_out_of_handles error
64
65         test_yaffs_close        //This function has already been called by the time this test is reached. 
66
67         test_yaffs_unlink_EACCES
68         test_yaffs_unlink_ELOOP
69         test_yaffs_unlink_ENOMEM
70
71         test_yaffs_access_EACCESS
72         test_yaffs_access_ELOOP
73         test_yaffs_access_ENAMETOOLONG
74         test_yaffs_access_ENOENT_generated_with_a_dangling_symbloic_link
75
76         test_yaffs_ftruncate_EACCES
77         test_yaffs_ftruncate_EFBIG
78         test_yaffs_ftruncate_ENIVAL
79         test_yaffs_ftruncate_EISDIR
80         test_yaffs_ftruncate_ELOOP
81         test_yaffs_ftruncate_ENOENT
82         test_yaffs_ftruncate_ENOTDIR
83         test_yaffs_ftruncate_EPERM
84
85         test_yaffs_truncate_EACCES
86         test_yaffs_truncate_EFBIG
87         test_yaffs_truncate_ELOOP
88         test_yaffs_truncate_ENAMETOOLONG
89         test_yaffs_truncate_EPERM
90
91         check to see if an error code is generated when there isn't an error.
92
93
94 How to add a test
95         First create the test .c and .h file.
96         The file name and test function name should be the same. 
97         This name should follow one of these formats: 
98         Test_yaffs_[function of yaffs which is been tested]
99         Test_yaffs_[function of yaffs which is been tested]_[error trying to be generated]
100         
101         The .c file needs to contain two functions.
102         The first function needs to contain the code for the main test and will 
103         return -1 on a failure and 0 or greater on a success.
104         The second function needs contain the code for cleaning up after the test. 
105         Cleaning up may include closing some open handles, recreating a file, ect. 
106         This second function needs to return -1 on a failure and 0 or greater on success.
107
108         The name of first function needs to be called the same as the file 
109         name (without the .c or .h)
110         The second function's name needs be the same as the first function but 
111         with "_clean" added on the end.
112         
113         So if a test is been created for the yaffs function yaffs_foo() then 
114         create these files
115         test_yaffs_foo.c
116                 Contains int test_yaffs_foo(void); int test_yaffs_foo_clean(void);
117         test_yaffs_foo.h
118                 Which includes "lib.h", "yaffsfs.h" header files.
119
120         Next write the test code in these files then add these files to the Makefile.
121
122         Add the name of the test files' object file (test_yaffs_foo.o ) to the 
123         TESTFILES tag around line 50 of the Makefile.   
124
125         Now add the test functions to the test_list[] array in quick_tests.h
126         The order of the tests matters. The idea is to test each yaffs_function 
127         individualy and only using tested yaffs_components before using this new 
128         yaffs_function. 
129         This array consists of: 
130         {[test function], [the clean function], [name of the tests which will be printed when the test fails]}, 
131         
132         So add this line to the test_list[]: {test_yaffs_foo, test_yaffs_foo_clean, "test_yaffs_foo"},
133
134         Also include the test's .h file in the quick_test.h file: #include "test_yaffs_foo.h"
135         
136         The test file should now make and run(you may need to make clean first). 
137
138
139
140         PS: yaffs_foo() is a made up function for this README (in case you want 
141         to find this function in yaffs). 
142
143
144
145
146
147