Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

315 lines
12KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with no
  7. Invariant Sections, the Front-Cover texts being (a) (see below), and
  8. with the Back-Cover Texts being (b) (see below). A copy of the
  9. license is included in the section entitled "GNU
  10. Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  20. <title>Installing GCC: Testing</title>
  21. <meta name="description" content="Installing GCC: Testing">
  22. <meta name="keywords" content="Installing GCC: Testing">
  23. <meta name="resource-type" content="document">
  24. <meta name="distribution" content="global">
  25. <meta name="Generator" content="makeinfo">
  26. <style type="text/css">
  27. <!--
  28. a.summary-letter {text-decoration: none}
  29. blockquote.indentedblock {margin-right: 0em}
  30. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  31. blockquote.smallquotation {font-size: smaller}
  32. div.display {margin-left: 3.2em}
  33. div.example {margin-left: 3.2em}
  34. div.lisp {margin-left: 3.2em}
  35. div.smalldisplay {margin-left: 3.2em}
  36. div.smallexample {margin-left: 3.2em}
  37. div.smalllisp {margin-left: 3.2em}
  38. kbd {font-style: oblique}
  39. pre.display {font-family: inherit}
  40. pre.format {font-family: inherit}
  41. pre.menu-comment {font-family: serif}
  42. pre.menu-preformatted {font-family: serif}
  43. pre.smalldisplay {font-family: inherit; font-size: smaller}
  44. pre.smallexample {font-size: smaller}
  45. pre.smallformat {font-family: inherit; font-size: smaller}
  46. pre.smalllisp {font-size: smaller}
  47. span.nolinebreak {white-space: nowrap}
  48. span.roman {font-family: initial; font-weight: normal}
  49. span.sansserif {font-family: sans-serif; font-weight: normal}
  50. ul.no-bullet {list-style: none}
  51. -->
  52. </style>
  53. </head>
  54. <body lang="en">
  55. <h1 class="settitle" align="center">Installing GCC: Testing</h1>
  56. <a name="index-Testing"></a>
  57. <a name="index-Installing-GCC_003a-Testing"></a>
  58. <a name="index-Testsuite"></a>
  59. <p>Before you install GCC, we encourage you to run the testsuites and to
  60. compare your results with results from a similar configuration that have
  61. been submitted to the
  62. <a href="http://gcc.gnu.org/ml/gcc-testresults/">gcc-testresults mailing list</a>.
  63. Some of these archived results are linked from the build status lists
  64. at <a href="http://gcc.gnu.org/buildstat.html">http://gcc.gnu.org/buildstat.html</a>, although not everyone who
  65. reports a successful build runs the testsuites and submits the results.
  66. This step is optional and may require you to download additional software,
  67. but it can give you confidence in your new GCC installation or point out
  68. problems before you install and start using your new GCC.
  69. </p>
  70. <p>First, you must have <a href="download.html">downloaded the testsuites</a>.
  71. These are part of the full distribution, but if you downloaded the
  72. &ldquo;core&rdquo; compiler plus any front ends, you must download the testsuites
  73. separately.
  74. </p>
  75. <p>Second, you must have the testing tools installed. This includes
  76. <a href="http://www.gnu.org/software/dejagnu/">DejaGnu</a>, Tcl, and Expect;
  77. the DejaGnu site has links to these. For running the BRIG frontend
  78. tests, a tool to assemble the binary BRIGs from HSAIL text,
  79. <a href="https://github.com/HSAFoundation/HSAIL-Tools/">HSAILasm</a> must
  80. be installed.
  81. </p>
  82. <p>If the directories where <code>runtest</code> and <code>expect</code> were
  83. installed are not in the <code>PATH</code>, you may need to set the following
  84. environment variables appropriately, as in the following example (which
  85. assumes that DejaGnu has been installed under <samp>/usr/local</samp>):
  86. </p>
  87. <div class="smallexample">
  88. <pre class="smallexample">TCL_LIBRARY = /usr/local/share/tcl8.0
  89. DEJAGNULIBS = /usr/local/share/dejagnu
  90. </pre></div>
  91. <p>(On systems such as Cygwin, these paths are required to be actual
  92. paths, not mounts or links; presumably this is due to some lack of
  93. portability in the DejaGnu code.)
  94. </p>
  95. <p>Finally, you can run the testsuite (which may take a long time):
  96. </p><div class="smallexample">
  97. <pre class="smallexample">cd <var>objdir</var>; make -k check
  98. </pre></div>
  99. <p>This will test various components of GCC, such as compiler
  100. front ends and runtime libraries. While running the testsuite, DejaGnu
  101. might emit some harmless messages resembling
  102. &lsquo;<samp>WARNING: Couldn't find the global config file.</samp>&rsquo; or
  103. &lsquo;<samp>WARNING: Couldn't find tool init file</samp>&rsquo; that can be ignored.
  104. </p>
  105. <p>If you are testing a cross-compiler, you may want to run the testsuite
  106. on a simulator as described at <a href="http://gcc.gnu.org/simtest-howto.html">http://gcc.gnu.org/simtest-howto.html</a>.
  107. </p>
  108. <a name="How-can-you-run-the-testsuite-on-selected-tests_003f"></a>
  109. <h3 class="section">How can you run the testsuite on selected tests?</h3>
  110. <p>In order to run sets of tests selectively, there are targets
  111. &lsquo;<samp>make check-gcc</samp>&rsquo; and language specific &lsquo;<samp>make check-c</samp>&rsquo;,
  112. &lsquo;<samp>make check-c++</samp>&rsquo;, &lsquo;<samp>make check-d</samp>&rsquo; &lsquo;<samp>make check-fortran</samp>&rsquo;,
  113. &lsquo;<samp>make check-ada</samp>&rsquo;, &lsquo;<samp>make check-objc</samp>&rsquo;, &lsquo;<samp>make check-obj-c++</samp>&rsquo;,
  114. &lsquo;<samp>make check-lto</samp>&rsquo;
  115. in the <samp>gcc</samp> subdirectory of the object directory. You can also
  116. just run &lsquo;<samp>make check</samp>&rsquo; in a subdirectory of the object directory.
  117. </p>
  118. <p>A more selective way to just run all <code>gcc</code> execute tests in the
  119. testsuite is to use
  120. </p>
  121. <div class="smallexample">
  122. <pre class="smallexample">make check-gcc RUNTESTFLAGS=&quot;execute.exp <var>other-options</var>&quot;
  123. </pre></div>
  124. <p>Likewise, in order to run only the <code>g++</code> &ldquo;old-deja&rdquo; tests in
  125. the testsuite with filenames matching &lsquo;<samp>9805*</samp>&rsquo;, you would use
  126. </p>
  127. <div class="smallexample">
  128. <pre class="smallexample">make check-g++ RUNTESTFLAGS=&quot;old-deja.exp=9805* <var>other-options</var>&quot;
  129. </pre></div>
  130. <p>The file-matching expression following <var>filename</var><code>.exp=</code> is treated
  131. as a series of whitespace-delimited glob expressions so that multiple patterns
  132. may be passed, although any whitespace must either be escaped or surrounded by
  133. single quotes if multiple expressions are desired. For example,
  134. </p>
  135. <div class="smallexample">
  136. <pre class="smallexample">make check-g++ RUNTESTFLAGS=&quot;old-deja.exp=9805*\ virtual2.c <var>other-options</var>&quot;
  137. make check-g++ RUNTESTFLAGS=&quot;'old-deja.exp=9805* virtual2.c' <var>other-options</var>&quot;
  138. </pre></div>
  139. <p>The <samp>*.exp</samp> files are located in the testsuite directories of the GCC
  140. source, the most important ones being <samp>compile.exp</samp>,
  141. <samp>execute.exp</samp>, <samp>dg.exp</samp> and <samp>old-deja.exp</samp>.
  142. To get a list of the possible <samp>*.exp</samp> files, pipe the
  143. output of &lsquo;<samp>make check</samp>&rsquo; into a file and look at the
  144. &lsquo;<samp>Running &hellip; .exp</samp>&rsquo; lines.
  145. </p>
  146. <a name="Passing-options-and-running-multiple-testsuites"></a>
  147. <h3 class="section">Passing options and running multiple testsuites</h3>
  148. <p>You can pass multiple options to the testsuite using the
  149. &lsquo;<samp>--target_board</samp>&rsquo; option of DejaGNU, either passed as part of
  150. &lsquo;<samp>RUNTESTFLAGS</samp>&rsquo;, or directly to <code>runtest</code> if you prefer to
  151. work outside the makefiles. For example,
  152. </p>
  153. <div class="smallexample">
  154. <pre class="smallexample">make check-g++ RUNTESTFLAGS=&quot;--target_board=unix/-O3/-fmerge-constants&quot;
  155. </pre></div>
  156. <p>will run the standard <code>g++</code> testsuites (&ldquo;unix&rdquo; is the target name
  157. for a standard native testsuite situation), passing
  158. &lsquo;<samp>-O3 -fmerge-constants</samp>&rsquo; to the compiler on every test, i.e.,
  159. slashes separate options.
  160. </p>
  161. <p>You can run the testsuites multiple times using combinations of options
  162. with a syntax similar to the brace expansion of popular shells:
  163. </p>
  164. <div class="smallexample">
  165. <pre class="smallexample">&hellip;&quot;--target_board=arm-sim\{-mhard-float,-msoft-float\}\{-O1,-O2,-O3,\}&quot;
  166. </pre></div>
  167. <p>(Note the empty option caused by the trailing comma in the final group.)
  168. The following will run each testsuite eight times using the &lsquo;<samp>arm-sim</samp>&rsquo;
  169. target, as if you had specified all possible combinations yourself:
  170. </p>
  171. <div class="smallexample">
  172. <pre class="smallexample">--target_board='arm-sim/-mhard-float/-O1 \
  173. arm-sim/-mhard-float/-O2 \
  174. arm-sim/-mhard-float/-O3 \
  175. arm-sim/-mhard-float \
  176. arm-sim/-msoft-float/-O1 \
  177. arm-sim/-msoft-float/-O2 \
  178. arm-sim/-msoft-float/-O3 \
  179. arm-sim/-msoft-float'
  180. </pre></div>
  181. <p>They can be combined as many times as you wish, in arbitrary ways. This
  182. list:
  183. </p>
  184. <div class="smallexample">
  185. <pre class="smallexample">&hellip;&quot;--target_board=unix/-Wextra\{-O3,-fno-strength\}\{-fomit-frame,\}&quot;
  186. </pre></div>
  187. <p>will generate four combinations, all involving &lsquo;<samp>-Wextra</samp>&rsquo;.
  188. </p>
  189. <p>The disadvantage to this method is that the testsuites are run in serial,
  190. which is a waste on multiprocessor systems. For users with GNU Make and
  191. a shell which performs brace expansion, you can run the testsuites in
  192. parallel by having the shell perform the combinations and <code>make</code>
  193. do the parallel runs. Instead of using &lsquo;<samp>--target_board</samp>&rsquo;, use a
  194. special makefile target:
  195. </p>
  196. <div class="smallexample">
  197. <pre class="smallexample">make -j<var>N</var> check-<var>testsuite</var>//<var>test-target</var>/<var>option1</var>/<var>option2</var>/&hellip;
  198. </pre></div>
  199. <p>For example,
  200. </p>
  201. <div class="smallexample">
  202. <pre class="smallexample">make -j3 check-gcc//sh-hms-sim/{-m1,-m2,-m3,-m3e,-m4}/{,-nofpu}
  203. </pre></div>
  204. <p>will run three concurrent &ldquo;make-gcc&rdquo; testsuites, eventually testing all
  205. ten combinations as described above. Note that this is currently only
  206. supported in the <samp>gcc</samp> subdirectory. (To see how this works, try
  207. typing <code>echo</code> before the example given here.)
  208. </p>
  209. <a name="How-to-interpret-test-results"></a>
  210. <h3 class="section">How to interpret test results</h3>
  211. <p>The result of running the testsuite are various <samp>*.sum</samp> and <samp>*.log</samp>
  212. files in the testsuite subdirectories. The <samp>*.log</samp> files contain a
  213. detailed log of the compiler invocations and the corresponding
  214. results, the <samp>*.sum</samp> files summarize the results. These summaries
  215. contain status codes for all tests:
  216. </p>
  217. <ul>
  218. <li> PASS: the test passed as expected
  219. </li><li> XPASS: the test unexpectedly passed
  220. </li><li> FAIL: the test unexpectedly failed
  221. </li><li> XFAIL: the test failed as expected
  222. </li><li> UNSUPPORTED: the test is not supported on this platform
  223. </li><li> ERROR: the testsuite detected an error
  224. </li><li> WARNING: the testsuite detected a possible problem
  225. </li></ul>
  226. <p>It is normal for some tests to report unexpected failures. At the
  227. current time the testing harness does not allow fine grained control
  228. over whether or not a test is expected to fail. This problem should
  229. be fixed in future releases.
  230. </p>
  231. <a name="Submitting-test-results"></a>
  232. <h3 class="section">Submitting test results</h3>
  233. <p>If you want to report the results to the GCC project, use the
  234. <samp>contrib/test_summary</samp> shell script. Start it in the <var>objdir</var> with
  235. </p>
  236. <div class="smallexample">
  237. <pre class="smallexample"><var>srcdir</var>/contrib/test_summary -p your_commentary.txt \
  238. -m gcc-testresults@gcc.gnu.org |sh
  239. </pre></div>
  240. <p>This script uses the <code>Mail</code> program to send the results, so
  241. make sure it is in your <code>PATH</code>. The file <samp>your_commentary.txt</samp> is
  242. prepended to the testsuite summary and should contain any special
  243. remarks you have on your results or your build environment. Please
  244. do not edit the testsuite result block or the subject line, as these
  245. messages may be automatically processed.
  246. </p>
  247. <hr />
  248. <p>
  249. <p><a href="./index.html">Return to the GCC Installation page</a>
  250. </p>
  251. <hr>
  252. </body>
  253. </html>