all-non-failing-tests.h 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. /* This file is used by test-combination.c and test-threads.c to
  2. bring all of the non-failing test cases into one source file,
  3. renaming each "create_code" and "verify_code" hook so that they
  4. each have unique name. */
  5. /* Include various other test cases, defining COMBINED_TEST so that
  6. harness.h doesn't duplicate copes of e.g. main, and renaming the
  7. hooks provided by each test case. */
  8. #define COMBINED_TEST
  9. /* test-accessing-struct.c */
  10. #define create_code create_code_accessing_struct
  11. #define verify_code verify_code_accessing_struct
  12. #include "test-accessing-struct.c"
  13. #undef create_code
  14. #undef verify_code
  15. /* test-accessing-union.c */
  16. #define create_code create_code_accessing_union
  17. #define verify_code verify_code_accessing_union
  18. #include "test-accessing-union.c"
  19. #undef create_code
  20. #undef verify_code
  21. /* test-arith-overflow.c */
  22. #define create_code create_code_arith_overflow
  23. #define verify_code verify_code_arith_overflow
  24. #include "test-arith-overflow.c"
  25. #undef create_code
  26. #undef verify_code
  27. /* test-array-as-pointer.c */
  28. #define create_code create_code_array_as_pointer
  29. #define verify_code verify_code_array_as_pointer
  30. #include "test-array-as-pointer.c"
  31. #undef create_code
  32. #undef verify_code
  33. /* test-arrays.c */
  34. #define create_code create_code_arrays
  35. #define verify_code verify_code_arrays
  36. #include "test-arrays.c"
  37. #undef create_code
  38. #undef verify_code
  39. /* test-calling-external-function.c */
  40. #define create_code create_code_calling_external_function
  41. #define verify_code verify_code_calling_external_function
  42. #include "test-calling-external-function.c"
  43. #undef create_code
  44. #undef verify_code
  45. /* test-calling-function-ptr.c */
  46. #define create_code create_code_calling_function_ptr
  47. #define verify_code verify_code_calling_function_ptr
  48. #include "test-calling-function-ptr.c"
  49. #undef create_code
  50. #undef verify_code
  51. /* test-compound-assignment.c */
  52. #define create_code create_code_compound_assignment
  53. #define verify_code verify_code_compound_assignment
  54. #include "test-compound-assignment.c"
  55. #undef create_code
  56. #undef verify_code
  57. /* test-constants.c */
  58. #define create_code create_code_constants
  59. #define verify_code verify_code_constants
  60. #include "test-constants.c"
  61. #undef create_code
  62. #undef verify_code
  63. /* test-debug-strings.c */
  64. #define create_code create_code_debug_strings
  65. #define verify_code verify_code_debug_strings
  66. #include "test-debug-strings.c"
  67. #undef create_code
  68. #undef verify_code
  69. /* test-dot-product.c */
  70. #define create_code create_code_dot_product
  71. #define verify_code verify_code_dot_product
  72. #include "test-dot-product.c"
  73. #undef create_code
  74. #undef verify_code
  75. /* test-error-*.c: We don't use these test cases, since they deliberately
  76. introduce errors, which we don't want here. */
  77. /* test-expressions.c */
  78. #define create_code create_code_expressions
  79. #define verify_code verify_code_expressions
  80. #include "test-expressions.c"
  81. #undef create_code
  82. #undef verify_code
  83. /* test-extra-options.c: We don't use this one, since the extra options
  84. affect the whole context. */
  85. /* test-factorial.c */
  86. #define create_code create_code_factorial
  87. #define verify_code verify_code_factorial
  88. #include "test-factorial.c"
  89. #undef create_code
  90. #undef verify_code
  91. /* test-fibonacci.c */
  92. #define create_code create_code_fibonacci
  93. #define verify_code verify_code_fibonacci
  94. #include "test-fibonacci.c"
  95. #undef create_code
  96. #undef verify_code
  97. /* test-functions.c */
  98. #define create_code create_code_functions
  99. #define verify_code verify_code_functions
  100. #include "test-functions.c"
  101. #undef create_code
  102. #undef verify_code
  103. /* test-hello-world.c */
  104. #define create_code create_code_hello_world
  105. #define verify_code verify_code_hello_world
  106. #include "test-hello-world.c"
  107. #undef create_code
  108. #undef verify_code
  109. /* test-linked-list.c */
  110. #define create_code create_code_linked_list
  111. #define verify_code verify_code_linked_list
  112. #include "test-linked-list.c"
  113. #undef create_code
  114. #undef verify_code
  115. /* test-long-names.c */
  116. #define create_code create_code_long_names
  117. #define verify_code verify_code_long_names
  118. #include "test-long-names.c"
  119. #undef create_code
  120. #undef verify_code
  121. /* test-quadratic.c */
  122. #define create_code create_code_quadratic
  123. #define verify_code verify_code_quadratic
  124. #include "test-quadratic.c"
  125. #undef create_code
  126. #undef verify_code
  127. /* test-nested-loops.c */
  128. #define create_code create_code_nested_loop
  129. #define verify_code verify_code_nested_loop
  130. #include "test-nested-loops.c"
  131. #undef create_code
  132. #undef verify_code
  133. /* test-pr66700-observing-write-through-ptr.c */
  134. #define create_code create_code_pr66700_observing_write_through_ptr
  135. #define verify_code verify_code_pr66700_observing_write_through_ptr
  136. #include "test-pr66700-observing-write-through-ptr.c"
  137. #undef create_code
  138. #undef verify_code
  139. /* test-reading-struct.c */
  140. #define create_code create_code_reading_struct
  141. #define verify_code verify_code_reading_struct
  142. #include "test-reading-struct.c"
  143. #undef create_code
  144. #undef verify_code
  145. /* test-string-literal.c */
  146. #define create_code create_code_string_literal
  147. #define verify_code verify_code_string_literal
  148. #include "test-string-literal.c"
  149. #undef create_code
  150. #undef verify_code
  151. /* test-sum-of-squares.c */
  152. #define create_code create_code_sum_of_squares
  153. #define verify_code verify_code_sum_of_squares
  154. #include "test-sum-of-squares.c"
  155. #undef create_code
  156. #undef verify_code
  157. /* test-switch.c */
  158. #define create_code create_code_switch
  159. #define verify_code verify_code_switch
  160. #include "test-switch.c"
  161. #undef create_code
  162. #undef verify_code
  163. /* test-types.c */
  164. #define create_code create_code_types
  165. #define verify_code verify_code_types
  166. #include "test-types.c"
  167. #undef create_code
  168. #undef verify_code
  169. /* test-using-global.c */
  170. #define create_code create_code_using_global
  171. #define verify_code verify_code_using_global
  172. #include "test-using-global.c"
  173. #undef create_code
  174. #undef verify_code
  175. /* test-validly-unreachable-block.c: We don't use this one, since the use
  176. of gcc_jit_context_set_bool_allow_unreachable_blocks affects the whole
  177. context. */
  178. /* test-volatile.c */
  179. #define create_code create_code_volatile
  180. #define verify_code verify_code_volatile
  181. #include "test-volatile.c"
  182. #undef create_code
  183. #undef verify_code
  184. /* Now expose the individual testcases as instances of this struct. */
  185. struct testcase
  186. {
  187. const char *m_name;
  188. void (*m_hook_to_create_code) (gcc_jit_context *ctxt,
  189. void * user_data);
  190. void (*m_hook_to_verify_code) (gcc_jit_context *ctxt,
  191. gcc_jit_result *result);
  192. };
  193. const struct testcase testcases[] = {
  194. {"accessing_struct",
  195. create_code_accessing_struct,
  196. verify_code_accessing_struct},
  197. {"accessing_union",
  198. create_code_accessing_union,
  199. verify_code_accessing_union},
  200. {"arith_overflow",
  201. create_code_arith_overflow,
  202. verify_code_arith_overflow},
  203. {"array_as_pointer",
  204. create_code_array_as_pointer,
  205. verify_code_array_as_pointer},
  206. {"arrays",
  207. create_code_arrays,
  208. verify_code_arrays},
  209. {"calling_external_function",
  210. create_code_calling_external_function,
  211. verify_code_calling_external_function},
  212. {"calling_function_ptr",
  213. create_code_calling_function_ptr,
  214. verify_code_calling_function_ptr},
  215. {"compound_assignment",
  216. create_code_compound_assignment,
  217. verify_code_compound_assignment},
  218. {"constants",
  219. create_code_constants,
  220. verify_code_constants},
  221. {"debug_strings",
  222. create_code_debug_strings,
  223. verify_code_debug_strings},
  224. {"dot_product",
  225. create_code_dot_product,
  226. verify_code_dot_product},
  227. {"expressions",
  228. create_code_expressions,
  229. verify_code_expressions},
  230. {"factorial",
  231. create_code_factorial,
  232. verify_code_factorial},
  233. {"fibonacci",
  234. create_code_fibonacci,
  235. verify_code_fibonacci},
  236. {"functions",
  237. create_code_functions,
  238. verify_code_functions},
  239. {"hello_world",
  240. create_code_hello_world,
  241. verify_code_hello_world},
  242. {"linked_list",
  243. create_code_linked_list,
  244. verify_code_linked_list},
  245. {"long_names",
  246. create_code_long_names,
  247. verify_code_long_names},
  248. {"quadratic",
  249. create_code_quadratic,
  250. verify_code_quadratic},
  251. {"nested_loop",
  252. create_code_nested_loop,
  253. verify_code_nested_loop},
  254. {"pr66700_observing_write_through_ptr",
  255. create_code_pr66700_observing_write_through_ptr,
  256. verify_code_pr66700_observing_write_through_ptr},
  257. {"reading_struct ",
  258. create_code_reading_struct ,
  259. verify_code_reading_struct },
  260. {"string_literal",
  261. create_code_string_literal,
  262. verify_code_string_literal},
  263. {"sum_of_squares",
  264. create_code_sum_of_squares,
  265. verify_code_sum_of_squares},
  266. {"switch",
  267. create_code_switch,
  268. verify_code_switch},
  269. {"types",
  270. create_code_types,
  271. verify_code_types},
  272. {"using_global",
  273. create_code_using_global,
  274. verify_code_using_global},
  275. {"volatile",
  276. create_code_volatile,
  277. verify_code_volatile}
  278. };
  279. const int num_testcases = (sizeof (testcases) / sizeof (testcases[0]));