131
|
1 # Copyright (C) 2009-2018 Free Software Foundation, Inc.
|
111
|
2
|
|
3 # This program is free software; you can redistribute it and/or modify
|
|
4 # it under the terms of the GNU General Public License as published by
|
|
5 # the Free Software Foundation; either version 3 of the License, or
|
|
6 # (at your option) any later version.
|
|
7 #
|
|
8 # This program is distributed in the hope that it will be useful,
|
|
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11 # GNU General Public License for more details.
|
|
12 #
|
|
13 # You should have received a copy of the GNU General Public License
|
|
14 # along with GCC; see the file COPYING3. If not see
|
|
15 # <http://www.gnu.org/licenses/>.
|
|
16
|
|
17 # Test the functionality of the GCC plugin support
|
|
18
|
|
19 load_lib target-supports.exp
|
|
20 load_lib gcc-dg.exp
|
|
21
|
|
22 global TESTING_IN_BUILD_TREE
|
|
23 global ENABLE_PLUGIN
|
|
24
|
|
25 # The plugin testcases currently only work when the build tree is available.
|
|
26 # Also check whether the host supports plugins.
|
|
27 if { ![info exists TESTING_IN_BUILD_TREE] || ![info exists ENABLE_PLUGIN] } {
|
|
28 return
|
|
29 }
|
|
30
|
|
31 # If a testcase doesn't have special options, use these.
|
|
32 global DEFAULT_CFLAGS
|
|
33 if ![info exists DEFAULT_CFLAGS] then {
|
|
34 set DEFAULT_CFLAGS " -ansi -pedantic-errors"
|
|
35 }
|
|
36
|
|
37 # The procedures in plugin-support.exp need these parameters.
|
|
38 set default_flags $DEFAULT_CFLAGS
|
|
39
|
|
40 if $tracelevel then {
|
|
41 strace $tracelevel
|
|
42 }
|
|
43
|
|
44 # Load support procs.
|
|
45 load_lib plugin-support.exp
|
|
46
|
|
47 # These tests don't run runtest_file_p consistently if it
|
|
48 # doesn't return the same values, so disable parallelization
|
|
49 # of this *.exp file. The first parallel runtest to reach
|
|
50 # this will run all the tests serially.
|
|
51 if ![gcc_parallel_test_run_p plugin] {
|
|
52 return
|
|
53 }
|
|
54 gcc_parallel_test_enable 0
|
|
55
|
|
56 # Specify the plugin source file and the associated test files in a list.
|
|
57 # plugin_test_list={ {plugin1 test1 test2 ...} {plugin2 test1 ...} ... }
|
|
58 set plugin_test_list [list \
|
|
59 { selfassign.c self-assign-test-1.c self-assign-test-2.c } \
|
|
60 { ggcplug.c ggcplug-test-1.c } \
|
|
61 { one_time_plugin.c one_time-test-1.c } \
|
|
62 { start_unit_plugin.c start_unit-test-1.c } \
|
|
63 { finish_unit_plugin.c finish_unit-test-1.c } \
|
|
64 { wide-int_plugin.c wide-int-test-1.c } \
|
131
|
65 { poly-int-01_plugin.c poly-int-test-1.c } \
|
|
66 { poly-int-02_plugin.c poly-int-test-1.c } \
|
|
67 { poly-int-03_plugin.c poly-int-test-1.c } \
|
|
68 { poly-int-04_plugin.c poly-int-test-1.c } \
|
|
69 { poly-int-05_plugin.c poly-int-test-1.c } \
|
|
70 { poly-int-06_plugin.c poly-int-test-1.c } \
|
|
71 { poly-int-07_plugin.c poly-int-test-1.c } \
|
|
72 { diagnostic_group_plugin.c \
|
|
73 diagnostic-group-test-1.c } \
|
111
|
74 { diagnostic_plugin_test_show_locus.c \
|
|
75 diagnostic-test-show-locus-bw.c \
|
|
76 diagnostic-test-show-locus-color.c \
|
131
|
77 diagnostic-test-show-locus-no-labels.c \
|
|
78 diagnostic-test-show-locus-bw-line-numbers.c \
|
|
79 diagnostic-test-show-locus-bw-line-numbers-2.c \
|
|
80 diagnostic-test-show-locus-color-line-numbers.c \
|
111
|
81 diagnostic-test-show-locus-parseable-fixits.c \
|
131
|
82 diagnostic-test-show-locus-generate-patch.c }\
|
111
|
83 { diagnostic_plugin_test_tree_expression_range.c \
|
|
84 diagnostic-test-expressions-1.c } \
|
|
85 { diagnostic_plugin_show_trees.c \
|
|
86 diagnostic-test-show-trees-1.c } \
|
|
87 { diagnostic_plugin_test_string_literals.c \
|
|
88 diagnostic-test-string-literals-1.c \
|
|
89 diagnostic-test-string-literals-2.c \
|
|
90 diagnostic-test-string-literals-3.c \
|
|
91 diagnostic-test-string-literals-4.c } \
|
131
|
92 { diagnostic_plugin_test_inlining.c \
|
|
93 diagnostic-test-inlining-1.c \
|
|
94 diagnostic-test-inlining-2.c \
|
|
95 diagnostic-test-inlining-3.c \
|
|
96 diagnostic-test-inlining-4.c } \
|
111
|
97 { location_overflow_plugin.c \
|
|
98 location-overflow-test-1.c \
|
|
99 location-overflow-test-2.c } \
|
|
100 { must_tail_call_plugin.c \
|
|
101 must-tail-call-1.c \
|
|
102 must-tail-call-2.c } \
|
131
|
103 { expensive_selftests_plugin.c \
|
|
104 expensive-selftests-1.c } \
|
|
105 { dump_plugin.c \
|
|
106 dump-1.c \
|
|
107 dump-2.c } \
|
111
|
108 ]
|
|
109
|
|
110 foreach plugin_test $plugin_test_list {
|
|
111 # Replace each source file with its full-path name
|
|
112 for {set i 0} {$i < [llength $plugin_test]} {incr i} {
|
|
113 set basename [lindex $plugin_test $i]
|
|
114 set plugin_test [lreplace $plugin_test $i $i $srcdir/$subdir/$basename]
|
|
115 }
|
|
116 set plugin_src [lindex $plugin_test 0]
|
|
117 # If we're only testing specific files and this isn't one of them, skip it.
|
|
118 if ![runtest_file_p $runtests $plugin_src] then {
|
|
119 continue
|
|
120 }
|
|
121 # Skip tail call tests on targets that do not have sibcall_epilogue.
|
|
122 if {[regexp ".*must_tail_call_plugin.c" $plugin_src]
|
|
123 && [istarget arm*-*-*]
|
|
124 && [check_effective_target_arm_thumb1]} then {
|
|
125 continue
|
|
126 }
|
|
127 set plugin_input_tests [lreplace $plugin_test 0 0]
|
|
128 plugin-test-execute $plugin_src $plugin_input_tests
|
|
129 }
|
|
130
|
|
131 # run the plugindir tests
|
|
132
|
|
133 # Initialize `dg'.
|
|
134 dg-init
|
|
135
|
|
136 # Main loop.
|
|
137 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/plugindir*.\[cSi\]]] \
|
|
138 "" $DEFAULT_CFLAGS
|
|
139
|
|
140 # All done.
|
|
141 dg-finish
|
|
142
|
|
143 gcc_parallel_test_enable 1
|