1$Id: TODO,v 1.5 2003/09/14 04:41:45 vlg Exp $
2
3Here you find various test-related notes.
4
5There are tree kinds of tests:
6
7	- simple tests
8	- client/server tests
9	- performance tests
10
11================================================================================
12General notes
13================================================================================
14
15For every class in ASSA tested, the file name dependency is:
16
17Class....... : NAME
18Test........ : NAME_test.cpp
19Shell script : NAME.test
20
21Every test should at the minimum:
22
231) Write all of your messages to sdtout like this:
24
25	enum { TEST = USR1 };
26	...
27    m_debug_mask = TEST;
28    m_log_file = "/dev/null";
29	m_log_stdout_flag = true;
30    ...
31	DL((TEST,"... message here ... =\n"));
32
332) Announce test name with:
34
35	DL((TEST,"= Running NAME_test Test =\n"));
36
373)  Log minimum status information and return the right
38	return value (0: success, 1: error) depending
39	on the outcome of the testing. If you disable trace() in the calling
40	function (processServer()), you don't need newline to separate
41	messages, i.e.:
42
43	DL((TEST,"Testing comment match ... "));
44	...
45	if (condition occured) {
46		DL((TEST," failed to match valid section!\n"));
47		...
48	}
49	DL((TEST,"ok\n"));
50
51	The output might look like:
52
53	Testing comment match ... ok
54
55
564) New shell scripts are created by copying TEST_TEMPLAT file.
57
58================================================================================
59Client-server tests require --build-dir option.
60================================================================================
61
62For the client-server tests, client typically spans off its server side
63at some point during the test. The executables of both client and server
64are in ${topbuild_dir}/tests. The test script, however, changes directory
65to the subdirectory ${topbuild_dir}/tests/testSubDir for the duration of
66the test. The implication of this is that the client side has to
67know where the executables are and specify the full path to them.
68The test script supplies build directory path to the client via
69{--build-dir STRING} command-line argument. If abscent, the client code
70assumes that the current directory is where the executables are.
71
72===============
73= Client side =
74===============
75
76client --build-dir STRING
77
78"     --build-dir STRING  - Directory where executables are located.         \n"
79
80#include "assa/CommonUtils.h"
81
82class Client {
83public:
84	string get_build_dir () const { return m_build_dir; }
85
86private:
87	string m_build_dir;
88};
89
90Client::Client ()
91{
92	add_opt (0, "build-dir", &m_build_dir);
93}
94
95void Client::initServer ()
96{
97	if (m_build_dir.length () == 0) {
98		m_build_dir = CommonUtils::get_cwd_name ();
99	}
100	DL((APP,"build-dir = \"%s\"\n", m_build_dir.c_str ()));
101}
102
103void Client::processServer ()
104{
105	// ... somewhere in the test ...
106
107	std::string exec_name;
108	exec_name = CLIENT->get_build_dir () + "/server-side-name";
109	Fork f (Fork::KILL_ON_EXIT);
110	if (f.isChild ()) {
111		ret = execlp (exec_name.c_str (),
112					  exec_name.c_str (),
113					  "--log-file=server-side-name.log", "--mask=0x2",
114					  NULL);
115		// point of no return
116		if (ret == -1) {
117			EL((ERROR,"execlp(\"server-side-name\") failed\n"));
118		}
119		Assert_exit (false);
120	}
121}
122
123======================
124= <test>.test script =
125======================
126
127RUNTEST="${top_builddir}/tests/client-name --build-dir=${top_builddir}/tests"
128
129
130
131================================================================================
132List of all test programs and their completion status
133================================================================================
134
135[x] autoptr
136[x] glops
137[x] commonutils_test
138[x] connector_test
139[x] fdset_test
140[x] idset_test
141[x] fork_test
142[x] genserver_test
143[x] inet_address_test
144[x] logger_test
145[x] memdump_test
146[x] pidflock_test
147[x] pq_test
148[x] semaphore_test
149[x] timeval_test
150[x] rt_test
151[x] sighand_test
152[x] sighands_test
153[x] timer_queue_test
154[x] reactor_test
155[x] regexp_test
156[x] inifile_test
157
158====================
159Client/Server tests:
160====================
161[x] echoxdr_testc
162[x] echoxdr_tests
163
164[x] pipe_test
165[x] smoker
166
167[x] bufio_testc <-- still timing problem. When started with no
168[x] bufio_tests     logging enabled, always fails.
169
170==================
171Performance tests:
172==================
173[x] ttcp_assa
174[x] ttcp
175
176==================
177Need investigation
178==================
179
180[ ] uncon_udp_socket_test -	compiles, but doesn't receive UDP frame.
181