all.T 8.05 KB
Newer Older
1

2 3 4 5
# Args to compile_and_run are:
#	extra compile flags
#	extra run flags
#	expected process return value, if not zero
6

Austin Seipp's avatar
Austin Seipp committed
7
test('fed001', normal, compile_and_run, [''])
8

9 10
# Omit GHCi for these two, as they use foreign export
test('ffi001', omit_ways(['ghci']), compile_and_run, [''])
11 12
test('ffi002', [ omit_ways(['ghci']),
                 extra_clean(['ffi002_c.o']),
ian@well-typed.com's avatar
ian@well-typed.com committed
13
                 pre_cmd('$MAKE -s --no-print-directory ffi002_setup') ],
14 15 16
                 # The ffi002_setup hack is to ensure that we generate
                 # ffi002_stub.h before compiling ffi002_c.c, which
                 # needs it.
17
               compile_and_run, ['ffi002_c.c -no-hs-main'])
18

19
test('ffi003', normal, compile_and_run, [''])
20

21 22 23
# ffi004 calls printf, which is not supported (the FFI spec says that
# calling varargs functions is deprecated).  It stopped working in GHC 6.9.
test('ffi004', skip, compile_and_run, [''])
24

Simon Marlow's avatar
Simon Marlow committed
25 26
# omit prof ways, because this test exits before the RTS has a chance to
# generate profiling info.
27 28 29 30 31
#
# On x86, the test suffers from floating-point differences due to the
# use of 80-bit internal precision when using the native code generator.
#
test('ffi005', [ omit_ways(prof_ways), 
32
                 when(arch('i386'), skip),
33
                 when(platform('i386-apple-darwin'), expect_broken(4105)),
34
                 exit_code(3) ],
Simon Marlow's avatar
Simon Marlow committed
35
               compile_and_run, [''])
36

Austin Seipp's avatar
Austin Seipp committed
37
test('ffi006', normal, compile_and_run, [''])
38 39 40 41 42 43 44 45

# Skip ffi00{7,8} for GHCi.  These tests both try to exit or raise an
# error from a foreign export, which shuts down the runtime.  When
# GHCi is running, this results in GHCi's main thread also trying to
# shut down, and a race ensues to see who gets to call exit() first.
# Sometimes we end up with the wrong exit code, or get an extra
# 'interrupted' message from the GHCi thread shutting down.

Austin Seipp's avatar
Austin Seipp committed
46 47
test('ffi007', omit_ways(['ghci']), compile_and_run, [''])
test('ffi008', [exit_code(1), omit_ways(['ghci'])], compile_and_run, [''])
48

49 50 51 52
# On i386, we need -msse2 to get reliable floating point results
maybe_skip = normal
opts = ''
if config.platform.startswith('i386-'):
53
    if version_ge(config.compiler_version, '6.13'):
54 55
        opts = '-msse2'
    else:
56
        maybe_skip = only_ways(['ghci'])
57

Austin Seipp's avatar
Austin Seipp committed
58
test('ffi009', [when(fast(), skip),
Simon Marlow's avatar
Simon Marlow committed
59
                reqlib('random'),
60
                maybe_skip] ,compile_and_run, [opts])
61

Austin Seipp's avatar
Austin Seipp committed
62
test('ffi010', normal, compile_and_run, [''])
63
test('ffi011', normal, compile_and_run, [''])
64

65 66 67 68
# The stdcall calling convention works on Windows, and sometimes on
# Linux, and fails everywhhere else.  For now, we test only on Windows,
# because it's difficult to discover whether a given Linux supports
# it.
69

Ian Lynagh's avatar
Ian Lynagh committed
70
if config.os == 'mingw32':
71
    skip_if_not_windows = normal
72
else:
73
    skip_if_not_windows = skip
74

Simon Marlow's avatar
Simon Marlow committed
75
test('ffi012', skip_if_not_windows, compile_and_run, [''])
Austin Seipp's avatar
Austin Seipp committed
76
test('ffi013', normal, compile_and_run, [''])
77

Simon Marlow's avatar
Simon Marlow committed
78
# threaded2 sometimes gives ffi014: Main_dDu: interrupted
79 80 81
test('ffi014',
     [only_ways(['threaded1','threaded2']), extra_clean(['ffi014_cbits.o'])],
     compile_and_run, ['ffi014_cbits.c'])
