C-Tests.html 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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-2017 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 5.2, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <title>GNU Compiler Collection (GCC) Internals: C Tests</title>
  20. <meta name="description" content="GNU Compiler Collection (GCC) Internals: C Tests">
  21. <meta name="keywords" content="GNU Compiler Collection (GCC) Internals: C Tests">
  22. <meta name="resource-type" content="document">
  23. <meta name="distribution" content="global">
  24. <meta name="Generator" content="makeinfo">
  25. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  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.smallquotation {font-size: smaller}
  36. div.display {margin-left: 3.2em}
  37. div.example {margin-left: 3.2em}
  38. div.indentedblock {margin-left: 3.2em}
  39. div.lisp {margin-left: 3.2em}
  40. div.smalldisplay {margin-left: 3.2em}
  41. div.smallexample {margin-left: 3.2em}
  42. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  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.nocodebreak {white-space:nowrap}
  54. span.nolinebreak {white-space:nowrap}
  55. span.roman {font-family:serif; font-weight:normal}
  56. span.sansserif {font-family:sans-serif; font-weight:normal}
  57. ul.no-bullet {list-style: none}
  58. -->
  59. </style>
  60. </head>
  61. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  62. <a name="C-Tests"></a>
  63. <div class="header">
  64. <p>
  65. 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>
  66. </div>
  67. <hr>
  68. <a name="C-Language-Testsuites"></a>
  69. <h3 class="section">7.4 C Language Testsuites</h3>
  70. <p>GCC contains the following C language testsuites, in the
  71. <samp>gcc/testsuite</samp> directory:
  72. </p>
  73. <dl compact="compact">
  74. <dt><samp>gcc.dg</samp></dt>
  75. <dd><p>This contains tests of particular features of the C compiler, using the
  76. more modern &lsquo;<samp>dg</samp>&rsquo; harness. Correctness tests for various compiler
  77. features should go here if possible.
  78. </p>
  79. <p>Magic comments determine whether the file
  80. is preprocessed, compiled, linked or run. In these tests, error and warning
  81. message texts are compared against expected texts or regular expressions
  82. given in comments. These tests are run with the options &lsquo;<samp>-ansi -pedantic</samp>&rsquo;
  83. unless other options are given in the test. Except as noted below they
  84. are not run with multiple optimization options.
  85. </p></dd>
  86. <dt><samp>gcc.dg/compat</samp></dt>
  87. <dd><p>This subdirectory contains tests for binary compatibility using
  88. <samp>lib/compat.exp</samp>, which in turn uses the language-independent support
  89. (see <a href="compat-Testing.html#compat-Testing">Support for testing binary compatibility</a>).
  90. </p></dd>
  91. <dt><samp>gcc.dg/cpp</samp></dt>
  92. <dd><p>This subdirectory contains tests of the preprocessor.
  93. </p></dd>
  94. <dt><samp>gcc.dg/debug</samp></dt>
  95. <dd><p>This subdirectory contains tests for debug formats. Tests in this
  96. subdirectory are run for each debug format that the compiler supports.
  97. </p></dd>
  98. <dt><samp>gcc.dg/format</samp></dt>
  99. <dd><p>This subdirectory contains tests of the <samp>-Wformat</samp> format
  100. checking. Tests in this directory are run with and without
  101. <samp>-DWIDE</samp>.
  102. </p></dd>
  103. <dt><samp>gcc.dg/noncompile</samp></dt>
  104. <dd><p>This subdirectory contains tests of code that should not compile and
  105. does not need any special compilation options. They are run with
  106. multiple optimization options, since sometimes invalid code crashes
  107. the compiler with optimization.
  108. </p></dd>
  109. <dt><samp>gcc.dg/special</samp></dt>
  110. <dd><p>FIXME: describe this.
  111. </p>
  112. </dd>
  113. <dt><samp>gcc.c-torture</samp></dt>
  114. <dd><p>This contains particular code fragments which have historically broken easily.
  115. These tests are run with multiple optimization options, so tests for features
  116. which only break at some optimization levels belong here. This also contains
  117. tests to check that certain optimizations occur. It might be worthwhile to
  118. separate the correctness tests cleanly from the code quality tests, but
  119. it hasn&rsquo;t been done yet.
  120. </p>
  121. </dd>
  122. <dt><samp>gcc.c-torture/compat</samp></dt>
  123. <dd><p>FIXME: describe this.
  124. </p>
  125. <p>This directory should probably not be used for new tests.
  126. </p></dd>
  127. <dt><samp>gcc.c-torture/compile</samp></dt>
  128. <dd><p>This testsuite contains test cases that should compile, but do not
  129. need to link or run. These test cases are compiled with several
  130. different combinations of optimization options. All warnings are
  131. disabled for these test cases, so this directory is not suitable if
  132. you wish to test for the presence or absence of compiler warnings.
  133. While special options can be set, and tests disabled on specific
  134. platforms, by the use of <samp>.x</samp> files, mostly these test cases
  135. should not contain platform dependencies. FIXME: discuss how defines
  136. such as <code>NO_LABEL_VALUES</code> and <code>STACK_SIZE</code> are used.
  137. </p></dd>
  138. <dt><samp>gcc.c-torture/execute</samp></dt>
  139. <dd><p>This testsuite contains test cases that should compile, link and run;
  140. otherwise the same comments as for <samp>gcc.c-torture/compile</samp> apply.
  141. </p></dd>
  142. <dt><samp>gcc.c-torture/execute/ieee</samp></dt>
  143. <dd><p>This contains tests which are specific to IEEE floating point.
  144. </p></dd>
  145. <dt><samp>gcc.c-torture/unsorted</samp></dt>
  146. <dd><p>FIXME: describe this.
  147. </p>
  148. <p>This directory should probably not be used for new tests.
  149. </p></dd>
  150. <dt><samp>gcc.misc-tests</samp></dt>
  151. <dd><p>This directory contains C tests that require special handling. Some
  152. of these tests have individual expect files, and others share
  153. special-purpose expect files:
  154. </p>
  155. <dl compact="compact">
  156. <dt><samp><code>bprob*.c</code></samp></dt>
  157. <dd><p>Test <samp>-fbranch-probabilities</samp> using
  158. <samp>gcc.misc-tests/bprob.exp</samp>, which
  159. in turn uses the generic, language-independent framework
  160. (see <a href="profopt-Testing.html#profopt-Testing">Support for testing profile-directed
  161. optimizations</a>).
  162. </p>
  163. </dd>
  164. <dt><samp><code>gcov*.c</code></samp></dt>
  165. <dd><p>Test <code>gcov</code> output using <samp>gcov.exp</samp>, which in turn uses the
  166. language-independent support (see <a href="gcov-Testing.html#gcov-Testing">Support for testing gcov</a>).
  167. </p>
  168. </dd>
  169. <dt><samp><code>i386-pf-*.c</code></samp></dt>
  170. <dd><p>Test i386-specific support for data prefetch using <samp>i386-prefetch.exp</samp>.
  171. </p></dd>
  172. </dl>
  173. </dd>
  174. <dt><samp>gcc.test-framework</samp></dt>
  175. <dd><dl compact="compact">
  176. <dt><samp><code>dg-*.c</code></samp></dt>
  177. <dd><p>Test the testsuite itself using <samp>gcc.test-framework/test-framework.exp</samp>.
  178. </p></dd>
  179. </dl>
  180. </dd>
  181. </dl>
  182. <p>FIXME: merge in <samp>testsuite/README.gcc</samp> and discuss the format of
  183. test cases and magic comments more.
  184. </p>
  185. <hr>
  186. <div class="header">
  187. <p>
  188. 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>
  189. </div>
  190. </body>
  191. </html>