Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quickcheck-dynamic test fails. #516

Closed
zmrocze opened this issue Jun 16, 2022 · 3 comments · Fixed by #541
Closed

Quickcheck-dynamic test fails. #516

zmrocze opened this issue Jun 16, 2022 · 3 comments · Fixed by #541
Labels
bug Something isn't working

Comments

@zmrocze
Copy link
Contributor

zmrocze commented Jun 16, 2022

Summary

Quickcheck-dynamic test fails. This happens sort of rarely.

Steps to reproduce the behavior

  1. run on main or next-node
cabal run quickcheck-dynamic-test -- --quickcheck-replay=912838

Actual Result

dynamic logic
  registry model example
    prop_Registry: FAIL (0.06s)
      *** Failed! Assertion failed (after 5 tests):
      Actions 
       [Var 1 := Spawn,
        Var 2 := WhereIs "b",
        Var 3 := KillThread (Var 1),
        Var 4 := WhereIs "e",
        Var 5 := Register "e" (Var 1),
        Var 6 := Spawn,
        Var 7 := WhereIs "d"]
      
      Execution
      
      
      State: RegState {tids = [Var 1], regs = [], dead = []}
      
      
      State: RegState {tids = [Var 1], regs = [], dead = []}
      
      
      State: RegState {tids = [Var 1], regs = [], dead = [Var 1]}
      
      
      State: RegState {tids = [Var 1], regs = [], dead = [Var 1]}
      
      
      State: RegState {tids = [Var 1], regs = [], dead = [Var 1]}
      
      Use --quickcheck-replay=912838 to reproduce.

1 out of 1 tests failed (0.06s)

Expected Result

test passes

Describe the approach you would take to fix this

No response

System info

main branch on 61de89d
or
next-node branch on b8d3a89

@zmrocze zmrocze added the bug Something isn't working label Jun 16, 2022
@zmrocze
Copy link
Contributor Author

zmrocze commented Jun 16, 2022

--quickcheck-replay=957679 also fails

@UlfNorell
Copy link
Contributor

As far as I can tell, the failure is caused by a thread still being alive 1ms after it was killed. It only happens for the very first test, so it might be caused by the run-time system not being warmed up properly. A work-around that seems to work is to add a test that waits 100ms before testing the actual property:

testProperty "Wait for run-time system to warm up??" $ withMaxSuccess 1 $ ioProperty $ do
  True <$ threadDelay 100000

IMO this is a bad test for the StateModel framework; there's no reason to involve IO and concurrency. It would be better to write a mock-up implementation of the registry example using a simple state monad and run the tests on that instead.

ghost pushed a commit that referenced this issue Jun 23, 2022
@ghost ghost closed this as completed in #541 Jun 23, 2022
ghost pushed a commit that referenced this issue Jun 23, 2022
@ghost
Copy link

ghost commented Jun 23, 2022

@UlfNorell Thanks!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants