Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

207 lines
8.7KB

  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-2020 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 the
  7. Invariant Sections being "Funding Free Software", the Front-Cover
  8. Texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU 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 6.5, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  20. <title>C Tests (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="C Tests (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="C Tests (GNU Compiler Collection (GCC) Internals)">
  23. <meta name="resource-type" content="document">
  24. <meta name="distribution" content="global">
  25. <meta name="Generator" content="makeinfo">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="Testsuites.html#Testsuites" rel="up" title="Testsuites">
  30. <link href="LTO-Testing.html#LTO-Testing" rel="next" title="LTO Testing">
  31. <link href="Ada-Tests.html#Ada-Tests" rel="prev" title="Ada Tests">
  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. </head>
  60. <body lang="en">
  61. <a name="C-Tests"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="LTO-Testing.html#LTO-Testing" accesskey="n" rel="next">LTO Testing</a>, Previous: <a href="Ada-Tests.html#Ada-Tests" accesskey="p" rel="prev">Ada Tests</a>, Up: <a href="Testsuites.html#Testsuites" accesskey="u" rel="up">Testsuites</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  65. </div>
  66. <hr>
  67. <a name="C-Language-Testsuites"></a>
  68. <h3 class="section">7.4 C Language Testsuites</h3>
  69. <p>GCC contains the following C language testsuites, in the
  70. <samp>gcc/testsuite</samp> directory:
  71. </p>
  72. <dl compact="compact">
  73. <dt><samp>gcc.dg</samp></dt>
  74. <dd><p>This contains tests of particular features of the C compiler, using the
  75. more modern &lsquo;<samp>dg</samp>&rsquo; harness. Correctness tests for various compiler
  76. features should go here if possible.
  77. </p>
  78. <p>Magic comments determine whether the file
  79. is preprocessed, compiled, linked or run. In these tests, error and warning
  80. message texts are compared against expected texts or regular expressions
  81. given in comments. These tests are run with the options &lsquo;<samp>-ansi -pedantic</samp>&rsquo;
  82. unless other options are given in the test. Except as noted below they
  83. are not run with multiple optimization options.
  84. </p></dd>
  85. <dt><samp>gcc.dg/compat</samp></dt>
  86. <dd><p>This subdirectory contains tests for binary compatibility using
  87. <samp>lib/compat.exp</samp>, which in turn uses the language-independent support
  88. (see <a href="compat-Testing.html#compat-Testing">Support for testing binary compatibility</a>).
  89. </p></dd>
  90. <dt><samp>gcc.dg/cpp</samp></dt>
  91. <dd><p>This subdirectory contains tests of the preprocessor.
  92. </p></dd>
  93. <dt><samp>gcc.dg/debug</samp></dt>
  94. <dd><p>This subdirectory contains tests for debug formats. Tests in this
  95. subdirectory are run for each debug format that the compiler supports.
  96. </p></dd>
  97. <dt><samp>gcc.dg/format</samp></dt>
  98. <dd><p>This subdirectory contains tests of the <samp>-Wformat</samp> format
  99. checking. Tests in this directory are run with and without
  100. <samp>-DWIDE</samp>.
  101. </p></dd>
  102. <dt><samp>gcc.dg/noncompile</samp></dt>
  103. <dd><p>This subdirectory contains tests of code that should not compile and
  104. does not need any special compilation options. They are run with
  105. multiple optimization options, since sometimes invalid code crashes
  106. the compiler with optimization.
  107. </p></dd>
  108. <dt><samp>gcc.dg/special</samp></dt>
  109. <dd><p>FIXME: describe this.
  110. </p>
  111. </dd>
  112. <dt><samp>gcc.c-torture</samp></dt>
  113. <dd><p>This contains particular code fragments which have historically broken easily.
  114. These tests are run with multiple optimization options, so tests for features
  115. which only break at some optimization levels belong here. This also contains
  116. tests to check that certain optimizations occur. It might be worthwhile to
  117. separate the correctness tests cleanly from the code quality tests, but
  118. it hasn&rsquo;t been done yet.
  119. </p>
  120. </dd>
  121. <dt><samp>gcc.c-torture/compat</samp></dt>
  122. <dd><p>FIXME: describe this.
  123. </p>
  124. <p>This directory should probably not be used for new tests.
  125. </p></dd>
  126. <dt><samp>gcc.c-torture/compile</samp></dt>
  127. <dd><p>This testsuite contains test cases that should compile, but do not
  128. need to link or run. These test cases are compiled with several
  129. different combinations of optimization options. All warnings are
  130. disabled for these test cases, so this directory is not suitable if
  131. you wish to test for the presence or absence of compiler warnings.
  132. While special options can be set, and tests disabled on specific
  133. platforms, by the use of <samp>.x</samp> files, mostly these test cases
  134. should not contain platform dependencies. FIXME: discuss how defines
  135. such as <code>STACK_SIZE</code> are used.
  136. </p></dd>
  137. <dt><samp>gcc.c-torture/execute</samp></dt>
  138. <dd><p>This testsuite contains test cases that should compile, link and run;
  139. otherwise the same comments as for <samp>gcc.c-torture/compile</samp> apply.
  140. </p></dd>
  141. <dt><samp>gcc.c-torture/execute/ieee</samp></dt>
  142. <dd><p>This contains tests which are specific to IEEE floating point.
  143. </p></dd>
  144. <dt><samp>gcc.c-torture/unsorted</samp></dt>
  145. <dd><p>FIXME: describe this.
  146. </p>
  147. <p>This directory should probably not be used for new tests.
  148. </p></dd>
  149. <dt><samp>gcc.misc-tests</samp></dt>
  150. <dd><p>This directory contains C tests that require special handling. Some
  151. of these tests have individual expect files, and others share
  152. special-purpose expect files:
  153. </p>
  154. <dl compact="compact">
  155. <dt><samp><code>bprob*.c</code></samp></dt>
  156. <dd><p>Test <samp>-fbranch-probabilities</samp> using
  157. <samp>gcc.misc-tests/bprob.exp</samp>, which
  158. in turn uses the generic, language-independent framework
  159. (see <a href="profopt-Testing.html#profopt-Testing">Support for testing profile-directed
  160. optimizations</a>).
  161. </p>
  162. </dd>
  163. <dt><samp><code>gcov*.c</code></samp></dt>
  164. <dd><p>Test <code>gcov</code> output using <samp>gcov.exp</samp>, which in turn uses the
  165. language-independent support (see <a href="gcov-Testing.html#gcov-Testing">Support for testing gcov</a>).
  166. </p>
  167. </dd>
  168. <dt><samp><code>i386-pf-*.c</code></samp></dt>
  169. <dd><p>Test i386-specific support for data prefetch using <samp>i386-prefetch.exp</samp>.
  170. </p></dd>
  171. </dl>
  172. </dd>
  173. <dt><samp>gcc.test-framework</samp></dt>
  174. <dd><dl compact="compact">
  175. <dt><samp><code>dg-*.c</code></samp></dt>
  176. <dd><p>Test the testsuite itself using <samp>gcc.test-framework/test-framework.exp</samp>.
  177. </p></dd>
  178. </dl>
  179. </dd>
  180. </dl>
  181. <p>FIXME: merge in <samp>testsuite/README.gcc</samp> and discuss the format of
  182. test cases and magic comments more.
  183. </p>
  184. <hr>
  185. <div class="header">
  186. <p>
  187. Next: <a href="LTO-Testing.html#LTO-Testing" accesskey="n" rel="next">LTO Testing</a>, Previous: <a href="Ada-Tests.html#Ada-Tests" accesskey="p" rel="prev">Ada Tests</a>, Up: <a href="Testsuites.html#Testsuites" accesskey="u" rel="up">Testsuites</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  188. </div>
  189. </body>
  190. </html>