diff options
author | Ben Gamari <ben@smart-cactus.org> | 2023-01-25 08:43:28 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-01-27 23:56:42 -0500 |
commit | a9fe81af542ea21757bc99a78bb467dc3979f274 (patch) | |
tree | 3b52c3d6864356282f1375d7d677084459eab065 /testsuite | |
parent | 38ad83512950992d8fbfea78589b3194c32eb4d7 (diff) | |
download | haskell-a9fe81af542ea21757bc99a78bb467dc3979f274.tar.gz |
testsuite: Fix race in UnliftedTVar2
Previously UnliftedTVar2 would fail when run with multiple capabilities
(and possibly even with one capability) as it would assume that
`killThread#` would immediately kill the "increment" thread.
Also, refactor the the executable to now succeed with no output and
fails with an exit code.
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/primops/should_run/UnliftedTVar2.hs | 8 | ||||
-rw-r--r-- | testsuite/tests/primops/should_run/UnliftedTVar2.stdout | 1 |
2 files changed, 7 insertions, 2 deletions
diff --git a/testsuite/tests/primops/should_run/UnliftedTVar2.hs b/testsuite/tests/primops/should_run/UnliftedTVar2.hs index 70cbce18a8..5e87007e2b 100644 --- a/testsuite/tests/primops/should_run/UnliftedTVar2.hs +++ b/testsuite/tests/primops/should_run/UnliftedTVar2.hs @@ -7,6 +7,7 @@ module Main where +import Control.Monad import Data.Kind import GHC.Exts import GHC.IO @@ -28,7 +29,12 @@ main = do case readTVarIO# tvar s4 of (# s5, U res #) -> (# s5, ( I# r, I# res ) #) - print (x == y, x > 100000) + unless (x > 100000) $ do + print (x,y) + fail "not enough iterations" + unless (x <= y) $ do + print (x,y) + fail "mismatch" increment :: TVar# RealWorld U -> State# RealWorld -> (# State# RealWorld, Int #) increment tvar = go diff --git a/testsuite/tests/primops/should_run/UnliftedTVar2.stdout b/testsuite/tests/primops/should_run/UnliftedTVar2.stdout deleted file mode 100644 index 1fa0b54b36..0000000000 --- a/testsuite/tests/primops/should_run/UnliftedTVar2.stdout +++ /dev/null @@ -1 +0,0 @@ -(True,True) |