82

83
# GHCi can't handle the separate C file (ToDo: fix this somehow)
84 85
test('ffi015', [ omit_ways(['ghci']), extra_clean(['ffi015_cbits.o']) ],
               compile_and_run, ['ffi015_cbits.c'])
Simon Marlow's avatar
Simon Marlow committed
86

Simon Marlow's avatar
Simon Marlow committed
87
# GHCi can't handle foreign import "&"
ei@vuokko.info's avatar
ei@vuokko.info committed
88
test('ffi016', omit_ways(['ghci']), compile_and_run, [''])
89 90

test('ffi017', normal, compile_and_run, [''])
Ian Lynagh's avatar
Ian Lynagh committed
91

92 93 94
test('ffi018', [ omit_ways(['ghci']), extra_clean(['ffi018_c.o']) ],
               compile_and_run, ['ffi018_c.c'])

95
test('ffi018_ghci', [ only_ways(['ghci']),
ian@well-typed.com's avatar
ian@well-typed.com committed
96
                      pre_cmd('$MAKE -s --no-print-directory ffi018_ghci_setup'),
97 98
                      extra_clean(['ffi018_ghci_c.o']) ],
                    compile_and_run, ['ffi018_ghci_c.o'])
99

Simon Marlow's avatar
Simon Marlow committed
100
test('ffi019', normal, compile_and_run, [''])
Simon Marlow's avatar
Simon Marlow committed
101 102

# This one originally failed only GHCi, but doesn't hurt to test all ways.
103 104 105 106 107 108
test('T1679', normal, compile_and_run, [''])

test('T1288', [ omit_ways(['ghci']),
                extra_clean(['T1288_c.o']) ],
              compile_and_run, ['T1288_c.c'])
test('T1288_ghci', [ only_ways(['ghci']),
ian@well-typed.com's avatar
ian@well-typed.com committed
109
                     pre_cmd('$MAKE -s --no-print-directory T1288_ghci_setup'),
110 111 112 113 114 115 116
                     extra_clean(['T1288_ghci_c.o']) ],
                   compile_and_run, ['T1288_ghci_c.o'])

test('T2276', [ omit_ways(['ghci']), 
                extra_clean(['T2276_c.o']) ],
              compile_and_run, ['T2276_c.c'])
test('T2276_ghci', [ only_ways(['ghci']),
117
                     when(opsys('darwin'), skip), # stdcall not supported on OS X
ian@well-typed.com's avatar
ian@well-typed.com committed
118
                     pre_cmd('$MAKE -s --no-print-directory T2276_ghci_setup'),
119 120 121 122 123 124 125
                     extra_clean(['T2276_ghci_c.o']) ],
                   compile_and_run, ['-fobject-code T2276_ghci_c.o'])

test('T2469', normal, compile_and_run, ['-optc-std=gnu99'])

test('T2594',
     [extra_clean(['T2594_c.o']), omit_ways(['ghci'])],
126
     compile_and_run,
127
     ['T2594_c.c'])
128 129 130

test('fptr01', [ omit_ways(['ghci']), extra_clean(['fptr01_c.o']) ],
               compile_and_run, ['fptr01_c.c'])
131
test('fptr02', normal, compile_and_run, [''])
132

133
test('fptrfail01', [ omit_ways(['ghci']), exit_code(1),
134 135
                     extra_clean(['fptrfail01_c.o']) ],
                   compile_and_run, ['fptrfail01_c.c'])
Simon Marlow's avatar
Simon Marlow committed
136

137
test('T2917a', normal, compile_and_run, [''])
Simon Marlow's avatar
Simon Marlow committed
138

Simon Marlow's avatar
Simon Marlow committed
139 140
# omit prof ways, because this test causes the RTS to exit (correctly)
# without generating profiling information.
Simon Marlow's avatar
Simon Marlow committed
141
test('ffi020', [ omit_ways(prof_ways),
Simon Marlow's avatar
Simon Marlow committed
142
                 exit_code(1) ], compile_and_run, [''])
143

144 145

test('ffi021', normal, compile_and_run, [''])
Simon Marlow's avatar
Simon Marlow committed
146

Edward Z. Yang's avatar
Edward Z. Yang committed
147 148
test('ffi022', normal, compile_and_run, [''])

