annotate gcc/selftest-run-tests.c @ 128:fe568345ddd5

fix CbC-example
author mir3636
date Wed, 11 Apr 2018 19:32:28 +0900
parents 04ced10e8804
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Implementation of selftests.
kono
parents:
diff changeset
2 Copyright (C) 2015-2017 Free Software Foundation, Inc.
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"
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 /* This function needed to be split out from selftest.c as it references
kono
parents:
diff changeset
30 tests from the whole source tree, and so is within
kono
parents:
diff changeset
31 OBJS in Makefile.in, whereas selftest.o is within OBJS-libcommon.
kono
parents:
diff changeset
32 This allows us to embed tests within files in OBJS-libcommon without
kono
parents:
diff changeset
33 introducing a dependency on objects within OBJS. */
kono
parents:
diff changeset
34
kono
parents:
diff changeset
35 #if CHECKING_P
kono
parents:
diff changeset
36
kono
parents:
diff changeset
37 /* Run all tests, aborting if any fail. */
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 void
kono
parents:
diff changeset
40 selftest::run_tests ()
kono
parents:
diff changeset
41 {
kono
parents:
diff changeset
42 /* Makefile.in has -fself-test=$(srcdir)/testsuite/selftests, so that
kono
parents:
diff changeset
43 flag_self_test contains the path to the selftest subdirectory of the
kono
parents:
diff changeset
44 source tree (without a trailing slash). Copy it up to
kono
parents:
diff changeset
45 path_to_selftest_files, to avoid selftest.c depending on
kono
parents:
diff changeset
46 option-handling. */
kono
parents:
diff changeset
47 path_to_selftest_files = flag_self_test;
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 long start_time = get_run_time ();
kono
parents:
diff changeset
50
kono
parents:
diff changeset
51 /* Run all the tests, in hand-coded order of (approximate) dependencies:
kono
parents:
diff changeset
52 run the tests for lowest-level code first. */
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54 /* Sanity-check for selftests themselves. */
kono
parents:
diff changeset
55 selftest_c_tests ();
kono
parents:
diff changeset
56
kono
parents:
diff changeset
57 /* Low-level data structures. */
kono
parents:
diff changeset
58 bitmap_c_tests ();
kono
parents:
diff changeset
59 sbitmap_c_tests ();
kono
parents:
diff changeset
60 et_forest_c_tests ();
kono
parents:
diff changeset
61 hash_map_tests_c_tests ();
kono
parents:
diff changeset
62 hash_set_tests_c_tests ();
kono
parents:
diff changeset
63 vec_c_tests ();
kono
parents:
diff changeset
64 pretty_print_c_tests ();
kono
parents:
diff changeset
65 wide_int_cc_tests ();
kono
parents:
diff changeset
66 ggc_tests_c_tests ();
kono
parents:
diff changeset
67 sreal_c_tests ();
kono
parents:
diff changeset
68 fibonacci_heap_c_tests ();
kono
parents:
diff changeset
69 typed_splay_tree_c_tests ();
kono
parents:
diff changeset
70 unique_ptr_tests_cc_tests ();
kono
parents:
diff changeset
71
kono
parents:
diff changeset
72 /* Mid-level data structures. */
kono
parents:
diff changeset
73 input_c_tests ();
kono
parents:
diff changeset
74 tree_c_tests ();
kono
parents:
diff changeset
75 gimple_c_tests ();
kono
parents:
diff changeset
76 rtl_tests_c_tests ();
kono
parents:
diff changeset
77 read_rtl_function_c_tests ();
kono
parents:
diff changeset
78
kono
parents:
diff changeset
79 /* Higher-level tests, or for components that other selftests don't
kono
parents:
diff changeset
80 rely on. */
kono
parents:
diff changeset
81 diagnostic_show_locus_c_tests ();
kono
parents:
diff changeset
82 diagnostic_c_tests ();
kono
parents:
diff changeset
83 edit_context_c_tests ();
kono
parents:
diff changeset
84 fold_const_c_tests ();
kono
parents:
diff changeset
85 spellcheck_c_tests ();
kono
parents:
diff changeset
86 spellcheck_tree_c_tests ();
kono
parents:
diff changeset
87 tree_cfg_c_tests ();
kono
parents:
diff changeset
88
kono
parents:
diff changeset
89 /* This one relies on most of the above. */
kono
parents:
diff changeset
90 function_tests_c_tests ();
kono
parents:
diff changeset
91
kono
parents:
diff changeset
92 /* Run any target-specific selftests. */
kono
parents:
diff changeset
93 if (targetm.run_target_selftests)
kono
parents:
diff changeset
94 targetm.run_target_selftests ();
kono
parents:
diff changeset
95
kono
parents:
diff changeset
96 store_merging_c_tests ();
kono
parents:
diff changeset
97 predict_c_tests ();
kono
parents:
diff changeset
98
kono
parents:
diff changeset
99 /* Run any lang-specific selftests. */
kono
parents:
diff changeset
100 lang_hooks.run_lang_selftests ();
kono
parents:
diff changeset
101
kono
parents:
diff changeset
102 /* Force a GC at the end of the selftests, to shake out GC-related
kono
parents:
diff changeset
103 issues. For example, if any GC-managed items have buggy (or missing)
kono
parents:
diff changeset
104 finalizers, this last collection will ensure that things that were
kono
parents:
diff changeset
105 failed to be finalized can be detected by valgrind. */
kono
parents:
diff changeset
106 forcibly_ggc_collect ();
kono
parents:
diff changeset
107
kono
parents:
diff changeset
108 /* Finished running tests. */
kono
parents:
diff changeset
109 long finish_time = get_run_time ();
kono
parents:
diff changeset
110 long elapsed_time = finish_time - start_time;
kono
parents:
diff changeset
111
kono
parents:
diff changeset
112 fprintf (stderr,
kono
parents:
diff changeset
113 "-fself-test: %i pass(es) in %ld.%06ld seconds\n",
kono
parents:
diff changeset
114 num_passes,
kono
parents:
diff changeset
115 elapsed_time / 1000000, elapsed_time % 1000000);
kono
parents:
diff changeset
116 }
kono
parents:
diff changeset
117
kono
parents:
diff changeset
118 #endif /* #if CHECKING_P */