README 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. $Id$
  2. texinfo/tp/tests/README
  3. Copyright 2010, 2011, 2012, 2013, 2014, 2015, 2016
  4. Free Software Foundation, Inc.
  5. Copying and distribution of this README file, with or without
  6. modification, are permitted in any medium without royalty provided the
  7. copyright notice and this notice are preserved.
  8. Files anywhere within the texinfo/tp/tests/ subdirectory which have no
  9. other copyright notice are hereby placed in the public domain.
  10. This directory contains tests of the texi2any program.
  11. Prerequisites
  12. =============
  13. To run this testsuite, sed, awk, diff (with -u) are used.
  14. For LaTeX2HTML tests (not run by default), mktemp
  15. understanding the -d option is also required.
  16. Some tests may also require a case insensitive filesystem.
  17. Running the testsuite
  18. =====================
  19. This testsuite can be run one of the following ways:
  20. * Using the makefile rules: "make check" (in this directory)
  21. These tests use the scripts under the test_scripts directory.
  22. * Using ./parser_tests.sh with the directories one want to run the tests
  23. in given as arguments, for example "./parser_tests.sh formatting".
  24. Checking test results
  25. ---------------------
  26. The test results are in the out_parser directories; the reference
  27. results are in res_parser directories. There can be these pairs.
  28. - out_parser/ and res_parser/ for html output in texi2html style;
  29. - out_parser_html/ and res_parser_html/ for html output in texi2any style;
  30. - out_parser_info/ and res_parser_info/ for info results;
  31. and diffs are put in the diffs/ subdir.
  32. For example, to investigate a failure in the
  33. test_scripts/layout_formaatting_docbook.sh test, compare the contents of the
  34. files in the layout_res_parser/formatting_docbook and
  35. layout_out_parser/formatting_docbook directories, e.g.
  36. diff {res,out}_parser/formatting_docbook/formatting.2
  37. Also look in the layout/diffs directory.
  38. If the test results are as expected, copy the output files onto the
  39. reference files. Otherwise, if they need more investigation, see "Tests
  40. specification" below, to find out what input file, etc. was used for the
  41. test. Sometimes you need to use "makeinfo -F" to force an output file
  42. to be created.
  43. When running tests via parser_tests.sh or run_parser_all.sh, then
  44. a test failure causes
  45. F: a_test_directory
  46. to be printed. If there is a diff with the references, then
  47. D: a_test_directory
  48. is printed. If there are no reference to compare with, then
  49. no res: a_test_directory
  50. is printed.
  51. If a whole directory check run using './parser_tests.sh' had no failure,
  52. the directory name is printed followed by a fail; it is followed
  53. by a ok if there was a failure.
  54. The test results are in a directory below the out directories. This
  55. directory name can be considered as the test name. Let's call it a_test
  56. for the remainder of the explanation. The stderr output is in
  57. out_parser/a_test/a_test.2, stdout output is in
  58. out_parser/a_test/a_test.1. All the commands called are output in
  59. tests.log.
  60. Regenerating test results
  61. =========================
  62. To update the test results, first the tests must be run as above.
  63. Giving -copy as the first argument to ../run_parser_all.sh or
  64. parser_tests.sh (tex_html_tests.sh, which needs TEX_HTML_TESTS or ALL_TESTS
  65. to be set to "yes", but otherwise operates similarly) will cause the
  66. reference results to be copied from the results the last time the tests
  67. were run. For example, to update the reference results for one
  68. particular test:
  69. $ ./parser_tests.sh -copy formatting
  70. The copy-* make targets update all the references for various large sets
  71. of tests via this method.
  72. Exception: in the many_input_files subdirectory, the *parser*.sh scripts
  73. can't be used for updating. Instead, the Makefile's copy-tests and
  74. copy-tex-html targets do it directly.
  75. TeX4ht and LaTeX2HTML tests
  76. ===========================
  77. The tex4ht and latex2HTML related tests are not run automatically, as
  78. some test results involving latex2HTML or tex4ht depend on the setup and
  79. version of these tools.
  80. These tests may be run by
  81. make tex-html-checks
  82. For the tests that use latex2html, to avoid the test failing if there is
  83. a dot in the cwd, mktemp is used to create a temporary directory, and
  84. the directory is passed through on the command line.
  85. Tests specification
  86. ===================
  87. Test runs are driven by the contents of the tests-parser.txt file in
  88. each subdirectory. This is a line-oriented file. A # starts a
  89. comment, except that the very first line of the file can be, e.g.,
  90. # formats :html
  91. which says which formats to generate.
  92. Otherwise, each non-empty non-comment line describes a test. The first
  93. word on the line is the test name which corresponds also with the
  94. resulting directory (what we called a_test above). It is followed by
  95. the source manual name. The source manual name has to have the .texi
  96. extension. Optionally, additional arguments can be given on the rest of
  97. the line.
  98. So, for example, the line
  99. a_test manual.texi
  100. specifies that for the test a_test, the file manual.texi is processed
  101. and results are put are put in the a_test directory. The line:
  102. a_test_split_chapter manual.texi --split chapter
  103. specifies that the results of the processing of manual.texi with additional
  104. command line arguments --split chapter will be in the a_test_split_chapter
  105. directory.
  106. Using "texi" as the test name is special. In that case the directory name
  107. is constructed by appending _ followed by the manual name without the .texi
  108. extension to "texi". And the result is not processed normally, but instead
  109. macros are expanded and regions that are not processed removed and the
  110. result is put in a file with the same name as the manual.
  111. texi manual.texi
  112. results in the following: in the directory out_parser/texi_manual the file
  113. manual.texi will have macros expanded and ignored regions removed.
  114. Common .texi
  115. ------------
  116. A common .texi file should be in the top-level directory (there is such an
  117. example with coverage_macro.texi).
  118. Init files
  119. ----------
  120. Init files are searched for in ../t/init/.
  121. Creating a new test
  122. ===================
  123. - choose the subdir here for the new test. Each subdir only generates
  124. output in one or two formats (according to the `formats' line in
  125. its tests-parser.txt), so if you want to test a particular output
  126. format, use the right place.
  127. - add the line to subdir/tests-parser.txt as described above.
  128. - most probably, create the needed subdir/*.texi file
  129. - cd subdir; ../run_parser_all.sh newtest
  130. This will create subdir/out_parser*/newtest/ with the test results
  131. (as explained above), as well as stdout in newtest.1 and stderr in newtest.2.
  132. Look carefully to be sure they are as they should be.
  133. For XML output, perhaps check validity using the commands in tp/TODO.
  134. When things look good, use the -copy option to create the
  135. subdir/res_parser*/newtest/ subdirs and copy the output files there.
  136. The test run will be logged in subdir/test_log/newtest.log,
  137. including the exact invocation of texi2any, which can alter anything.
  138. For even more, use sh -vx to show exactly what run_parser_all is doing.
  139. When satisfied, add the .texi in subdir/Makefile.am.
  140. Of course commit all the files and try a make check afterward to verify
  141. it gets run, and passes.
  142. See tp/t/README for info about those tests.