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