Testsuite: cleanup printing of summary
[ghc.git] / testsuite / driver / testglobals.py
1 #
2 # (c) Simon Marlow 2002
3 #
4
5 # -----------------------------------------------------------------------------
6 # Configuration info
7
8 # There is a single global instance of this structure, stored in the
9 # variable config below. The fields of the structure are filled in by
10 # the appropriate config script(s) for this compiler/platform, in
11 # ../config.
12 #
13 # Bits of the structure may also be filled in from the command line,
14 # via the build system, using the '-e' option to runtests.
15
16 class TestConfig:
17 def __init__(self):
18
19 # Where the testsuite root is
20 self.top = ''
21
22 # Directories below which to look for test description files (foo.T)
23 self.rootdirs = []
24
25 # Run these tests only (run all tests if empty)
26 self.run_only_some_tests = False
27 self.only = set()
28
29 # Accept new output which differs from the sample?
30 self.accept = 0
31
32 # File in which to save the summary
33 self.summary_file = ''
34
35 # Should we print the summary?
36 # Disabling this is useful for Phabricator/Harbormaster
37 # logfiles, which are truncated to 30 lines. TODO. Revise if
38 # this is still true.
39 # Note that we have a separate flag for this, instead of
40 # overloading --verbose, as you might want to see the summary
41 # with --verbose=0.
42 self.no_print_summary = False
43
44 # File in which to save the times
45 self.times_file = ''
46
47 # What platform are we running on?
48 self.platform = ''
49 self.os = ''
50 self.arch = ''
51
52 # What is the wordsize (in bits) of this platform?
53 self.wordsize = ''
54
55 # Verbosity level
56 self.verbose = 3
57
58 # See Note [validate and testsuite speed] in toplevel Makefile.
59 self.speed = 1
60
61 self.list_broken = False
62
63 # Path to the compiler (stage2 by default)
64 self.compiler = ''
65 # and ghc-pkg
66 self.ghc_pkg = ''
67
68 # Is self.compiler a stage 1, 2 or 3 compiler?
69 self.stage = 2
70
71 # Flags we always give to this compiler
72 self.compiler_always_flags = []
73
74 # Which ways to run tests (when compiling and running respectively)
75 # Other ways are added from the command line if we have the appropriate
76 # libraries.
77 self.compile_ways = []
78 self.run_ways = []
79 self.other_ways = []
80
81 # The ways selected via the command line.
82 self.cmdline_ways = []
83
84 # Lists of flags for each way
85 self.way_flags = {}
86 self.way_rts_flags = {}
87
88 # Do we have vanilla libraries?
89 self.have_vanilla = False
90
91 # Do we have dynamic libraries?
92 self.have_dynamic = False
93
94 # Do we have profiling support?
95 self.have_profiling = False
96
97 # Do we have interpreter support?
98 self.have_interp = False
99
100 # Do we have shared libraries?
101 self.have_shared_libs = False
102
103 # Do we have SMP support?
104 self.have_smp = False
105
106 # Are we testing an in-tree compiler?
107 self.in_tree_compiler = True
108
109 # the timeout program
110 self.timeout_prog = ''
111 self.timeout = 300
112
113 # threads
114 self.threads = 1
115 self.use_threads = 0
116
117 # Should we skip performance tests
118 self.skip_perf_tests = False
119
120 global config
121 config = TestConfig()
122
123 def getConfig():
124 return config
125
126 # -----------------------------------------------------------------------------
127 # Information about the current test run
128
129 class TestRun:
130 def __init__(self):
131 self.start_time = None
132 self.total_tests = 0
133 self.total_test_cases = 0
134
135 self.n_tests_skipped = 0
136 self.n_expected_passes = 0
137 self.n_expected_failures = 0
138
139 self.missing_libs = []
140 self.framework_failures = []
141
142 self.unexpected_passes = []
143 self.unexpected_failures = []
144 self.unexpected_stat_failures = []
145
146 global t
147 t = TestRun()
148
149 def getTestRun():
150 return t
151
152 # -----------------------------------------------------------------------------
153 # Information about the current test
154
155 class TestOptions:
156 def __init__(self):
157 # skip this test?
158 self.skip = 0
159
160 # skip these ways
161 self.omit_ways = []
162
163 # skip all ways except these (None == do all ways)
164 self.only_ways = None
165
166 # add these ways to the default set
167 self.extra_ways = []
168
169 # the result we normally expect for this test
170 self.expect = 'pass'
171
172 # override the expected result for certain ways
173 self.expect_fail_for = []
174
175 # the stdin file that this test will use (empty for <name>.stdin)
176 self.stdin = ''
177
178 # don't compare output
179 self.ignore_output = 0
180
181 # We sometimes want to modify the compiler_always_flags, so
182 # they are copied from config.compiler_always_flags when we
183 # make a new instance of TestOptions.
184 self.compiler_always_flags = []
185
186 # extra compiler opts for this test
187 self.extra_hc_opts = ''
188
189 # extra run opts for this test
190 self.extra_run_opts = ''
191
192 # expected exit code
193 self.exit_code = 0
194
195 # extra files to clean afterward
196 self.clean_files = []
197
198 # extra files to copy to the testdir
199 self.extra_files = []
200
201 # which -t numeric fields do we want to look at, and what bounds must
202 # they fall within?
203 # Elements of these lists should be things like
204 # ('bytes allocated',
205 # 9300000000,
206 # 10)
207 # To allow a 10% deviation from 9300000000.
208 self.compiler_stats_range_fields = {}
209 self.stats_range_fields = {}
210
211 # should we run this test alone, i.e. not run it in parallel with
212 # any other threads
213 self.alone = False
214
215 # Does this test use a literate (.lhs) file?
216 self.literate = 0
217
218 # Does this test use a .c, .m or .mm file?
219 self.c_src = 0
220 self.objc_src = 0
221 self.objcpp_src = 0
222
223 # Does this test use a .cmm file?
224 self.cmm_src = 0
225
226 # Should we put .hi/.o files in a subdirectory?
227 self.outputdir = None
228
229 # Command to run before the test
230 self.pre_cmd = None
231
232 # Command to run for extra cleaning
233 self.clean_cmd = None
234
235 # Command wrapper: a function to apply to the command before running it
236 self.cmd_wrapper = None
237
238 # Prefix to put on the command before compiling it
239 self.compile_cmd_prefix = ''
240
241 # Extra output normalisation
242 self.extra_normaliser = lambda x: x
243
244 # Custom output checker, otherwise do a comparison with expected
245 # stdout file. Accepts two arguments: filename of actual stdout
246 # output, and a normaliser function given other test options
247 self.check_stdout = None
248
249 # Extra normalisation for compiler error messages
250 self.extra_errmsg_normaliser = lambda x: x
251
252 # Keep profiling callstacks.
253 self.keep_prof_callstacks = False
254
255 # The directory the test is in
256 self.testdir = '.'
257
258 # Should we redirect stdout and stderr to a single file?
259 self.combined_output = False
260
261 # How should the timeout be adjusted on this test?
262 self.compile_timeout_multiplier = 1.0
263 self.run_timeout_multiplier = 1.0
264
265 self.cleanup = True
266
267 # Sould we run tests in a local subdirectory (<testname>-run) or
268 # in temporary directory in /tmp? See Note [Running tests in /tmp].
269 self.local = True
270
271 # The default set of options
272 global default_testopts
273 default_testopts = TestOptions()
274
275 # (bug, directory, name) of tests marked broken
276 global brokens
277 brokens = []
278