Ian Lynagh's avatar
Ian Lynagh committed
149
if config.os == 'mingw32':
150
    # This test needs a larger C stack than we get by default on Windows
151
	flagsForT4038 = ['-optl-Wl,--stack,10485760']
152
else:
153 154 155 156 157 158 159 160 161 162 163 164
	flagsForT4038 = ['']
test('T4038', normal, compile_and_run, flagsForT4038)

test('T4221', [ omit_ways(['ghci']), extra_clean(['T4221_c.o']) ],
                compile_and_run, ['T4221_c.c'])

test('T5402', [ omit_ways(['ghci']),
                exit_code(42),
                extra_clean(['T5402_main.o']),
                  # The T5402_setup hack is to ensure that we generate
                  # T5402_stub.h before compiling T5402_main.c, which
                  # needs it.
ian@well-typed.com's avatar
ian@well-typed.com committed
165
                pre_cmd('$MAKE -s --no-print-directory T5402_setup') ],
166 167 168 169
              compile_and_run, ["-no-hs-main T5402_main.c"])

test('T5594', [ omit_ways(['ghci']),
                extra_clean(['T5594_c.o']),
ian@well-typed.com's avatar
ian@well-typed.com committed
170
                pre_cmd('$MAKE -s --no-print-directory T5594_setup') ],
171 172 173 174
                # The T5594_setup hack is to ensure that we generate
                # T5594_stub.h before compiling T5594_c.c, which
                # needs it.
                compile_and_run, ['T5594_c.c -no-hs-main'])
175 176 177

test('Capi_Ctype_001',
     extra_clean(['Capi_Ctype_A_001.o', 'Capi_Ctype_A_001.hi',
178
                  'capi_ctype_001_c.o',
179 180 181 182
                  'Capi_Ctype_A_001.hs', 'Capi_Ctype_001.hs']),
     run_command,
     ['$MAKE -s --no-print-directory Capi_Ctype_001'])

Ian Lynagh's avatar
Ian Lynagh committed
183 184 185 186 187 188
test('Capi_Ctype_002',
     extra_clean(['Capi_Ctype_A_002.o', 'Capi_Ctype_A_002.hi',
                  'Capi_Ctype_A_002.hs']),
     run_command,
     ['$MAKE -s --no-print-directory Capi_Ctype_002'])

Ian Lynagh's avatar
Ian Lynagh committed
189
test('ffi_parsing_001',
190
     [omit_ways(['ghci']), extra_clean(['ffi_parsing_001_c.o'])],
Ian Lynagh's avatar
Ian Lynagh committed
191 192 193
     compile_and_run,
     ['ffi_parsing_001_c.c'])

Ian Lynagh's avatar
Ian Lynagh committed
194
test('capi_value',
195
     [omit_ways(['ghci']), extra_clean(['capi_value_c.o'])],
Ian Lynagh's avatar
Ian Lynagh committed
196 197 198
     compile_and_run,
     ['capi_value_c.c'])

199
test('T7170', exit_code(1), compile_and_run, [''])
200 201 202 203 204 205 206

test('T4012',
     [extra_clean(['T4012_A.hi', 'T4012_A.o', 'T4012_B.hi', 'T4012_B.o']),
      expect_broken_for(7388, ['ghci'])],
     multimod_compile_and_run,
     ['T4012', ''])

ian@well-typed.com's avatar
ian@well-typed.com committed
207
test('T8083',
ian@well-typed.com's avatar
ian@well-typed.com committed
208
     [omit_ways(['ghci']), extra_clean(['T8083_c.o'])],
ian@well-typed.com's avatar
ian@well-typed.com committed
209 210 211
     compile_and_run,
     ['T8083_c.c'])

212 213
test('ffi023', [ omit_ways(['ghci']),
                extra_clean(['ffi023_c.o']),
Simon Marlow's avatar
Simon Marlow committed
214 215 216 217 218
                extra_run_opts('1000 4'),
                pre_cmd('$MAKE -s --no-print-directory ffi023_setup') ],
                # The ffi023_setup hack is to ensure that we generate
                # ffi023_stub.h before compiling ffi023_c.c, which
                # needs it.
219
              compile_and_run, ['ffi023_c.c'])