在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):barrucadu/dejafu开源软件地址(OpenSource Url):https://github.com/barrucadu/dejafu开源编程语言(OpenSource Language):Haskell 99.9%开源软件介绍(OpenSource Introduction):dejafu
Déjà Fu is a unit-testing library for concurrent Haskell programs. Tests are deterministic and expressive, making it easy and convenient to test your threaded code. Available on GitHub, Hackage, and Stackage. Features:
There are a few different packages under the Déjà Fu umbrella:
Each package has its own README and CHANGELOG in its subdirectory. There is also dejafu-tests, the test suite for dejafu. This is in a separate package due to Cabal being bad with test suite transitive dependencies. InstallationInstall from Hackage globally:
Or add it to your cabal file:
Or to your package.yaml:
Quick start guideDéjà Fu supports unit testing, and comes with a helper function called
import Control.Concurrent.Classy
myFunction :: MonadConc m => m String
myFunction = do
var <- newEmptyMVar
fork (putMVar var "hello")
fork (putMVar var "world")
readMVar var That
There are no deadlocks or uncaught exceptions, which is good; but the program is (as you probably spotted) nondeterministic! Along with each result, Déjà Fu gives us a representative execution
trace in an abbreviated form. Why Déjà Fu?Testing concurrent programs is difficult, because in general they are nondeterministic. This leads to people using work-arounds like running their testsuite many thousands of times; or running their testsuite while putting their machine under heavy load. These approaches are inadequate for a few reasons:
Déjà Fu addresses these points by offering complete testing. You can run a test case and be guaranteed to find all results with some bounds. These bounds can be configured, or even disabled! The underlying approach used is smarter than merely trying all possible executions, and will in general explore the state-space quickly. If your test case is just too big for complete testing, there is also
a random scheduling mode, which is necessarily incomplete. However,
Déjà Fu will tend to produce much more schedule variety than just
running your test case in ContributingSee the "contributing" page on the website. If you'd like to get involved with Déjà Fu, check out the "good first issue" label on the issue tracker. Release notesSee the CHANGELOG.markdown file. Questions, feedback, discussion
BibliographyThese libraries wouldn't be possible without prior research, which I mention in the documentation. Haddock comments get the full citation, whereas in-line comments just get the shortened name:
There are also a couple of papers on dejafu itself:
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论