25e851b877c8da564d74b37ca993359fd29c3239
[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', normal, 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
44 # need to add -K64m to the compiler opts, so that GHCi gets it too
45 test('ioref001',
46      [when(fast(), skip),extra_run_opts('+RTS -K64m -RTS')],
47      compile_and_run,
48      ['+RTS -K64m -RTS'])
49
50 test('echo001', set_stdin("echo001.hs"), compile_and_run, [''])
51
52 test('hTell001', normal, compile_and_run, [''])
53
54 test('hTell002', normal, compile_and_run, [''])
55
56 test('performGC001', normal, compile_and_run, [''])
57
58 # optimisation screws up this test because some of the traces get commoned up
59 test('trace001', normal, compile_and_run, [''])
60
61 test('hGetBuf002', normal, compile_and_run, [''])
62 test('hGetBuf003', normal, compile_and_run, [''])
63 test('hPutBuf001', normal, compile_and_run, [''])
64 test('hPutBuf002', [], compile_and_run, [''])
65
66 test('char001',         normal, compile_and_run, [''])
67 test('char002',         normal, compile_and_run, [''])
68
69 test('cstring001',      normal, compile_and_run, [''])
70
71 test('length001',
72      # length001 depends on a RULE being applied, and without -O takes
73      # excessive amounts of stack space. So we specifically set a low
74      # stack limit and mark it as failing under a few conditions.
75      [extra_run_opts('+RTS -K8m -RTS'),
76      expect_fail_for(['normal', 'threaded1', 'llvm'])],
77      compile_and_run, [''])
78
79 test('ratio001',        normal, compile_and_run, [''])
80
81 test('rand001',         reqlib('random'), compile_and_run, [''])
82 test('reads001',                normal, compile_and_run, [''])
83 test('show001',         normal, compile_and_run, [''])
84 test('text001',         normal, compile_and_run, [''])
85
86 test('tup001',          normal, compile_and_run, [''])
87
88 test('addr001',         normal, compile_and_run, [''])
89 test('dynamic001',      normal, compile_and_run, [''])
90 test('dynamic002',      normal, compile_and_run, [''])
91 test('dynamic003',      extra_run_opts('+RTS -K32m -RTS'), compile_and_run, [''])
92 test('dynamic004',      omit_ways(['normal', 'threaded1', 'ghci']), compile_and_run, [''])
93 test('dynamic005',      normal, compile_and_run, [''])
94
95 enum_setups = [when(fast(), skip)]
96 test('enum01',          [extra_files(['enum_processor.bat', 'enum_processor.py']),
97                          enum_setups], compile_and_run, [''])
98 test('enum02',          [extra_files(['enum_processor.bat', 'enum_processor.py']),
99                          enum_setups], compile_and_run, [''])
100 test('enum03',          [extra_files(['enum_processor.bat', 'enum_processor.py']),
101                          enum_setups], compile_and_run, [''])
102 test('enum04',          normal, compile_and_run, [''])
103
104 test('exceptionsrun001',        normal, compile_and_run, [''])
105 test('exceptionsrun002',        normal, compile_and_run, [''])
106 test('foldableArray',   normal, compile_and_run, [''])
107 test('list001'  ,       when(fast(), skip), compile_and_run, [''])
108 test('list002', when(fast(), skip), compile_and_run, [''])
109 test('list003', when(fast(), skip), compile_and_run, [''])
110 test('isSuffixOf', normal, compile_and_run, [''])
111
112 test('memo001', [extra_files(['Memo1.lhs']),
113                  extra_run_opts('+RTS -A10k -RTS')], multimod_compile_and_run,
114      ['memo001', ''])
115
116 test('memo002', [extra_files(['Memo2.lhs']),
117                  extra_run_opts('20')], multimod_compile_and_run,
118      ['memo002', ''])
119
120 test('stableptr001',
121      [when(fast(), skip), extra_run_opts('+RTS -K8m -RTS')],
122      compile_and_run, [''])
123 test('stableptr003', normal, compile_and_run, [''])
124 test('stableptr004', extra_run_opts('+RTS -K4m -RTS'), compile_and_run, [''])
125 test('stableptr005', normal, compile_and_run, [''])
126
127 test('weak001', normal, compile_and_run, [''])
128
129 test('T2528', normal, compile_and_run, [''])
130
131 # In the 65001 codepage, we can't even cat the expected output on msys:
132 #     $ cat 4006.stdout
133 #     It works here
134 #     cat: write error: Permission denied
135 # Seems to be a known problem, e.g.
136 #     http://mingw-users.1079350.n2.nabble.com/Bug-re-Unicode-on-the-console-td3121717.html
137 # May 2014: seems to work on msys2
138 # May 2018: The behavior of printf seems very implementation dependent.
139 #     so let's normalise the output.
140 test('T4006', normalise_fun(normalise_quotes), compile_and_run, [''])
141
142 test('T5943', normal, compile_and_run, [''])
143 test('T5962', normal, compile_and_run, [''])
144 test('T7034', normal, compile_and_run, [''])
145
146 test('qsem001', normal, compile_and_run, [''])
147 test('qsemn001', normal, compile_and_run, [''])
148
149 test('T7457', normal, compile_and_run, [''])
150
151 test('T7773', when(opsys('mingw32'), skip), compile_and_run, [''])
152 # Andreas says that T7773 will not (and should not) work on Windows
153
154 # Tests for kind-polymorphic Category
155 test('CatPairs', normal, compile, [''])
156 test('CatEntail', normal, compile, [''])
157
158 # When running with WAY=ghci, T7653 uses a lot of memory.
159 test('T7653', high_memory_usage, compile_and_run, [''])
160 test('T7787', normal, compile_and_run, [''])
161
162 test('topHandler01', when(opsys('mingw32'), skip), compile_and_run, [''])
163 test('topHandler02',
164      [when(opsys('mingw32'), skip),
165       omit_ways(['ghci']),
166       signal_exit_code(2)
167      ], compile_and_run, [''])
168 test('topHandler03',
169      [when(opsys('mingw32'), skip), ignore_stderr,
170       signal_exit_code(15)
171      ], compile_and_run, [''])
172 test('topHandler04',
173      [when(opsys('mingw32'), skip),
174       exit_code(1)
175      ], compile_and_run, [''])
176
177
178 test('T8766',
179         [ collect_stats('bytes allocated',5)
180         , only_ways(['normal'])],
181       compile_and_run,
182       ['-O'])
183
184 test('T9111', normal, compile, [''])
185 test('T9395', normal, compile_and_run, [''])
186 # Fails for debug way due to annotation linting timeout
187 test('T9532', omit_ways(['debug']), compile_and_run, [''])
188 test('T9586', normal, compile, [''])
189 test('T9681', normal, compile_fail, [''])
190 # Test no runtime crash. Report success and kill with `timeout` (exit code 99)
191 # after a few seconds. From https://phabricator.haskell.org/D1075:
192 #
193 #   "I used a fairly conservative timeout. IF there is a regression it will
194 #   crash as soon as the timeout's C call is done. The tricky bit is
195 #   guesstimating how much time it needs to run to guarantee it's reached the
196 #   C call.
197 #   Probably something like 1s is already enough, but I don't know enough to
198 #   make an educated guess how long it needs to be guaranteed to reach the C
199 #   call."
200 test('T8089',
201      [exit_code(99), run_timeout_multiplier(0.01)],
202      compile_and_run, [''])
203 test('hWaitForInput-accurate-socket', reqlib('unix'), compile_and_run, [''])
204 test('T8684', expect_broken(8684), compile_and_run, [''])
205 test('hWaitForInput-accurate-stdin', normal, compile_and_run, [''])
206 test('T9826',normal, compile_and_run,[''])
207 test('T9848',
208         [ collect_stats('bytes allocated')
209         , only_ways(['normal'])],
210       compile_and_run,
211       ['-O'])
212 test('T10149', normal, compile_and_run, [''])
213 test('T11334a', normal, compile_and_run, [''])
214 test('T11555', normal, compile_and_run, [''])
215 test('T12494', normal, compile_and_run, [''])
216 test('T12852', when(opsys('mingw32'), skip), compile_and_run, [''])
217 test('lazySTexamples', normal, compile_and_run, [''])
218 test('T11760', req_smp, compile_and_run, ['-threaded -with-rtsopts=-N2'])
219 test('T12874', normal, compile_and_run, [''])
220 test('T13191',
221         [ collect_stats('bytes allocated', 5)
222         , only_ways(['normal'])],
223       compile_and_run,
224       ['-O'])
225 test('T13525', when(opsys('mingw32'), skip), compile_and_run, [''])
226 test('T13097', normal, compile_and_run, [''])
227 test('functorOperators', normal, compile_and_run, [''])
228 test('T3474',
229      [collect_stats('max_bytes_used',5),
230       only_ways(['normal'])],
231      compile_and_run, ['-O'])
232 test('T14425', normal, compile_and_run, [''])
233 test('T10412', normal, compile_and_run, [''])
234 test('T13896', normal, compile_and_run, [''])
235 test('T13167', normal, compile_and_run, [''])
236 test('T15349', [exit_code(1), expect_broken_for(15349, 'ghci')], compile_and_run, [''])