Debian Codegraph @

doc/TESTS

raw
1 Contents
2 ========
3
4 1. Running the tests
5 1.1 Standard test procedure
6 1.2 Summary report
7 1.3 Prerequisites
8 1.3.1 Required programs
9 1.3.2 Required locales
10 1.4 Repeatability
11 1.5 Execution time
12 1.6 Testing package in designated directory
13 1.7 Pre-packaging check
14 1.8 Post-install check
15 1.9 Testing less than everything
16 1.10 Valgrind
17
18 2. Troubleshooting
19 2.1 Missing programs
20 2.2 Broken programs
21 2.3 Color name file
22 2.4 Multiple versions
23 2.5 System dependent issues
24
25 3. Reporting test failures
26
27 ------------------------------------------------------------------------------
28
29 1. Running the tests
30 ====================
31
32 1.1 Standard test procedure
33 ===========================
34
35 The recommended method of running the tests is after packaging:
36
37 make
38 make package
39 make check
40
41 To capture the output do:
42
43 make check 2>&1 | less
44
45 Or:
46
47 make check > check.log 2>&1
48
49
50
51 1.2 Summary report
52 ==================
53
54 Like most other test routines, these produce much output. A summary will
55 appear at the end:
56
57 Test summary:
58 ==================
59 SUCCESS 83
60 FAILURE 1
61 TOTAL TESTABLE 84
62 ==================
63 All tests done.
64 Sat, 08 Jun 2013 09:30:33 +0000
65 make: *** [check] Error 1
66
67
68
69 1.3 Prerequisites
70 =================
71
72 1.3.1 Required programs
73 -----------------------
74
75 The tests require the Bash command shell. The script Execute-Tests has
76 some expressions unique to Bash. Quite old versions work, at least back
77 to Bash v. 2.05b.
78
79 Awk is also required, but the constructs are all simple. Gawk, Mawk and
80 BWK Awk (the "One True Awk") are all known to work.
81
82 The tests use the following utilities:
83
84 - sh
85 - awk
86
87 - basename
88 - cat
89 - cksum
90 - cmp
91 - comm
92 - cp
93 - cut
94 - date
95 - dirname
96 - egrep
97 - fgrep
98 - file
99 - grep
100 - gs
101 - head
102 - iconv
103 - mkdir
104 - mktemp
105 - perl
106 - rm
107 - sed
108 - seq
109 - sh
110 - sort
111 - tee
112 - tr
113 - uniq
114 - wc
115
116
117 1.3.2 Required locales
118 ----------------------
119
120 For full covereage the following locales must be available:
121
122 en_US.iso88591, en_US.utf8
123
124 To check whether they are available, execute the following and see if they
125 are reported:
126
127 locale -a | grep en_US
128
129 The output should contain these lines:
130
131 en_US.iso88591
132 en_US.utf8
133
134 If these locales are absent some pbmtext tests will be skipped.
135
136
137 1.4 Repeatability
138 =================
139
140 The current version of the test package produces identical results if
141 you run "make check" repeatedly. The tests contain no random elements;
142 some Netpbm programs use randomness internally, but the tests seed
143 their random number generators with fixed values so that they too have
144 repeatable results.
145
146
147
148 1.5 Execution time
149 ==================
150
151 Currently "make check" takes no more time to execute than "make package",
152 and much less than "make".
153
154
155
156 1.6 Testing package in designated directory
157 ===========================================
158
159 If you specify the package directory when you do "make package",
160 you must do the same with "make check":
161
162 make
163 make package pkgdir=/tmp/package
164 make check pkgdir=/tmp/package
165
166
167
168 1.7 Pre-packaging check
169 =======================
170
171 You can run the tests to check executables after compilation, before
172 packaging. This feature is intended for developers.
173
174 make check-tree
175
176 This test method is incompatible with merge build.
177
178 This works when Netpbm is compiled in the source tree and also when
179 a separate build directory is used.
180
181
182
183 1.8 Post-install check
184 ======================
185
186 You can run the tests after installation. Run this way, the tests are of
187 programs in the default search path.
188
189 make check-install
190
191 Make sure to set RGBDEF if the color dictionary file rgb.txt is in
192 a non-standard location. This must be an absolute path.
193
194 RGBDEF=/etc/colors/rgb.txt make check-install
195
196
197
198 1.9 Testing less than everything
199 ================================
200
201 The file test/Test-Order is a list of tests which are run. If you want to
202 skip a test, remove the line or comment it out with a "#".
203
204 If you want to run just a few of the tests, use the make variable "target", a
205 comma-separated list of Netpbm programs.
206
207 make check target=giftopnm,pamtogif
208
209 This runs only the tests of 'giftopnm' and 'pamtogif', in the package
210 (staging) directory.
211
212 make check-tree target=ppmbrighten
213
214 This runs only the tests of 'ppmbrighten', from the build tree.
215
216
217 1.10 Valgrind
218 =============
219
220 You can run the whole test under Valgrind. This is an advanced feature
221 intended for programmers who work on Netpbm code.
222
223 To turn on Valgrind, set VALGRIND_TESTS to "on":
224
225 make check VALGRIND_TESTS="on"
226
227 Valgrind version 3.6.0 or newer is required. For information on
228 valgrind, visit http://www.valgrind.org/ .
229
230 Valgrind results are output to files, one per process in the directory
231 /tmp/netpbm-test/valgrind . The file name consists of the test script
232 name, process ID and the suffix ".vout", e.g.: "ppmmake.18420.vout" .
233
234 Valgrind errors are not reported in the summary report and do not
235 influence the success/failure count in any way. The following awk
236 one-liner will report ".vout" files with a positive error count in
237 the ERROR SUMMARY line:
238
239 awk '/ERROR SUMMARY/ && $4>0 {print FILENAME}' \
240 /tmp/netpbm-test/valgrind/*.vout
241
242
243 You can add or alter valgrind options by editing this line in
244 test/Execute-Tests:
245
246 vg_command_base="valgrind --trace-children=yes"
247
248 To get useful information from "--trace-origins=yes", you must make
249 two changes to config.mk before compilation:
250
251 - Add -g to CFLAGS
252 - Turn stripping off: STRIPFLAG =
253
254 Without these changes valgrind will report how many errors were
255 detected, of what kind, and at what addresses (in binary). With the
256 above "-g" turned on during compilation valgrind reports source file
257 and line numbers of detected problems.
258
259 Valgrind significantly increases execution time. If ordinary
260 "make check" requires 10 seconds, "make check VALGRIND_TESTS=on"
261 will require roughly 12 minutes, maybe more. You should consider
262 either setting "target=..." or paring down the items in Test-Order.
263 In the latter case, you probably don't need to run "all-in-place.test"
264 and "legacy-names.test"; consider commenting them out.
265
266 The option "--trace-children-skip" is used to prevent valgrind from
267 stepping into child processes that are not relevant. This option
268 appears in valgrind v. 3.6.0. If you wish to conduct valgrind tests
269 with an older version, comment out the line in Execute-Tests with
270 "--trace-children-skip".
271
272
273
274 2. Troubleshooting
275 ==================
276
277 2.1 Missing programs
278 ====================
279
280 The first two tests run, "all-in-place.test" and "legacy-names.test"
281 detect missing programs.
282
283 If you work around a build glitch with "make --keep-going" you
284 will get a few errors here.
285
286 A wholesale failure with "all-in-place.test" indicates a systemic
287 problem, such as a misconfigured dynamic library or a directory-wide
288 permission issue. This kind of failure is known to happen when N is
289 set too high with "make -jN" (overambitious parallel make.)
290
291 Configuration choices affect tests. If a choice you make during configure
292 causes "make" to skip compilation of certain programs, the corresponding
293 test routines will be skipped and reported as NOT TESTABLE. However,
294 if you override a glitch with "make --keep-going" the test programs
295 won't know and quite certainly you'll get failure messages.
296
297 If you run the tests as "make check-install" information about
298 configuration choices is deliberately ignored. This is because the
299 post-install check is typically run on systems with multiple versions
300 of Netpbm and in this case most users would want to get a clear idea
301 of absent components.
302
303 For details on the effects of missing libraries, read
304 'Netpbm Library Prerequisites':
305 http://netpbm.sourceforge.net/prereq.html .
306
307
308
309 2.2 Broken programs
310 ===================
311
312 Broken programs will invariably lead to failures. Certain programs
313 (for instance, image generators 'pbmmake' and 'pgmmake') are used in
314 numerous test scripts. Problems in them will lead to multiple failures.
315
316 To aid you in this situation each test routine lists the necessary programs
317 near the top.
318
319 Each test routine comes in two parts, a ".test" file which is a
320 shell script and a ".ok" file which denotes its proper output.
321 When a test fails, a ".out" file will be produced in the
322 /tmp/netpbm-test/ directory. By comparing ".ok" and ".out" you
323 can tell exactly what went wrong. Often one does not need to
324 go this far; the error messages tell enough.
325
326 In some cases the ".ok" file is generated dynamically. See "2.5
327 System Dependent Issues."
328
329
330
331 2.3 Color dictionary file
332 =========================
333
334 If you get the following error message, it indicates a problem with
335 the color dictionary file rgb.txt.
336
337 ppmmake: can't open color names dictionary file from the path '/usr/share/
338 netpbm/rgb.txt:/usr/lib/X11/rgb.txt:/usr/share/X11/rgb.txt:/usr/X11R6/lib/
339 X11/rgb.txt' and Environment variable RGBDEF not set. Set RGBDEF to the
340 pathname of your rgb.txt file or don't use color names.
341
342 This is highly unlikely to occur with "make check" right after packaging,
343 but may appear in the post-installation check "make check-install".
344
345 To check manually after installation, execute the following and see
346 whether the proper output or the error message appears:
347
348 ppmmake red 1 1 -plain
349
350 Proper output:
351
352 P3
353 1 1
354 255
355 255 0 0
356
357 The simple remedy is properly setting the environment value RGBDEF to
358 the location of rgb.txt.
359
360 RGBDEF must be an absolute path. The following will not work:
361
362 RGBDEF=./lib/rgb.txt make check-install
363
364 If you want to hardcode the path, modify RGB_DB_PATH in pm_config.h
365 and run "make" again. Note that running "configure" will cause
366 pm_config.h to be overwritten; changes by editing will be lost.
367
368
369
370 2.4 Multiple versions
371 =====================
372
373 If multiple versions of Netpbm executables are installed on your
374 system, you should do a post-installation check to ensure that
375 the newly built version is in place and in working condition.
376
377 The test routines can test binaries other than the intended
378 target, for example pre-compiled binaries distributed in .rpm
379 or .deb format. If the default binary search path gives priority
380 to a directory that contains programs from such a source, you should
381 expect multiple failures due to missing features, etc. with
382 "make check-install".
383
384 Netpbm distributed with Debian or Ubuntu is called "Netpbm-Free" and
385 is based on a fork which broke off in 2002. There are many differences.
386 Many tests will fail. However, the test framework itself is valid for
387 these distributions. The following procedure will allow you to run
388 the tests on installed Netpbm programs, regardless of the version:
389
390 ./configure # accept the defaults
391 make check-install
392
393 As of this writing (April 2018) Debian is working on resolving the
394 fork. A new version, tagged as "experimental", based on the Sourceforge
395 line of source files is available.
396
397
398
399 2.5 System dependent issues
400 ===========================
401
402 The tests have worked on x86 and x86_64 GNU/Linux systems and with several
403 versions of GCC and Clang and also Mac OS/Clang. Reports from users of
404 other systems including OS, Sun SPARC and BSD and compilers other than
405 GCC are highly welcome.
406
407 Floating point math precision seems to be an issue. Some discrepancies
408 have been observed between x86 32 bit and 64 bit; the tests are written to
409 work around them as much as possible. The use of the "--fast-math"
410 c compiler flag by default may also be a factor.
411
412 Another cause of discrepancies is the qsort function. The tests are
413 written to circumvent this issue at some cost to accuracy and
414 coverage.
415
416 The test directory Makefile checks whether the random number generator
417 is the one from glibc or Mac OS and automatically generates the proper
418 ".ok" files from master files with the suffix ".rand-ok". If some other
419 random number generator is detected the affected tests are skipped.
420
421
422
423 3. Reporting test failures
424 ==========================
425
426 When reporting problems with the tests, please give both
427 the output of "make check" and the contents of the "netpbm-test"
428 directory.
429
430
431
432