fa78c56b80017b64c4172abc027175a28f672358
[ghc.git] / testsuite / tests / ffi / should_run / all.T
1
2 # Args to compile_and_run are:
3 #       extra compile flags
4 #       extra run flags
5 #       expected process return value, if not zero
6
7 test('fed001', normal, compile_and_run, [''])
8
9 # Omit GHCi for these two, as they use foreign export
10 test('ffi001', omit_ways(['ghci']), compile_and_run, [''])
11 test('ffi002', [ omit_ways(['ghci']),
12                  extra_clean(['ffi002_c.o']),
13                  pre_cmd('$MAKE -s --no-print-directory ffi002_setup') ],
14                  # The ffi002_setup hack is to ensure that we generate
15                  # ffi002_stub.h before compiling ffi002_c.c, which
16                  # needs it.
17                compile_and_run, ['ffi002_c.c -no-hs-main'])
18
19 test('ffi003', normal, compile_and_run, [''])
20
21 # ffi004 calls printf, which is not supported (the FFI spec says that
22 # calling varargs functions is deprecated).  It stopped working in GHC 6.9.
23 test('ffi004', skip, compile_and_run, [''])
24
25 # omit prof ways, because this test exits before the RTS has a chance to
26 # generate profiling info.
27 #
28 # On x86, the test suffers from floating-point differences due to the
29 # use of 80-bit internal precision when using the native code generator.
30 #
31 test('ffi005', [ omit_ways(prof_ways),
32                  when(arch('i386'), skip),
33                  when(platform('i386-apple-darwin'), expect_broken(4105)),
34                  exit_code(3) ],
35                compile_and_run, [''])
36
37 test('ffi006', normal, compile_and_run, [''])
38
39 # Skip ffi00{7,8} for GHCi.  These tests both try to exit or raise an
40 # error from a foreign export, which shuts down the runtime.  When
41 # GHCi is running, this results in GHCi's main thread also trying to
42 # shut down, and a race ensues to see who gets to call exit() first.
43 # Sometimes we end up with the wrong exit code, or get an extra
44 # 'interrupted' message from the GHCi thread shutting down.
45
46 test('ffi007', omit_ways(['ghci']), compile_and_run, [''])
47 test('ffi008', [exit_code(1), omit_ways(['ghci'])], compile_and_run, [''])
48
49 # On i386, we need -msse2 to get reliable floating point results
50 if config.platform.startswith('i386-'):
51     opts = '-msse2'
52 else:
53     opts = ''
54
55 test('ffi009', [when(fast(), skip), reqlib('random')], compile_and_run, [opts])
56
57 test('ffi010', normal, compile_and_run, [''])
58 test('ffi011', normal, compile_and_run, [''])
59
60 # The stdcall calling convention works on Windows, and sometimes on
61 # Linux, and fails everywhhere else.  For now, we test only on Windows,
62 # because it's difficult to discover whether a given Linux supports
63 # it.
64
65 if config.os == 'mingw32':
66     skip_if_not_windows = normal
67 else:
68     skip_if_not_windows = skip
69
70 test('ffi012', skip_if_not_windows, compile_and_run, [''])
71 test('ffi013', normal, compile_and_run, [''])
72
73 # threaded2 sometimes gives ffi014: Main_dDu: interrupted
74 test('ffi014', [only_ways(['threaded1', 'threaded2'])], compile_and_run,
75      ['ffi014_cbits.c'])
76
77 # GHCi can't handle the separate C file (ToDo: fix this somehow)
78 test('ffi015', [omit_ways(['ghci'])], compile_and_run, ['ffi015_cbits.c'])
79
80 # GHCi can't handle foreign import "&"
81 test('ffi016', omit_ways(['ghci']), compile_and_run, [''])
82
83 test('ffi017', normal, compile_and_run, [''])
84
85 test('ffi018', [omit_ways(['ghci'])], compile_and_run, ['ffi018_c.c'])
86
87 test('ffi018_ghci',
88      [extra_files(['ffi018.h']),
89       only_ways(['ghci']),
90       when(unregisterised(), fragile(16085)),
91       pre_cmd('$MAKE -s --no-print-directory ffi018_ghci_setup')],
92      compile_and_run, ['ffi018_ghci_c.o'])
93
94 test('ffi019', normal, compile_and_run, [''])
95
96 # This one originally failed only GHCi, but doesn't hurt to test all ways.
97 test('T1679', normal, compile_and_run, [''])
98
99 test('T1288', [omit_ways(['ghci'])], compile_and_run, ['T1288_c.c'])
100 test('T1288_ghci',
101      [only_ways(['ghci']),
102       when(unregisterised(), fragile(16085)),
103       pre_cmd('$MAKE -s --no-print-directory T1288_ghci_setup')],
104      compile_and_run, ['T1288_ghci_c.o'])
105
106 test('T2276', [omit_ways(['ghci'])], compile_and_run, ['T2276_c.c'])
107 test('T2276_ghci', [ only_ways(['ghci']),
108                      when(opsys('darwin'), skip), # stdcall not supported on OS X
109                      pre_cmd('$MAKE -s --no-print-directory T2276_ghci_setup'),
110                      extra_clean(['T2276_ghci_c.o']) ],
111                    compile_and_run, ['-fobject-code T2276_ghci_c.o'])
112
113 test('T2469', normal, compile_and_run, ['-optc-std=gnu99'])
114
115 test('T2594', [omit_ways(['ghci'])], compile_and_run, ['T2594_c.c'])
116
117 test('fptr01', [omit_ways(['ghci'])], compile_and_run, ['fptr01_c.c'])
118 test('fptr02', normal, compile_and_run, [''])
119
120 test('fptrfail01', [omit_ways(['ghci']), exit_code(1)], compile_and_run,
121      ['fptrfail01_c.c'])
122
123 test('T2917a', normal, compile_and_run, [''])
124
125 # omit prof ways, because this test causes the RTS to exit (correctly)
126 # without generating profiling information.
127 test('ffi020', [ omit_ways(prof_ways),
128                  exit_code(1) ], compile_and_run, [''])
129
130
131 test('ffi021', normal, compile_and_run, [''])
132
133 test('ffi022', normal, compile_and_run, [''])
134
135 if config.os == 'mingw32':
136     # This test needs a larger C stack than we get by default on Windows
137         flagsForT4038 = ['-optl-Wl,--stack,10485760']
138 else:
139         flagsForT4038 = ['']
140 test('T4038', normal, compile_and_run, flagsForT4038)
141
142 test('T4221', [omit_ways(['ghci'])], compile_and_run, ['T4221_c.c'])
143
144 test('T5402', [ omit_ways(['ghci']),
145                 exit_code(42),
146                 extra_clean(['T5402_main.o']),
147                   # The T5402_setup hack is to ensure that we generate
148                   # T5402_stub.h before compiling T5402_main.c, which
149                   # needs it.
150                 pre_cmd('$MAKE -s --no-print-directory T5402_setup') ],
151               compile_and_run, ["-no-hs-main T5402_main.c"])
152
153 test('T5594', [ omit_ways(['ghci']),
154                 extra_clean(['T5594_c.o']),
155                 pre_cmd('$MAKE -s --no-print-directory T5594_setup') ],
156                 # The T5594_setup hack is to ensure that we generate
157                 # T5594_stub.h before compiling T5594_c.c, which
158                 # needs it.
159                 compile_and_run, ['T5594_c.c -no-hs-main'])
160
161 test('Capi_Ctype_001', [extra_files(['Capi_Ctype_A_001.hsc', 'capi_ctype_001.h', 'capi_ctype_001_c.c'])],
162      makefile_test, ['Capi_Ctype_001'])
163
164 test('Capi_Ctype_002', [extra_files(['Capi_Ctype_A_002.hsc', 'capi_ctype_002_A.h', 'capi_ctype_002_B.h'])],
165      makefile_test, ['Capi_Ctype_002'])
166
167 test('ffi_parsing_001', [omit_ways(['ghci'])], compile_and_run,
168      ['ffi_parsing_001_c.c'])
169
170 test('capi_value', [omit_ways(['ghci'])], compile_and_run, ['capi_value_c.c'])
171
172 test('T7170', exit_code(1), compile_and_run, [''])
173
174 test('T4012', [expect_broken_for(7388, ['ghci'])], multimod_compile_and_run,
175      ['T4012', ''])
176
177 test('T8083', [omit_ways(['ghci'])], compile_and_run, ['T8083_c.c'])
178
179 test('T9274', [omit_ways(['ghci'])], compile_and_run, [''])
180
181 test('ffi023', [ omit_ways(['ghci']),
182                 extra_clean(['ffi023_c.o']),
183                 extra_run_opts('1000 4'),
184                 pre_cmd('$MAKE -s --no-print-directory ffi023_setup') ],
185                 # The ffi023_setup hack is to ensure that we generate
186                 # ffi023_stub.h before compiling ffi023_c.c, which
187                 # needs it.
188               compile_and_run, ['ffi023_c.c'])
189
190 test('T12134', [omit_ways(['ghci'])], compile_and_run, ['T12134_c.c'])
191
192 test('T12614', [omit_ways(['ghci'])], compile_and_run, ['T12614_c.c'])
193
194 test('T16650a', [omit_ways(['ghci'])], compile_and_run, ['T16650a_c.c'])
195
196 test('T16650b', [omit_ways(['ghci'])], compile_and_run, ['T16650b_c.c'])
197
198 test('T16650c', [omit_ways(['ghci'])], compile_and_run, ['T16650c_c.c'])
199
200 test('T16650d', [omit_ways(['ghci'])], compile_and_run, ['T16650d_c.c'])
201
202 test('PrimFFIInt8', [omit_ways(['ghci'])], compile_and_run, ['PrimFFIInt8_c.c'])
203
204 test('PrimFFIWord8', [omit_ways(['ghci'])], compile_and_run, ['PrimFFIWord8_c.c'])
205
206 test('PrimFFIInt16', [omit_ways(['ghci'])], compile_and_run, ['PrimFFIInt16_c.c'])
207
208 test('PrimFFIWord16', [omit_ways(['ghci'])], compile_and_run, ['PrimFFIWord16_c.c'])
209
210 test('T493', [omit_ways(['ghci'])], compile_and_run, ['T493_c.c'])
211
212 test('UnliftedNewtypesByteArrayOffset', [omit_ways(['ghci'])], compile_and_run, ['UnliftedNewtypesByteArrayOffset_c.c'])