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