33b93e71b91e5a2caaac08796f0da4919e8663da
[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
6
7 How to add a test
8         First create the test .c and .h file.
9         The file name and test function name should be the same. 
10         This name should follow one of these formats: 
11         Test_yaffs_[function of yaffs which is been tested]
12         Test_yaffs_[function of yaffs which is been tested]_[error trying to be generated]
13         
14         The .c file needs to contain two functions.
15         The first function needs to contain the code for the main test and will return -1 on a failure and 0 or greater on a success.
16         The second function needs contain the code for cleaning up after the test. Cleaning up may include closing some open handles, recreating a file, ect. 
17         This second function needs to return -1 on a failure and 0 or greater on success.
18
19         The name of first function needs to be called the same as the file name (without the .c or .h)
20         The second function's name needs be the same as the first function but with "_clean" added on the end.
21         
22         So if a test is been created for the yaffs function yaffs_fish() then create these files
23         Test_yaffs_fish.c
24                 Contains int test_yaffs_fish(void); int test_yaffs_fish_clean(void);
25         Test_yaffs_fish.h
26                 Which includes "lib.h", "yaffsfs.h" header files.
27
28         Next write the test code in these files then add these files to the Makefile.
29
30         Add the name of the test files' object file (test_yaffs_fish.o ) to the TESTFILES tag around line 50 of the Makefile.   
31
32
33
34         Now add the test functions to the test_list[] array in quick_tests.h
35         The order of the tests matters. The idea is to test each yaffs_function individualy and only using tested yaffs_components before using this new yaffs_function. 
36         This array consists of: {[test function], [the clean function], [name of the tests which will be printed when the test fails]}, 
37         
38         So add this line to the test_list[]: {test_yaffs_fish, test_yaffs_fish_clean, "test_yaffs_fish"},
39
40         Also include the test's .h file in the quick_test.h file: #include "test_yaffs_fish.h"
41
42         The test file should now make and run. 
43         
44         
45         
46
47
48
49         PS: yaffs_fish() is a made up function for this README (in case you want to try and find this function in yaffs). 
50
51
52 BUGS
53         Needing to include int random_seed; and int simulate_power_failure = 0; in any main program using yaffsfs.h
54         ENOSPC error in programs test_yaffs_open_ENOTDIR and test_yaffs_open_ENOENT.
55         ENOENT been returned by yaffs_read but the handle is good and the yaffs_open function does not return an error.
56
57
58
59