test.html 12 KB

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