test.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <html lang="en">
  2. <head>
  3. <title>Installing GCC: Testing</title>
  4. <meta http-equiv="Content-Type" content="text/html">
  5. <meta name="description" content="Installing GCC: Testing">
  6. <meta name="generator" content="makeinfo 4.12">
  7. <link title="Top" rel="top" href="#Top">
  8. <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
  9. <!--
  10. Copyright (C) 1988-2015 Free Software Foundation, Inc.
  11. Permission is granted to copy, distribute and/or modify this document
  12. under the terms of the GNU Free Documentation License, Version 1.3 or
  13. any later version published by the Free Software Foundation; with no
  14. Invariant Sections, the Front-Cover texts being (a) (see below), and
  15. with the Back-Cover Texts being (b) (see below). A copy of the
  16. license is included in the section entitled "GNU Free Documentation License".
  17. (a) The FSF's Front-Cover Text is:
  18. A GNU Manual
  19. (b) The FSF's Back-Cover Text is:
  20. You have freedom to copy and modify this GNU Manual, like GNU
  21. software. Copies published by the Free Software Foundation raise
  22. funds for GNU development.-->
  23. <meta http-equiv="Content-Style-Type" content="text/css">
  24. <style type="text/css"><!--
  25. pre.display { font-family:inherit }
  26. pre.format { font-family:inherit }
  27. pre.smalldisplay { font-family:inherit; font-size:smaller }
  28. pre.smallformat { font-family:inherit; font-size:smaller }
  29. pre.smallexample { font-size:smaller }
  30. pre.smalllisp { font-size:smaller }
  31. span.sc { font-variant:small-caps }
  32. span.roman { font-family:serif; font-weight:normal; }
  33. span.sansserif { font-family:sans-serif; font-weight:normal; }
  34. --></style>
  35. </head>
  36. <body>
  37. <h1 class="settitle">Installing GCC: Testing</h1>
  38. <a name="index-Testing-1"></a><a name="index-Installing-GCC_003a-Testing-2"></a><a name="index-Testsuite-3"></a>
  39. Before you install GCC, we encourage you to run the testsuites and to
  40. compare your results with results from a similar configuration that have
  41. been submitted to the
  42. <a href="http://gcc.gnu.org/ml/gcc-testresults/">gcc-testresults mailing list</a>.
  43. Some of these archived results are linked from the build status lists
  44. at <a href="http://gcc.gnu.org/buildstat.html">http://gcc.gnu.org/buildstat.html</a>, although not everyone who
  45. reports a successful build runs the testsuites and submits the results.
  46. This step is optional and may require you to download additional software,
  47. but it can give you confidence in your new GCC installation or point out
  48. problems before you install and start using your new GCC.
  49. <p>First, you must have <a href="download.html">downloaded the testsuites</a>.
  50. These are part of the full distribution, but if you downloaded the
  51. &ldquo;core&rdquo; compiler plus any front ends, you must download the testsuites
  52. separately.
  53. <p>Second, you must have the testing tools installed. This includes
  54. <a href="http://www.gnu.org/software/dejagnu/">DejaGnu</a>, Tcl, and Expect;
  55. the DejaGnu site has links to these.
  56. <p>If the directories where <samp><span class="command">runtest</span></samp> and <samp><span class="command">expect</span></samp> were
  57. installed are not in the <samp><span class="env">PATH</span></samp>, you may need to set the following
  58. environment variables appropriately, as in the following example (which
  59. assumes that DejaGnu has been installed under <samp><span class="file">/usr/local</span></samp>):
  60. <pre class="smallexample"> TCL_LIBRARY = /usr/local/share/tcl8.0
  61. DEJAGNULIBS = /usr/local/share/dejagnu
  62. </pre>
  63. <p>(On systems such as Cygwin, these paths are required to be actual
  64. paths, not mounts or links; presumably this is due to some lack of
  65. portability in the DejaGnu code.)
  66. <p>Finally, you can run the testsuite (which may take a long time):
  67. <pre class="smallexample"> cd <var>objdir</var>; make -k check
  68. </pre>
  69. <p>This will test various components of GCC, such as compiler
  70. front ends and runtime libraries. While running the testsuite, DejaGnu
  71. might emit some harmless messages resembling
  72. &lsquo;<samp><span class="samp">WARNING: Couldn't find the global config file.</span></samp>&rsquo; or
  73. &lsquo;<samp><span class="samp">WARNING: Couldn't find tool init file</span></samp>&rsquo; that can be ignored.
  74. <p>If you are testing a cross-compiler, you may want to run the testsuite
  75. on a simulator as described at <a href="http://gcc.gnu.org/simtest-howto.html">http://gcc.gnu.org/simtest-howto.html</a>.
  76. <h3 class="section"><a name="TOC0"></a>How can you run the testsuite on selected tests?</h3>
  77. <p>In order to run sets of tests selectively, there are targets
  78. &lsquo;<samp><span class="samp">make check-gcc</span></samp>&rsquo; and language specific &lsquo;<samp><span class="samp">make check-c</span></samp>&rsquo;,
  79. &lsquo;<samp><span class="samp">make check-c++</span></samp>&rsquo;, &lsquo;<samp><span class="samp">make check-fortran</span></samp>&rsquo;, &lsquo;<samp><span class="samp">make check-java</span></samp>&rsquo;,
  80. &lsquo;<samp><span class="samp">make check-ada</span></samp>&rsquo;, &lsquo;<samp><span class="samp">make check-objc</span></samp>&rsquo;, &lsquo;<samp><span class="samp">make check-obj-c++</span></samp>&rsquo;,
  81. &lsquo;<samp><span class="samp">make check-lto</span></samp>&rsquo;
  82. in the <samp><span class="file">gcc</span></samp> subdirectory of the object directory. You can also
  83. just run &lsquo;<samp><span class="samp">make check</span></samp>&rsquo; in a subdirectory of the object directory.
  84. <p>A more selective way to just run all <samp><span class="command">gcc</span></samp> execute tests in the
  85. testsuite is to use
  86. <pre class="smallexample"> make check-gcc RUNTESTFLAGS="execute.exp <var>other-options</var>"
  87. </pre>
  88. <p>Likewise, in order to run only the <samp><span class="command">g++</span></samp> &ldquo;old-deja&rdquo; tests in
  89. the testsuite with filenames matching &lsquo;<samp><span class="samp">9805*</span></samp>&rsquo;, you would use
  90. <pre class="smallexample"> make check-g++ RUNTESTFLAGS="old-deja.exp=9805* <var>other-options</var>"
  91. </pre>
  92. <p>The <samp><span class="file">*.exp</span></samp> files are located in the testsuite directories of the GCC
  93. source, the most important ones being <samp><span class="file">compile.exp</span></samp>,
  94. <samp><span class="file">execute.exp</span></samp>, <samp><span class="file">dg.exp</span></samp> and <samp><span class="file">old-deja.exp</span></samp>.
  95. To get a list of the possible <samp><span class="file">*.exp</span></samp> files, pipe the
  96. output of &lsquo;<samp><span class="samp">make check</span></samp>&rsquo; into a file and look at the
  97. &lsquo;<samp><span class="samp">Running ... .exp</span></samp>&rsquo; lines.
  98. <h3 class="section"><a name="TOC1"></a>Passing options and running multiple testsuites</h3>
  99. <p>You can pass multiple options to the testsuite using the
  100. &lsquo;<samp><span class="samp">--target_board</span></samp>&rsquo; option of DejaGNU, either passed as part of
  101. &lsquo;<samp><span class="samp">RUNTESTFLAGS</span></samp>&rsquo;, or directly to <samp><span class="command">runtest</span></samp> if you prefer to
  102. work outside the makefiles. For example,
  103. <pre class="smallexample"> make check-g++ RUNTESTFLAGS="--target_board=unix/-O3/-fmerge-constants"
  104. </pre>
  105. <p>will run the standard <samp><span class="command">g++</span></samp> testsuites (&ldquo;unix&rdquo; is the target name
  106. for a standard native testsuite situation), passing
  107. &lsquo;<samp><span class="samp">-O3 -fmerge-constants</span></samp>&rsquo; to the compiler on every test, i.e.,
  108. slashes separate options.
  109. <p>You can run the testsuites multiple times using combinations of options
  110. with a syntax similar to the brace expansion of popular shells:
  111. <pre class="smallexample"> ..."--target_board=arm-sim\{-mhard-float,-msoft-float\}\{-O1,-O2,-O3,\}"
  112. </pre>
  113. <p>(Note the empty option caused by the trailing comma in the final group.)
  114. The following will run each testsuite eight times using the &lsquo;<samp><span class="samp">arm-sim</span></samp>&rsquo;
  115. target, as if you had specified all possible combinations yourself:
  116. <pre class="smallexample"> --target_board='arm-sim/-mhard-float/-O1 \
  117. arm-sim/-mhard-float/-O2 \
  118. arm-sim/-mhard-float/-O3 \
  119. arm-sim/-mhard-float \
  120. arm-sim/-msoft-float/-O1 \
  121. arm-sim/-msoft-float/-O2 \
  122. arm-sim/-msoft-float/-O3 \
  123. arm-sim/-msoft-float'
  124. </pre>
  125. <p>They can be combined as many times as you wish, in arbitrary ways. This
  126. list:
  127. <pre class="smallexample"> ..."--target_board=unix/-Wextra\{-O3,-fno-strength\}\{-fomit-frame,\}"
  128. </pre>
  129. <p>will generate four combinations, all involving &lsquo;<samp><span class="samp">-Wextra</span></samp>&rsquo;.
  130. <p>The disadvantage to this method is that the testsuites are run in serial,
  131. which is a waste on multiprocessor systems. For users with GNU Make and
  132. a shell which performs brace expansion, you can run the testsuites in
  133. parallel by having the shell perform the combinations and <samp><span class="command">make</span></samp>
  134. do the parallel runs. Instead of using &lsquo;<samp><span class="samp">--target_board</span></samp>&rsquo;, use a
  135. special makefile target:
  136. <pre class="smallexample"> make -j<var>N</var> check-<var>testsuite</var>//<var>test-target</var>/<var>option1</var>/<var>option2</var>/...
  137. </pre>
  138. <p>For example,
  139. <pre class="smallexample"> make -j3 check-gcc//sh-hms-sim/{-m1,-m2,-m3,-m3e,-m4}/{,-nofpu}
  140. </pre>
  141. <p>will run three concurrent &ldquo;make-gcc&rdquo; testsuites, eventually testing all
  142. ten combinations as described above. Note that this is currently only
  143. supported in the <samp><span class="file">gcc</span></samp> subdirectory. (To see how this works, try
  144. typing <samp><span class="command">echo</span></samp> before the example given here.)
  145. <h3 class="section"><a name="TOC2"></a>Additional testing for Java Class Libraries</h3>
  146. <p>The Java runtime tests can be executed via &lsquo;<samp><span class="samp">make check</span></samp>&rsquo;
  147. in the <samp><var>target</var><span class="file">/libjava/testsuite</span></samp> directory in
  148. the build tree.
  149. <p>The <a href="http://sourceware.org/mauve/">Mauve Project</a> provides
  150. a suite of tests for the Java Class Libraries. This suite can be run
  151. as part of libgcj testing by placing the Mauve tree within the libjava
  152. testsuite at <samp><span class="file">libjava/testsuite/libjava.mauve/mauve</span></samp>, or by
  153. specifying the location of that tree when invoking &lsquo;<samp><span class="samp">make</span></samp>&rsquo;, as in
  154. &lsquo;<samp><span class="samp">make MAUVEDIR=~/mauve check</span></samp>&rsquo;.
  155. <h3 class="section"><a name="TOC3"></a>How to interpret test results</h3>
  156. <p>The result of running the testsuite are various <samp><span class="file">*.sum</span></samp> and <samp><span class="file">*.log</span></samp>
  157. files in the testsuite subdirectories. The <samp><span class="file">*.log</span></samp> files contain a
  158. detailed log of the compiler invocations and the corresponding
  159. results, the <samp><span class="file">*.sum</span></samp> files summarize the results. These summaries
  160. contain status codes for all tests:
  161. <ul>
  162. <li>PASS: the test passed as expected
  163. <li>XPASS: the test unexpectedly passed
  164. <li>FAIL: the test unexpectedly failed
  165. <li>XFAIL: the test failed as expected
  166. <li>UNSUPPORTED: the test is not supported on this platform
  167. <li>ERROR: the testsuite detected an error
  168. <li>WARNING: the testsuite detected a possible problem
  169. </ul>
  170. <p>It is normal for some tests to report unexpected failures. At the
  171. current time the testing harness does not allow fine grained control
  172. over whether or not a test is expected to fail. This problem should
  173. be fixed in future releases.
  174. <h3 class="section"><a name="TOC4"></a>Submitting test results</h3>
  175. <p>If you want to report the results to the GCC project, use the
  176. <samp><span class="file">contrib/test_summary</span></samp> shell script. Start it in the <var>objdir</var> with
  177. <pre class="smallexample"> <var>srcdir</var>/contrib/test_summary -p your_commentary.txt \
  178. -m gcc-testresults@gcc.gnu.org |sh
  179. </pre>
  180. <p>This script uses the <samp><span class="command">Mail</span></samp> program to send the results, so
  181. make sure it is in your <samp><span class="env">PATH</span></samp>. The file <samp><span class="file">your_commentary.txt</span></samp> is
  182. prepended to the testsuite summary and should contain any special
  183. remarks you have on your results or your build environment. Please
  184. do not edit the testsuite result block or the subject line, as these
  185. messages may be automatically processed.
  186. <p><hr />
  187. <p><a href="./index.html">Return to the GCC Installation page</a>
  188. <!-- ***Final install*********************************************************** -->
  189. <!-- ***Binaries**************************************************************** -->
  190. <!-- ***Specific**************************************************************** -->
  191. <!-- ***Old documentation****************************************************** -->
  192. <!-- ***GFDL******************************************************************** -->
  193. <!-- *************************************************************************** -->
  194. <!-- Part 6 The End of the Document -->
  195. </body></html>