Skip to content

Commit 45c15b4

Browse files
committed
Use Tasty for RTS thread count test
This removes test/Makefile since all tests have been moved to be run by Tasty! Yay! The thread count is a pretty good example for how the shell is pretty useful for this kind of tests. DSLs aren't that bad after all...
1 parent 87619af commit 45c15b4

3 files changed

Lines changed: 16 additions & 19 deletions

File tree

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,6 @@ rts: $(ARCHIVES)
349349
test:
350350
cd compiler && stack test
351351
$(MAKE) -C backend test
352-
$(MAKE) -C test
353352

354353
test-builtins:
355354
cd compiler && stack test --ta '-p "Builtins"'

compiler/test.hs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,22 @@ rtsTests =
142142
assertEqual "RTS wthreads error retCode" (ExitFailure 1) returnCode
143143
assertEqual "RTS wthreads error cmdErr" "ERROR: --rts-wthreads requires an argument.\n" cmdErr
144144

145+
, testCase "thread count" $ do
146+
testBuild "" ExitSuccess False "../test/rts/wthreads1.act"
147+
(pin, pout, perr, ph) <- runInteractiveProcess "../test/rts/wthreads1" ["--rts-wthreads=7"] Nothing Nothing
148+
-- wait for program to start up
149+
mpid <- getPid ph
150+
case mpid of
151+
Just pid -> do
152+
let cmd = "ps -o thcount " ++ show pid
153+
(returnCode, cmdOut, cmdErr) <- readCreateProcessWithExitCode (shell $ cmd) ""
154+
let tCount = read (last $ lines cmdOut)::Int
155+
assertEqual "RTS thread count" 10 tCount
156+
Nothing -> do
157+
assertFailure "whtreads1 program should be running"
158+
terminateProcess ph
159+
waitForProcess ph
160+
return ()
145161
]
146162

147163
rtsDDBTests =

test/Makefile

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)