File: TODO

package info (click to toggle)
libassa 3.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 3,084 kB
  • ctags: 2,323
  • sloc: cpp: 15,641; sh: 8,704; makefile: 372; perl: 51
file content (180 lines) | stat: -rw-r--r-- 4,385 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
$Id: TODO,v 1.5 2003/09/14 04:41:45 vlg Exp $

Here you find various test-related notes.

There are tree kinds of tests:

	- simple tests
	- client/server tests
	- performance tests

================================================================================
General notes 
================================================================================

For every class in ASSA tested, the file name dependency is:

Class....... : NAME
Test........ : NAME_test.cpp
Shell script : NAME.test

Every test should at the minimum:

1) Write all of your messages to sdtout like this:

	enum { TEST = USR1 };
	...
    m_debug_mask = TEST;
    m_log_file = "/dev/null";
	m_log_stdout_flag = true;
    ...
	DL((TEST,"... message here ... =\n"));

2) Announce test name with:

	DL((TEST,"= Running NAME_test Test =\n"));

3)  Log minimum status information and return the right 
	return value (0: success, 1: error) depending
	on the outcome of the testing. If you disable trace() in the calling
	function (processServer()), you don't need newline to separate 
	messages, i.e.:

	DL((TEST,"Testing comment match ... "));
	...
	if (condition occured) {
		DL((TEST," failed to match valid section!\n"));
		...
	}
	DL((TEST,"ok\n"));

	The output might look like:

	Testing comment match ... ok

	
4) New shell scripts are created by copying TEST_TEMPLAT file.

================================================================================
Client-server tests require --build-dir option.
================================================================================

For the client-server tests, client typically spans off its server side
at some point during the test. The executables of both client and server
are in ${topbuild_dir}/tests. The test script, however, changes directory
to the subdirectory ${topbuild_dir}/tests/testSubDir for the duration of
the test. The implication of this is that the client side has to 
know where the executables are and specify the full path to them.
The test script supplies build directory path to the client via
{--build-dir STRING} command-line argument. If abscent, the client code
assumes that the current directory is where the executables are.

===============
= Client side =
===============

client --build-dir STRING

"     --build-dir STRING  - Directory where executables are located.         \n"

#include "assa/CommonUtils.h"

class Client {
public:
	string get_build_dir () const { return m_build_dir; }

private:
	string m_build_dir;
};

Client::Client () 
{
	add_opt (0, "build-dir", &m_build_dir);
}

void Client::initServer ()
{
	if (m_build_dir.length () == 0) {
		m_build_dir = CommonUtils::get_cwd_name ();
	}
	DL((APP,"build-dir = \"%s\"\n", m_build_dir.c_str ()));
}	

void Client::processServer ()
{
	// ... somewhere in the test ...

	std::string exec_name;
	exec_name = CLIENT->get_build_dir () + "/server-side-name";
	Fork f (Fork::KILL_ON_EXIT);
	if (f.isChild ()) {
		ret = execlp (exec_name.c_str (),
					  exec_name.c_str (),
					  "--log-file=server-side-name.log", "--mask=0x2", 
					  NULL);
		// point of no return
		if (ret == -1) {
			EL((ERROR,"execlp(\"server-side-name\") failed\n"));
		}
		Assert_exit (false);	
	}
}

======================
= <test>.test script =
======================

RUNTEST="${top_builddir}/tests/client-name --build-dir=${top_builddir}/tests"



================================================================================
List of all test programs and their completion status
================================================================================

[x] autoptr
[x] glops
[x] commonutils_test
[x] connector_test
[x] fdset_test
[x] idset_test
[x] fork_test
[x] genserver_test
[x] inet_address_test
[x] logger_test
[x] memdump_test
[x] pidflock_test
[x] pq_test
[x] semaphore_test
[x] timeval_test
[x] rt_test
[x] sighand_test
[x] sighands_test
[x] timer_queue_test
[x] reactor_test
[x] regexp_test
[x] inifile_test

====================
Client/Server tests:
====================
[x] echoxdr_testc
[x] echoxdr_tests

[x] pipe_test
[x] smoker

[x] bufio_testc <-- still timing problem. When started with no
[x] bufio_tests     logging enabled, always fails.

==================
Performance tests:
==================
[x] ttcp_assa
[x] ttcp

==================
Need investigation
==================

[ ] uncon_udp_socket_test -	compiles, but doesn't receive UDP frame.