Commit 2d7de127 authored by Simon Marlow's avatar Simon Marlow

Add test for #5402

parent 3d6d9674
module Test where
import System.Exit
foreign export ccall hsmain :: IO ()
hsmain = exitWith (ExitFailure 42)
#include "HsFFI.h"
#include <stdio.h>
#include <stdlib.h>
#include "5402_stub.h"
int main (int argc, char *argv[])
{
hs_init(&argc,&argv);
hs_init(&argc,&argv);
hsmain();
printf("I shouldn't be here\n");
exit(1);
}
......@@ -13,3 +13,6 @@ ffi018_ghci_setup :
ffi002_setup :
'$(TEST_HC)' $(TEST_HC_OPTS) -c ffi002.hs
5402_setup :
'$(TEST_HC)' $(TEST_HC_OPTS) -c 5402.hs
......@@ -166,3 +166,12 @@ test('4038', normal, compile_and_run, flagsFor4038)
test('4221', [ omit_ways(['ghci']), extra_clean(['4221_c.o']) ],
compile_and_run, ['4221_c.c'])
test('5402', [ omit_ways(['ghci']),
exit_code(42),
extra_clean(['5402_main.o']),
# The 5402_setup hack is to ensure that we generate
# 5402_stub.h before compiling 5402_main.c, which
# needs it.
compile_cmd_prefix('$MAKE --no-print-directory 5402_setup && ') ],
compile_and_run, ["-no-hs-main 5402_main.c"])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment