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