From 00124d12d3ab21951104b279dbc6999b8ea42fba Mon Sep 17 00:00:00 2001 From: Cheng Shao Date: Fri, 21 Oct 2022 13:49:15 +0000 Subject: testsuite: correct sleep() signature in T5611 In libc, sleep() returns an integer. The ccall type signature should match the libc definition, otherwise it causes linker error on wasm. --- testsuite/tests/concurrent/should_run/T5611.hs | 5 +++-- testsuite/tests/concurrent/should_run/T5611a.hs | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'testsuite') diff --git a/testsuite/tests/concurrent/should_run/T5611.hs b/testsuite/tests/concurrent/should_run/T5611.hs index 1b056178a2..174da10e53 100644 --- a/testsuite/tests/concurrent/should_run/T5611.hs +++ b/testsuite/tests/concurrent/should_run/T5611.hs @@ -1,6 +1,7 @@ {-# LANGUAGE CPP,ForeignFunctionInterface #-} import Control.Concurrent +import Data.Functor import Foreign.C import System.IO @@ -8,8 +9,8 @@ import System.IO sleep n = sleepBlock (n*1000) foreign import stdcall safe "Sleep" sleepBlock :: Int -> IO () #else -sleep n = sleepBlock n -foreign import ccall safe "sleep" sleepBlock :: Int -> IO () +sleep n = void $ sleepBlock n +foreign import ccall safe "sleep" sleepBlock :: Int -> IO Int #endif main :: IO () diff --git a/testsuite/tests/concurrent/should_run/T5611a.hs b/testsuite/tests/concurrent/should_run/T5611a.hs index 81e6cc957e..6020c50a9d 100644 --- a/testsuite/tests/concurrent/should_run/T5611a.hs +++ b/testsuite/tests/concurrent/should_run/T5611a.hs @@ -3,6 +3,7 @@ {-# LANGUAGE CPP,ForeignFunctionInterface #-} import Control.Concurrent +import Data.Functor import Foreign.C import System.IO @@ -10,8 +11,8 @@ import System.IO sleep n = sleepBlock (n*1000) foreign import stdcall unsafe "Sleep" sleepBlock :: Int -> IO () #else -sleep n = sleepBlock n -foreign import ccall unsafe "sleep" sleepBlock :: Int -> IO () +sleep n = void $ sleepBlock n +foreign import ccall unsafe "sleep" sleepBlock :: Int -> IO Int #endif main :: IO () -- cgit v1.2.1