Imported Robodoc.
[robodoc.git] / Source / Test / makefile
1 #****h* ROBODoc/SystemTest
2 # DESCRIPTION
3 #   The systemtest is a series of tests that test the
4 #   behaviour of robodoc and robohdrs.
5 #
6 #   Most tests consists of:
7 #   * One or more data files (.dat)
8 #   * One or more result files (.html etc).  The result files are generated
9 #     by running robodoc on the .dat files.  Or sometimes on whole 
10 #     directories with source files.
11 #   * A perl script that checks the results and prints either OK or FAIL
12 #   For instance there is a test that checks if robodoc correctly
13 #   recognizes all Item names. The data files for this is
14 #   item_test.dat. It contains all item names with in between
15 #      testmark dd
16 #   where dd is a number from 1 to 43
17 #   
18 #   Robodoc is run on this data file and a file
19 #   called item_test.html is generated.  A script called item_test.pl
20 #   scans this .html file finds all the "testmark dd"s  and check if
21 #   all number from 1 to 43 occur.  If so it prints OK if not it 
22 #   print FAIL.
23 #   
24 #   To run the test do a
25 #      make
26 #   
27 #   To cleanup all the generated files do a
28 #      make clean
29 #
30 #*****
31 # $Id: makefile,v 1.54 2007/01/29 22:23:53 gumpu Exp $
32 #
33
34
35 # The programs to be tested.
36 #
37 ROBODOC  = ../robodoc
38 ROBOHDRS = ../robohdrs
39
40 # No unnecessary output.
41 .SILENT :
42
43 all: permissions clean test 
44
45 # TODO    header_test4 
46 # TODO    header_test5 
47
48 test : item_test \
49     header_test \
50     header_test2 \
51     header_test3 \
52     url_test \
53     header_size_test  \
54     cmode_test \
55     link_test \
56     html_specialchar_test \
57     internalheader_test \
58     internalheader_test2 \
59     latex_specialchar_test \
60     remarkmarker_test \
61     multidoc_test1 \
62     encoding_test \
63     tabtest \
64     pipe_test \
65     lock_test \
66     user_specified_css_file_test \
67     master_index_test \
68     robohdrs_test \
69     filter_test_1 \
70     filter_test_2 \
71     sort_test \
72     nosource_test \
73     ignore_test \
74     nosort_test \
75     forth_test \
76     doc_dir_filter_test
77
78 #  temporarily excluded:  parameter_test 
79
80 #
81 # TODO
82 #    outputformat_test 
83 # These test error handling, but they are not
84 # finished yet.
85 #    error_missing_header_end_test 
86 #    error_missing_header_end_test_2 
87
88
89 permissions:
90         chmod 755 *.pl
91
92 clean: doc1_clean doc2_clean
93         -rm -f *.res *.html *.tex *.rtf *.xml *.toc *.log *.idx *.dvi *.aux *.pdf
94         -rm -f *.tst
95         -rm -rf outputformat_test.txt
96         -rm -rf *.stderr
97         -rm -rf RoboHeaders/*.c
98         -rm -rf robohdrs_test.hdrs
99         -rm -rf cmode_test1.css
100         -rm -rf header_size_test.css
101         -rm -rf header_test2.css
102         -rm -rf header_test3.css
103         -rm -rf header_test4.css
104         -rm -rf header_test.css
105         -rm -rf html_specialchar_test2.css
106         -rm -rf html_specialchar_test.css
107         -rm -rf internalheader_test2.css
108         -rm -rf internalheader_test.css
109         -rm -rf item_test.css
110         -rm -rf link_test.css
111         -rm -rf lock_test.css
112         -rm -rf outputformat_test.css
113         -rm -rf parameter_test.css
114         -rm -rf pipe_test.css
115         -rm -rf remarkmarker_test.css
116         -rm -rf tabtest.css
117         -rm -rf url_test.css
118         -rm -rf forth_test.css
119         -rm -rf error_test.css
120         -rm -rf ignore_test.css
121         -rm -rf nosource_test.css
122
123 #
124 #
125 # Test the handling of HTML reserver characters.
126 #
127 html_specialchar_test : html_specialchar_test.html html_specialchar_test2.html
128         ./$(@F).pl < html_specialchar_test.html
129         ./$(@F).pl < html_specialchar_test2.html
130
131 html_specialchar_test.html : html_specialchar_test.dat
132         $(ROBODOC) --src html_specialchar_test.dat --doc html_specialchar_test --html --singlefile
133
134 html_specialchar_test2.html : html_specialchar_test.dat
135         $(ROBODOC) --src html_specialchar_test.dat --doc html_specialchar_test2 --html --singlefile --sections --toc
136
137 #****e* SystemTest/latex_specialchar_test
138 # FUNCTION
139 #   Create input for testing the handling of latex reserved characters 
140 # SOURCE
141 #
142 latex_specialchar_test : latex_specialchar_test.tex latex_specialchar_test2.tex
143         ./$(@F).pl < latex_specialchar_test.tex
144         ./$(@F).pl < latex_specialchar_test2.tex
145
146 latex_specialchar_test.tex : latex_specialchar_test.dat
147         $(ROBODOC) --src latex_specialchar_test.dat --doc latex_specialchar_test --latex --singlefile
148
149 latex_specialchar_test2.tex : latex_specialchar_test.dat
150         $(ROBODOC) --src latex_specialchar_test.dat --doc latex_specialchar_test2 --latex --singlefile --sections --toc
151
152 #******
153
154
155 #****e* SystemTest/header_size_test
156 # FUNCTION
157 #   Create the input file for header_size_test_pl.
158 # SOURCE
159 #
160 header_size_test : header_size_test.html
161         ./$(@F).pl < header_size_test.html
162
163 header_size_test.html : header_size_test.dat
164         $(ROBODOC) --src $< --doc header_size_test --html --singlefile
165
166 #*****
167
168
169 #****e* SystemTest/internalheader_test, internalheader_test2
170 # FUNCTION
171 #   Create the input for the internalheader_test.
172 # SOURCE
173 #
174 internalheader_test : internalheader_test.html
175         ./$(@F).pl < internalheader_test.html
176
177 internalheader_test.html : internalheader_test.dat
178         $(ROBODOC) --src internalheader_test.dat --doc internalheader_test --html --singlefile --index --toc --internal
179
180 #
181 internalheader_test2 : internalheader_test2.html
182         ./$(@F).pl < internalheader_test2.html
183
184 internalheader_test2.html : internalheader_test.dat
185         $(ROBODOC) --src internalheader_test.dat --doc internalheader_test2 --html --singlefile --index --toc
186
187 #**********
188
189
190 #
191 #
192 outputformat_test : outputformat_test.html \
193                     outputformat_test.txt \
194                     outputformat_test.rtf 
195 #                    outputformat_test_dbsgml.res \
196 #                    outputformat_test_troff.res 
197         ./$(@F).pl
198
199
200 outputformat_test.html   : outputformat_test.dat
201         $(ROBODOC) --src $< --doc outputformat_test --singlefile --html
202
203 outputformat_test.txt  : outputformat_test.dat
204         $(ROBODOC) --src $< --doc outputformat_test --singlefile --ascii
205
206 outputformat_test.rtf    : outputformat_test.dat
207         $(ROBODOC) --src $< --doc outputformat_test --singlefile --rtf
208
209 # outputformat_test.dbsgml : outputformat_test.dat
210 #       $(ROBODOC) --src $< --doc $@ DBSGML
211
212 # outputformat_test_troff.res  : outputformat_test.dat
213 #       $(ROBODOC) --src $< --doc $@ TROFF
214
215
216 #
217 # Test if we recognize all predefined items.
218 #
219 item_test : item_test.html
220         ./$(@F).pl < item_test.html
221
222 item_test.html : item_test.dat
223         $(ROBODOC) --src item_test.dat --doc item_test --html --singlefile
224
225 #
226 # Test the linking of keywords to headers.
227 #
228 link_test : link_test.html
229         ./$(@F).pl < link_test.html
230
231 link_test.html : link_test.dat
232         $(ROBODOC) --src link_test.dat --doc link_test --html --singlefile
233
234 #****e* SystemTest/header_test, header_test2, header_test3, header_test4, header_test5
235 # FUNCTION
236 #   Create the input file for header_test_pl.
237 # SOURCE
238 #
239 header_test : header_test.html
240         ./$(@F).pl < header_test.html
241
242 header_test.html : header_test.dat
243         $(ROBODOC) --src header_test.dat --doc header_test --html --toc --singlefile
244
245
246 #
247 # indented header test case
248 #
249 header_test2 : header_test2.html
250         ./header_test2.pl < header_test2.html
251
252 header_test2.html : header_test2.dat
253         $(ROBODOC) --src header_test2.dat --doc header_test2 --html --toc --singlefile
254
255 #
256 # indented header test case
257 #
258 header_test3 : header_test3.html
259         ./header_test3.pl < header_test3.html
260
261 header_test3.html : header_test3.dat
262         $(ROBODOC) --src header_test3.dat --doc header_test3 --html --toc --singlefile
263
264 header_test4 : header_test4.tst
265         ./$(@F).pl < header_test4.tst
266
267 header_test4.tst : header_test4.dat
268         $(ROBODOC) --src header_test4.dat --doc header_test4 --test --toc --singlefile
269
270 header_test5 : header_test5.tst
271         ./$(@F).pl < header_test5.tst
272
273 header_test5.tst : header_test5.dat
274         $(ROBODOC) --rc header_test5.rc --src header_test5.dat --doc header_test5 --test --toc --singlefile
275
276 #*************
277
278 #
279 # Test if we can recognize all the different remark markers for
280 # all the languages we defined.
281 #
282 remarkmarker_test : remarkmarker_test.html
283         ./$(@F).pl < remarkmarker_test.html
284
285 remarkmarker_test.html : remarkmarker_test.dat
286         $(ROBODOC) --src remarkmarker_test.dat --doc remarkmarker_test --html --singlefile
287
288 #
289 # Test the automatic recognition of urls
290 #
291 url_test : url_test.html
292         ./$(@F).pl < url_test.html
293
294 url_test.html : url_test.dat
295         $(ROBODOC) --src url_test.dat --doc url_test --html --singlefile
296
297 #
298 # Test the syntax colouring of C code.
299 #
300 cmode_test : cmode_test1.html
301         ./cmode_test1.pl < cmode_test1.html
302
303 cmode_test1.html : cmode_test.dat
304         $(ROBODOC) --src cmode_test.dat --doc cmode_test1 --html --cmode --singlefile
305
306 #
307 # Test the --multidoc mode
308 #
309 #
310 multidoc_test1 : multidoc_test1.html
311         ./multidoc_test1.pl
312
313 multidoc_test1.html : 
314         $(ROBODOC) --src ./Scr1 --doc ./Doc1 --html --multidoc --index --sections --toc
315         touch multidoc_test1.html
316
317
318 #
319 # This tests if specifying the tabsize with --tabsize works.
320 #
321 tabtest : tabtest.html
322         ./$(@F).pl < tabtest.html
323
324 tabtest.html : tabtest.dat
325         $(ROBODOC) --src tabtest.dat --doc tabtest --html --singlefile  --tabsize 4
326
327 #
328 # This test if we can specify a full path to the source file
329 # when we use --singlefile.  (This borrows the code from tabtest)
330 #
331 parameter_test : parameter_test.html
332         ./$(@F).pl
333
334 parameter_test.html : parameter_test.dat
335         $(ROBODOC) --src /home/robodoc/robo/Source/Test/parameter_test.dat --doc /home/robodoc/robo/Source/Test/parameter_test --html --singlefile
336
337
338 # The xml file uses UTF-8 encoding. Although xmlto seems not to _write_
339 # UTF-8, it does _read_ that correctly in input and complains if that is 
340 # not proper UTF-8 format.
341
342 encoding_test: encoding_test.html
343         @ if [ -x "`which xmlto`" ] ; then \
344                 xmlto html-nochunks encoding_test.xml ; \
345     else \
346         echo "xmlto missing, can not perform test"; \
347         fi ;
348 #rm -f encoding_test.html encoding_test.xml encoding_test.pdf
349
350 # Source file uses Latin-1 i.e. iso-8859-1 encoding
351 encoding_test.html: encoding_test.dat
352         $(ROBODOC) --src encoding_test.dat --doc encoding_test --singlefile --dbxml
353
354
355 #
356 # Test if we can specify an alternative robodoc.rc file using
357 # the --rc option.
358 #
359
360 option_rc_test: option_rc_test.html
361         ./$(@F).pl < option_rc_test.html
362
363 option_rc_test.html: alt_rc_file.rc
364         $(ROBODOC) --rc alt_rc_file.rc --html
365
366
367 #
368 # Test the error generated for a header end messing from a header
369 # that is not the last header in a file.
370 #
371
372 error_missing_header_end_test: error_missing_header_end_test.stderr
373         echo "TODO"
374
375 error_missing_header_end_test.stderr : error_missing_header_end_test.dat
376         -$(ROBODOC) --src error_missing_header_end_test.dat --doc error_test --singlefile --html 2> error_missing_header_end_test.stderr
377
378 #
379 # Test the error generated for a header end missing from a header
380 # that _is_ the last header in a file.
381 #
382
383 error_missing_header_end_test_2: error_missing_header_end_test_2.stderr
384         echo "TODO"
385
386 error_missing_header_end_test_2.stderr : error_missing_header_end_test_2.dat
387         -$(ROBODOC) --src error_missing_header_end_test_2.dat --doc error_test --singlefile --html 2> error_missing_header_end_test_2.stderr
388
389
390 #
391 # The if a user can specify its own css file.
392 #
393
394 user_specified_css_file_test : user_specified_css_file_test.html
395         ./$(@F).pl < ./Doc1/robodoc.css
396
397 user_specified_css_file_test.html : user_css.css
398         $(ROBODOC) --src ./Scr1 --doc ./Doc1 --html --multidoc --index --sections --toc --css user_css.css
399 #       touch user_specified_css_file_test.html 
400
401
402 lock_test : lock_test.html
403         ./$(@F).pl < lock_test.html
404
405 lock_test.html: lock_test.dat
406         $(ROBODOC) --src lock_test.dat --doc lock_test --singlefile --lock --html
407
408 #
409 # Test the forth headers
410 #
411
412 forth_test: forth_test.html
413
414 forth_test.html:
415         $(ROBODOC) --src ../../Headers/forth.sample --doc forth_test --singlefile --html --toc
416
417 #
418 #
419 #
420
421 pipe_test : 
422         $(ROBODOC) --src pipe_test.dat --doc pipe_test --singlefile --html
423         ./pipe_test.pl 1 0 < pipe_test.html
424         ./pipe_test.pl 2 1 < pipe_test.html
425         ./pipe_test.pl 3 0 < pipe_test.html
426         $(ROBODOC) --src pipe_test.dat --doc pipe_test --singlefile --latex
427         @ if [ -x "`which latex`" ] ; then \
428                 latex pipe_test.tex > /dev/null 2>&1 ; rm -f pipe_test/dvi ; \
429     else \
430         echo "latex missing, can not perform test"; \
431         fi ;    
432         ./pipe_test.pl 2 0 < pipe_test.tex
433         ./pipe_test.pl 1 1 < pipe_test.tex
434
435 #
436
437 #
438 master_index_test : Doc2/masterindex.html
439         ./$(@F).pl 
440
441 Doc2/masterindex.html : Scr2/master_index_test.dat
442         $(ROBODOC) --src Scr2 --doc Doc2 --html --multidoc  --index --internal
443
444
445 #
446 #
447 #
448 #
449 RoboHeaders/rbh_test1.c : RoboHeaders/rbh_test1.dat
450         cp RoboHeaders/rbh_test1.dat RoboHeaders/rbh_test1.c 
451
452 robohdrs_test.hdrs : RoboHeaders/rbh_test1.c
453         cd RoboHeaders; ../$(ROBOHDRS) -p HDRS rbh_test1.c ; cd ..
454         touch robohdrs_test.hdrs 
455
456
457 #
458 #
459 #
460 #
461 robohdrs_test.doc : robohdrs_test.hdrs 
462         -rm -rf Doc1/*.*
463         $(ROBODOC) --src RoboHeaders --doc Doc1 --html --multidoc --index
464
465 robohdrs_test : robohdrs_test.doc
466         ./$(@F).pl 
467
468
469 doc_dir_filter_test.doc : doc_dir_filter_test.rc
470         $(ROBODOC) --rc doc_dir_filter_test.rc
471         $(ROBODOC) --rc doc_dir_filter_test.rc
472
473 doc_dir_filter_test : doc_dir_filter_test.doc
474         ./$(@F).pl
475         -rm -rf DocNot
476
477
478
479 #
480 #
481 #
482 filter_test_2.doc : 
483         -rm -rf Doc3/*
484         $(ROBODOC) --src FileFilterSrc_2 --doc Doc3 --html --multidoc --index --rc filter_test_2.rc
485
486 filter_test_2 : filter_test_2.doc
487         ./$(@F).pl
488
489 #
490 #
491 #
492 filter_test_1.doc : 
493         -rm -rf Doc1/*
494         $(ROBODOC) --src FileFilterSrc --doc Doc1 --html --multidoc --index --rc filter_test_1.rc
495
496 filter_test_1 : filter_test_1.doc
497         ./$(@F).pl
498
499
500 #
501 #
502 #
503 sort_test.doc :
504         -rm -rf Doc1/*.*
505         $(ROBODOC) --src SortSource --doc Doc1 --html --multidoc --index --toc
506
507 sort_test : sort_test.doc
508         ./$(@F).pl
509
510 #
511 #
512 #
513 nosort_test.doc :
514         -rm -rf Doc1/*.*
515         $(ROBODOC) --src SortSource --doc Doc1 --html --multidoc --index --toc --nosort
516
517 nosort_test : nosort_test.doc
518         ./$(@F).pl
519
520
521 nosource_test : nosource_test.html
522         ./$(@F).pl < nosource_test.html
523
524 nosource_test.html : nosource_test.dat
525         $(ROBODOC) --src nosource_test.dat --doc nosource_test --singlefile --nosource --html
526
527 ignore_test : ignore_test.html
528         ./$(@F).pl < ignore_test.html
529
530 ignore_test.html : ignore_test.dat
531         $(ROBODOC) --src ignore_test.dat --doc ignore_test --singlefile --html --rc ignore_test.rc
532
533
534 doc1_clean :
535         rm -rf Doc1/Subdir
536         rm -rf Doc1/ToBeAccepted
537         rm -rf Doc1/*.*
538
539 doc2_clean :
540         rm -rf Doc2/*.*