annotate gcc/selftest-run-tests.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Implementation of selftests.
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2 Copyright (C) 2015-2020 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 This file is part of GCC.
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 GCC is free software; you can redistribute it and/or modify it under
kono
parents:
diff changeset
7 the terms of the GNU General Public License as published by the Free
kono
parents:
diff changeset
8 Software Foundation; either version 3, or (at your option) any later
kono
parents:
diff changeset
9 version.
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
kono
parents:
diff changeset
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
kono
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
kono
parents:
diff changeset
14 for more details.
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
17 along with GCC; see the file COPYING3. If not see
kono
parents:
diff changeset
18 <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 #include "config.h"
kono
parents:
diff changeset
21 #include "system.h"
kono
parents:
diff changeset
22 #include "coretypes.h"
kono
parents:
diff changeset
23 #include "selftest.h"
kono
parents:
diff changeset
24 #include "tree.h"
kono
parents:
diff changeset
25 #include "target.h"
kono
parents:
diff changeset
26 #include "langhooks.h"
kono
parents:
diff changeset
27 #include "options.h"
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
28 #include "stringpool.h"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
29 #include "attribs.h"
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
30 #include "analyzer/analyzer-selftests.h"
111
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 /* This function needed to be split out from selftest.c as it references
kono
parents:
diff changeset
33 tests from the whole source tree, and so is within
kono
parents:
diff changeset
34 OBJS in Makefile.in, whereas selftest.o is within OBJS-libcommon.
kono
parents:
diff changeset
35 This allows us to embed tests within files in OBJS-libcommon without
kono
parents:
diff changeset
36 introducing a dependency on objects within OBJS. */
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 #if CHECKING_P
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 /* Run all tests, aborting if any fail. */
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 void
kono
parents:
diff changeset
43 selftest::run_tests ()
kono
parents:
diff changeset
44 {
kono
parents:
diff changeset
45 /* Makefile.in has -fself-test=$(srcdir)/testsuite/selftests, so that
kono
parents:
diff changeset
46 flag_self_test contains the path to the selftest subdirectory of the
kono
parents:
diff changeset
47 source tree (without a trailing slash). Copy it up to
kono
parents:
diff changeset
48 path_to_selftest_files, to avoid selftest.c depending on
kono
parents:
diff changeset
49 option-handling. */
kono
parents:
diff changeset
50 path_to_selftest_files = flag_self_test;
kono
parents:
diff changeset
51
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
52 test_runner r ("-fself-test");
111
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54 /* Run all the tests, in hand-coded order of (approximate) dependencies:
kono
parents:
diff changeset
55 run the tests for lowest-level code first. */
kono
parents:
diff changeset
56
kono
parents:
diff changeset
57 /* Sanity-check for selftests themselves. */
kono
parents:
diff changeset
58 selftest_c_tests ();
kono
parents:
diff changeset
59
kono
parents:
diff changeset
60 /* Low-level data structures. */
kono
parents:
diff changeset
61 bitmap_c_tests ();
kono
parents:
diff changeset
62 sbitmap_c_tests ();
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
63 dumpfile_c_tests ();
111
kono
parents:
diff changeset
64 et_forest_c_tests ();
kono
parents:
diff changeset
65 hash_map_tests_c_tests ();
kono
parents:
diff changeset
66 hash_set_tests_c_tests ();
kono
parents:
diff changeset
67 vec_c_tests ();
kono
parents:
diff changeset
68 pretty_print_c_tests ();
kono
parents:
diff changeset
69 wide_int_cc_tests ();
kono
parents:
diff changeset
70 ggc_tests_c_tests ();
kono
parents:
diff changeset
71 sreal_c_tests ();
kono
parents:
diff changeset
72 fibonacci_heap_c_tests ();
kono
parents:
diff changeset
73 typed_splay_tree_c_tests ();
kono
parents:
diff changeset
74 unique_ptr_tests_cc_tests ();
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
75 opt_proposer_c_tests ();
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
76 json_cc_tests ();
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
77 cgraph_c_tests ();
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
78 optinfo_emit_json_cc_tests ();
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
79 opt_problem_cc_tests ();
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
80 ordered_hash_map_tests_cc_tests ();
111
kono
parents:
diff changeset
81
kono
parents:
diff changeset
82 /* Mid-level data structures. */
kono
parents:
diff changeset
83 input_c_tests ();
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
84 vec_perm_indices_c_tests ();
111
kono
parents:
diff changeset
85 tree_c_tests ();
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
86 convert_c_tests ();
111
kono
parents:
diff changeset
87 gimple_c_tests ();
kono
parents:
diff changeset
88 rtl_tests_c_tests ();
kono
parents:
diff changeset
89 read_rtl_function_c_tests ();
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
90 digraph_cc_tests ();
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
91 tristate_cc_tests ();
111
kono
parents:
diff changeset
92
kono
parents:
diff changeset
93 /* Higher-level tests, or for components that other selftests don't
kono
parents:
diff changeset
94 rely on. */
kono
parents:
diff changeset
95 diagnostic_show_locus_c_tests ();
kono
parents:
diff changeset
96 diagnostic_c_tests ();
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
97 diagnostic_format_json_cc_tests ();
111
kono
parents:
diff changeset
98 edit_context_c_tests ();
kono
parents:
diff changeset
99 fold_const_c_tests ();
kono
parents:
diff changeset
100 spellcheck_c_tests ();
kono
parents:
diff changeset
101 spellcheck_tree_c_tests ();
kono
parents:
diff changeset
102 tree_cfg_c_tests ();
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
103 tree_diagnostic_path_cc_tests ();
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
104 attribute_c_tests ();
111
kono
parents:
diff changeset
105
kono
parents:
diff changeset
106 /* This one relies on most of the above. */
kono
parents:
diff changeset
107 function_tests_c_tests ();
kono
parents:
diff changeset
108
kono
parents:
diff changeset
109 /* Run any target-specific selftests. */
kono
parents:
diff changeset
110 if (targetm.run_target_selftests)
kono
parents:
diff changeset
111 targetm.run_target_selftests ();
kono
parents:
diff changeset
112
kono
parents:
diff changeset
113 store_merging_c_tests ();
kono
parents:
diff changeset
114 predict_c_tests ();
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
115 simplify_rtx_c_tests ();
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
116 dbgcnt_c_tests ();
111
kono
parents:
diff changeset
117
kono
parents:
diff changeset
118 /* Run any lang-specific selftests. */
kono
parents:
diff changeset
119 lang_hooks.run_lang_selftests ();
kono
parents:
diff changeset
120
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
121 /* Run the analyzer selftests (if enabled). */
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
122 ana::selftest::run_analyzer_selftests ();
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
123
111
kono
parents:
diff changeset
124 /* Force a GC at the end of the selftests, to shake out GC-related
kono
parents:
diff changeset
125 issues. For example, if any GC-managed items have buggy (or missing)
kono
parents:
diff changeset
126 finalizers, this last collection will ensure that things that were
kono
parents:
diff changeset
127 failed to be finalized can be detected by valgrind. */
kono
parents:
diff changeset
128 forcibly_ggc_collect ();
kono
parents:
diff changeset
129
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
130 /* Finished running tests; the test_runner dtor will print a summary. */
111
kono
parents:
diff changeset
131 }
kono
parents:
diff changeset
132
kono
parents:
diff changeset
133 #endif /* #if CHECKING_P */