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