Merge non-moving garbage collector
[ghc.git] / libraries / base / tests / all.T
1 import string
2 import re
3
4 #--------------------------------------
5 # Python normalization functions
6 #--------------------------------------
7
8 def normalise_quotes (str):
9   str = re.sub(r'"',r'', str, flags=re.MULTILINE)
10   return str
11
12 #--------------------------------------
13 # Test functions
14 #--------------------------------------
15 test('readFloat', exit_code(1), compile_and_run, [''])
16 test('enumDouble', normal, compile_and_run, [''])
17 test('enumRatio', normal, compile_and_run, [''])
18 test('enumNumeric', normal, compile_and_run, [''])
19 test('tempfiles', normal, compile_and_run, [''])
20 test('fixed', normal, compile_and_run, [''])
21 test('quotOverflow', normal, compile_and_run, [''])
22 test('assert', exit_code(1), compile_and_run, ['-fno-ignore-asserts'])
23 test('CPUTime001', fragile(16224), compile_and_run, [''])
24 test('readLitChar',   normal, compile_and_run, [''])
25 test('unicode001',
26      when(platform('i386-unknown-openbsd'), expect_fail),
27      compile_and_run,
28      [''])
29 test('unicode002',
30      when(platform('i386-unknown-openbsd'), expect_fail),
31      compile_and_run,
32      [''])
33 test('data-fixed-show-read', normal, compile_and_run, [''])
34 test('showDouble', normal, compile_and_run, [''])
35 test('readDouble001', normal, compile_and_run, [''])
36 test('readInteger001', normal, compile_and_run, [''])
37 test('readFixed001', normal, compile_and_run, [''])
38 test('lex001', normal, compile_and_run, [''])
39 test('take001', extra_run_opts('1'), compile_and_run, [''])
40 test('inits', normal, compile_and_run, [''])
41 test('genericNegative001', extra_run_opts('-1'), compile_and_run, [''])
42 test('ix001', normal, compile_and_run, [''])
43 test('isValidNatural', reqlib('integer-gmp'), compile_and_run, [''])
44
45 # need to add -K64m to the compiler opts, so that GHCi gets it too
46 test('ioref001',
47      [when(fast(), skip),extra_run_opts('+RTS -K64m -RTS')],
48      compile_and_run,
49      ['+RTS -K64m -RTS'])
50
51 test('echo001', set_stdin("echo001.hs"), compile_and_run, [''])
52
53 test('hTell001', normal, compile_and_run, [''])
54
55 test('hTell002', normal, compile_and_run, [''])
56
57 test('performGC001', normal, compile_and_run, [''])
58
59 # optimisation screws up this test because some of the traces get commoned up
60 test('trace001', normal, compile_and_run, [''])
61
62 test('hGetBuf002', normal, compile_and_run, [''])
63 test('hGetBuf003', normal, compile_and_run, [''])
64 test('hPutBuf001', normal, compile_and_run, [''])
65 test('hPutBuf002', [], compile_and_run, [''])
66
67 test('char001',         normal, compile_and_run, [''])
68 test('char002',         normal, compile_and_run, [''])
69
70 test('cstring001',      normal, compile_and_run, [''])
71
72 test('length001',
73      # length001 depends on a RULE being applied, and without -O takes
74      # excessive amounts of stack space. So we specifically set a low
75      # stack limit and mark it as failing under a few conditions.
76      [extra_run_opts('+RTS -K8m -RTS'),
77      expect_fail_for(['normal', 'threaded1', 'llvm', 'nonmoving', 'nonmoving_thr', 'nonmoving_thr_ghc'])],
78      compile_and_run, [''])
79
80 test('ratio001',        normal, compile_and_run, [''])
81
82 test('rand001',         reqlib('random'), compile_and_run, [''])
83 test('reads001',                normal, compile_and_run, [''])
84 test('show001',         normal, compile_and_run, [''])
85 test('text001',         normal, compile_and_run, [''])
86
87 test('tup001',          normal, compile_and_run, [''])
88
89 test('addr001',         normal, compile_and_run, [''])
90 test('dynamic001',      normal, compile_and_run, [''])
91 test('dynamic002',      normal, compile_and_run, [''])
92 test('dynamic003',      extra_run_opts('+RTS -K32m -RTS'), compile_and_run, [''])
93 test('dynamic004',      omit_ways(['normal', 'threaded1', 'ghci']), compile_and_run, [''])
94 test('dynamic005',      normal, compile_and_run, [''])
95
96 enum_setups = [when(fast(), skip)]
97 def enum_test(name):
98     """
99     These tests have a funky Python preprocessor which require some headstands
100     to run on Windows.
101     """
102     if opsys('mingw32'):
103         test(name,
104              [when(opsys('mingw32'), extra_files(['enum_processor.bat'])),
105               extra_files(['enum_processor.py'])],
106              compile_and_run,
107              ['-F -pgmF ./enum_processor.bat'])
108     else:
109         test(name,
110              [extra_files(['enum_processor.py'])],
111              compile_and_run,
112              ['-F -pgmF ./enum_processor.py'])
113
114 enum_test('enum01')
115 enum_test('enum02')
116 enum_test('enum03')
117 test('enum04', normal, compile_and_run, [''])
118
119 test('exceptionsrun001',        normal, compile_and_run, [''])
120 test('exceptionsrun002',        normal, compile_and_run, [''])
121 test('foldableArray',   normal, compile_and_run, [''])
122 test('list001'  ,       when(fast(), skip), compile_and_run, [''])
123 test('list002', when(fast(), skip), compile_and_run, [''])
124 test('list003', when(fast(), skip), compile_and_run, [''])
125 test('isSuffixOf', normal, compile_and_run, [''])
126
127 test('memo001', [extra_files(['Memo1.lhs']),
128                  extra_run_opts('+RTS -A10k -RTS')], multimod_compile_and_run,
129      ['memo001', ''])
130
131 test('memo002', [extra_files(['Memo2.lhs']),
132                  extra_run_opts('20')], multimod_compile_and_run,
133      ['memo002', ''])
134
135 test('stableptr001',
136      [when(fast(), skip), extra_run_opts('+RTS -K8m -RTS')],
137      compile_and_run, [''])
138 test('stableptr003', normal, compile_and_run, [''])
139 test('stableptr004', extra_run_opts('+RTS -K4m -RTS'), compile_and_run, [''])
140 test('stableptr005', normal, compile_and_run, [''])
141
142 test('weak001', normal, compile_and_run, [''])
143
144 test('T2528', normal, compile_and_run, [''])
145
146 # In the 65001 codepage, we can't even cat the expected output on msys:
147 #     $ cat 4006.stdout
148 #     It works here
149 #     cat: write error: Permission denied
150 # Seems to be a known problem, e.g.
151 #     http://mingw-users.1079350.n2.nabble.com/Bug-re-Unicode-on-the-console-td3121717.html
152 # May 2014: seems to work on msys2
153 # May 2018: The behavior of printf seems very implementation dependent.
154 #     so let's normalise the output.
155 test('T4006', normalise_fun(normalise_quotes), compile_and_run, [''])
156
157 test('T5943', normal, compile_and_run, [''])
158 test('T5962', normal, compile_and_run, [''])
159 test('T7034', normal, compile_and_run, [''])
160
161 test('qsem001', normal, compile_and_run, [''])
162 test('qsemn001', normal, compile_and_run, [''])
163
164 test('T7457', normal, compile_and_run, [''])
165
166 test('T7773', when(opsys('mingw32'), skip), compile_and_run, [''])
167 # Andreas says that T7773 will not (and should not) work on Windows
168
169 # Tests for kind-polymorphic Category
170 test('CatPairs', normal, compile, [''])
171 test('CatEntail', normal, compile, [''])
172
173 # When running with WAY=ghci and profiled ways, T7653 uses a lot of memory.
174 test('T7653', omit_ways(prof_ways+['ghci']), compile_and_run, [''])
175 test('T7787', normal, compile_and_run, [''])
176
177 test('topHandler01', when(opsys('mingw32'), skip), compile_and_run, [''])
178 test('topHandler02',
179      [when(opsys('mingw32'), skip),
180       omit_ways(['ghci']),
181       signal_exit_code(2)
182      ], compile_and_run, [''])
183 test('topHandler03',
184      [when(opsys('mingw32'), skip), ignore_stderr,
185       signal_exit_code(15)
186      ], compile_and_run, [''])
187 test('topHandler04',
188      [when(opsys('mingw32'), skip),
189       exit_code(1)
190      ], compile_and_run, [''])
191
192
193 test('T8766',
194         [ collect_stats('bytes allocated',5)
195         , only_ways(['normal'])],
196       compile_and_run,
197       ['-O'])
198
199 test('T9111', normal, compile, [''])
200 test('T9395', normal, compile_and_run, [''])
201 # Fails for debug way due to annotation linting timeout
202 test('T9532', omit_ways(['debug']), compile_and_run, [''])
203 test('T9586', normal, compile, [''])
204 test('T9681', normal, compile_fail, [''])
205 # Test no runtime crash. Report success and kill with `timeout` (exit code 99)
206 # after a few seconds. From https://phabricator.haskell.org/D1075:
207 #
208 #   "I used a fairly conservative timeout. IF there is a regression it will
209 #   crash as soon as the timeout's C call is done. The tricky bit is
210 #   guesstimating how much time it needs to run to guarantee it's reached the
211 #   C call.
212 #   Probably something like 1s is already enough, but I don't know enough to
213 #   make an educated guess how long it needs to be guaranteed to reach the C
214 #   call."
215 test('T8089',
216      [exit_code(99), run_timeout_multiplier(0.01)],
217      compile_and_run, [''])
218 test('hWaitForInput-accurate-socket', reqlib('unix'), compile_and_run, [''])
219 test('T8684', expect_broken(8684), compile_and_run, [''])
220 test('hWaitForInput-accurate-stdin', [expect_broken_for(16535, threaded_ways), omit_ways(['ghci'])], compile_and_run, [''])
221 test('hWaitForInput-accurate-pipe', reqlib('unix'), compile_and_run, [''])
222 test('T9826',normal, compile_and_run,[''])
223 test('T9848',
224         [ collect_stats('bytes allocated')
225         , only_ways(['normal'])],
226       compile_and_run,
227       ['-O'])
228 test('T10149', normal, compile_and_run, [''])
229 test('T11334a', normal, compile_and_run, [''])
230 test('T11555', normal, compile_and_run, [''])
231 test('T12494', normal, compile_and_run, [''])
232 test('T12852', when(opsys('mingw32'), skip), compile_and_run, [''])
233 test('lazySTexamples', normal, compile_and_run, [''])
234 test('T11760', req_smp, compile_and_run, ['-threaded -with-rtsopts=-N2'])
235 test('T12874', normal, compile_and_run, [''])
236 test('T13191',
237         [ collect_stats('bytes allocated', 5)
238         , only_ways(['normal'])],
239       compile_and_run,
240       ['-O'])
241 test('T13525', when(opsys('mingw32'), skip), compile_and_run, [''])
242 test('T13097', normal, compile_and_run, [''])
243 test('functorOperators', normal, compile_and_run, [''])
244 test('T3474',
245      [collect_stats('max_bytes_used',5),
246       only_ways(['normal'])],
247      compile_and_run, ['-O'])
248 test('T14425', normal, compile_and_run, [''])
249 test('T10412', normal, compile_and_run, [''])
250 test('T13896', normal, compile_and_run, [''])
251 test('T13167', fragile_for(16536, ['threaded2']), compile_and_run, [''])
252 test('T15349', [exit_code(1), expect_broken_for(15349, ['ghci'])], compile_and_run, [''])
253 test('T16111', exit_code(1), compile_and_run, [''])
254 test('T16943a', normal, compile_and_run, [''])
255 test('T16943b', normal, compile_and_run, [''])