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