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