堆栈运行0测试

时间:2017-11-19 05:45:27

标签: haskell testing haskell-stack

我刚从使用cabal直接转移到堆栈,但我在测试套件中遇到了一些问题。库和可执行文件工作正常但stack test给了我

hml-0.1.0.0: test (suite: HML-test) 
All 0 tests passed (0.00s)

即。没有进行任何测试。当我直接用cabal运行测试时,它们工作正常。我正在tasty使用tasty-discover。在hml.cabal中,套件看起来像这样:

test-suite HML-test
  main-is:             Driver.hs
  hs-source-dirs:      test
  default-language:    Haskell2010
  ghc-options:         -Wall
  other-modules:       HML.Types.Test.PosInt
                       (...etc...)
  build-depends:       base >= 4.9
                       (... etc...)

tasty-discover的驱动程序test / Driver.hs如下所示:

{-# OPTIONS_GHC -F -pgmF tasty-discover -optF --tree-display #-}

有什么想法吗?

编辑:

使用cabal编译时,我在HML-test中找到可执行文件dist/build/HML-test,并直接运行它运行所有测试。

使用堆栈编译时,我在.stack-work/x86_64-linux/Cabal-1.24.2.0/build/HML-test找到它,直接运行它仍会运行0次测试。

stack - v test的完整输出是

  

版本1.5.1,Git修订版600c1f01435a10d127938709556c1682ecfd694e(4861提交)x86_64 hpack-0.17.1 2017-11-19 12:25:05.759671:[debug]检查项目配置:/ home / cabox / workspace / hml / stack.yaml @(Stack / Config.hs:974:9)2017-11-19 12:25:05.759980:[debug]加载项目配置文件stack.yaml @(Stack / Config.hs:999:13)2017- 11-19 12:25:05.762372:[debug]尝试解码/home/cabox/.stack/build-plan-cache/x86_64-linux/lts-9.13.cache @(Data / Store / VersionTagged.hs:72: 5)2017-11-19 12:25:05.788669:[debug]成功解码/home/cabox/.stack/build-plan-cache/x86_64-linux/lts-9.13.cache @(Data / Store / VersionTagged.hs :76:13)2017-11-19 12:25:05.789952:[debug]运行进程:/ sbin / ldconfig -p @(System / Process / Read.hs:306:3)2017-11-19 12:25 :05.796009:[debug]进程在[92m5ms [0m:/ sbin / ldconfig -p @(系统/进程/ Read.hs:306:3)完成2017-11-19 12:25:05.796327:[debug]运行进程:/ usr / bin / gcc -v @(System / Process / Read.hs:306:3)2017-11-19 12:25:05.799566:[debug] Proce ss完成[92m3ms [0m:/ usr / bin / gcc -v @(System / Process / Read.hs:306:3)2017-11-19 12:25:05.799710:[debug] PIE enabled @(Stack / Setup.hs:583:17)2017-11-19 12:25:05.799912:[debug]在< ldconfig -p'中找到共享库libtinfo.so.5输出@(Stack / Setup.hs:559:29)2017-11-19 12:25:05.800147:[debug]未找到共享库libtinfo.so.6 @(Stack / Setup.hs:573:38)2017 -11-19 12:25:05.800285:[debug]未找到共享库libncursesw.so.6 @(Stack / Setup.hs:573:38)2017-11-19 12:25:05.800375:[debug] Found共享库libgmp.so.10 in" ldconfig -p'输出@(Stack / Setup.hs:559:29)2017-11-19 12:25:05.800478:[debug]未找到共享库libgmp.so.3 @(Stack / Setup.hs:573:38)2017 -11-19 12:25:05.800560:[debug]使用标准GHC build @(Stack / Setup.hs:606:9)2017-11-19 12:25:05.801346:[debug]询问GHC的版本@( Stack / Setup / Installed.hs:103:13)2017-11-19 12:25:05.801592:[debug]运行过程:/home/cabox/.stack/programs/x86_64-linux/ghc-8.0.2/bin / ghc --numeric-version @(System / Process / Read.hs:306:3)2017-11-19 12:25:05.802203:[debug]获取Cabal包版本@(Stack / GhcPkg.hs:189:5 )2017-11-19 12:25:05.802507:[debug]获取全局包数据库位置@(Stack / GhcPkg.hs:55:5)2017-11-19 12:25:05.808193:[debug]运行过程:/ home / cabox / .stack / programs / x86_64-linux / ghc-8.0.2 / bin / ghc-pkg --no-user-package-db field --simple-output Cabal version @(System / Process / Read.hs :306:3)2017-11-19 12:25:05.808687:[debug]运行过程:/home/cabox/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --no -user封装-DB list --global @(System / Process / Read.hs:306:3)2017-11-19 12:25:05.855073:[debug]过程在[92m46ms完成[0m:/home/cabox/.stack/programs/ x86_64-linux / ghc-8.0.2 / bin / ghc-pkg --no-user-package-db list --global @(System / Process / Read.hs:306:3)2017-11-19 12:25 :05.857161:[debug]过程在[92m48ms [0m:/home/cabox/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --no-user-package-db field - 完成 - -simple-output Cabal版本@(System / Process / Read.hs:306:3)2017-11-19 12:25:05.869048:[debug]过程在[92m67ms [0m:/home/cabox/.stack/]完成programs / x86_64-linux / ghc-8.0.2 / bin / ghc --numeric-version @(System / Process / Read.hs:306:3)2017-11-19 12:25:05.871256:[debug]解析包entries @(Stack / Setup.hs:260:5)2017-11-19 12:25:05.897711:[debug]开始在EnvConfig中执行命令@(Stack / Runners.hs:175:18)2017-11-19 12:25:05.897916:[debug]解析本地软件包的cabal文件@(Stack / Build / Source.hs:328:5)2017-11-19 12:25:05.905436:[debug]解析t argets @(Stack / Build / Source.hs:265:5)2017-11-19 12:25:05.917919:[debug]开始:getPackageFiles /home/cabox/workspace/hml/hml.cabal @(Stack / Package。 hs:259:21)2017-11-19 12:25:06.009229:[debug]在91ms完成:getPackageFiles /home/cabox/workspace/hml/hml.cabal @(Stack / Package.hs:259:21)2017 -11-19 12:25:06.010508:[debug]找出已安装的软件包@(Stack / Build / Installed.hs:69:5)2017-11-19 12:25:06.010877:[debug]运行过程:/home/cabox/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot @(System / Process / Read.hs:306:3)2017-11-19 12:25:06.062451:[debug]过程在[92m51ms完成[0m:/home/cabox/.stack/programs/x86_64-linux/ghc-8.0.2/ bin / ghc-pkg --global --no-user-package-db dump --expand-pkgroot @(System / Process / Read.hs:306:3)2017-11-19 12:25:06.086280:[debug ]忽略包haskeline因为需要版本0.7.4.0而不是0.7.3.0 @(Stack / Build / Installed.hs:199:5)2017-11-19 12:25:06.086478:[d ebug]由于需要版本0.4.1.0而不是0.4.0.2 @忽略包terminfo(@ Stack / Build / Installed.hs:199:5)2017-11-19 12:25:06.086581:[debug]忽略包xhtml由于想要版本3000.2.2而不是3000.2.1 @(Stack / Build / Installed.hs:199:5)2017-11-19 12:25:06.086945:[debug]运行过程:/home/cabox/.stack/programs /x86_64-linux/ghc-8.0.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/cabox/.stack/snapshots/x86_64-linux/lts-9.13 /8.0.2/pkgdb dump --expand-pkgroot @(System / Process / Read.hs:306:3)2017-11-19 12:25:06.209627:[debug]过程在[92m122ms完成[0m:/ home] /cabox/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/cabox/.stack/snapshots/ x86_64-linux / lts-9.13 / 8.0.2 / pkgdb dump --expand-pkgroot @(System / Process / Read.hs:306:3)2017-11-19 12:25:06.210994:[debug]运行过程: /home/cabox/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --user --no-user-package-db --package-db / home / cabox / workspace / hml /.stack-work/install/x86_64-linux/lts-9.13/8.0.2/pkgdb dump --expand-pkgroot @(System / Process / Read.hs:306:3)2017-11-19 12:25: 06.255376:[debug]过程在[92m43ms完成[0m:/home/cabox/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/cabox/workspace/hml/.stack-work/install/x86_64-linux/lts-9.13/8.0.2/pkgdb dump --expand-pkgroot @(System / Process / Read.hs: 306:3)2017-11-19 12:25:06.256147:[debug]构建构建计划@(Stack / Build / ConstructPlan.hs:188:5)2017-11-19 12:25:06.270612:[debug]检查我们是否要构建具有相同名称的多个可执行文件@(Stack / Build.hs:210:5)2017-11-19 12:25:06.271198:[debug]执行构建计划@(Stack / Build / Execute .hs:478:5)2017-11-19 12:25:06.282278:[debug]获取全局包数据库位置@(Stack / GhcPkg.hs:55:5)2017-11-19 12:25:06.282498:[ debug]运行过程:/home/cabox/.stack/programs/x86_64-linux/ghc-8.0.2/bin/ghc-pkg --no-user-package-db list --global @(Syste m / Process / Read.hs:306:3)2017-11-19 12:25:06.319127:[debug]过程在[92m36ms完成[0m:/home/cabox/.stack/programs/x86_64-linux/ghc- 8.0.2 / bin / ghc-pkg --no-user-package-db list --global @(System / Process / Read.hs:306:3)2017-11-19 12:25:06.320228:[info] hml-0.1.0.0:test(套件:HML-test)@(Stack / Build / Execute.hs:830:23)2017-11-19 12:25:06.321702:[debug]创建过程:/ home / cabox / workspace / hml / .stack-work / dist / x86_64-linux / Cabal-1.24.2.0 / build / HML-test / HML-test @(System / Process / Run.hs:139:5)2017-11-19 12 :25:06.344988:[info] @(Stack / Build / Execute.hs:1587:52)   所有0次测试都通过了(0.00s)

EDIT2:如果我手动组织tasty(即不使用tasty-discover),它就有效。然而,这将导致大量的工作和大量的样板..

1 个答案:

答案 0 :(得分:2)

我最接近解决方案的是从tasty-discover转移到tasty-th

完全自动发现仍然无法正常工作,但使用TemplateHaskell到$(testGroupGenerator)样板文件至少会与测试文件的数量而不是测试数量进行比较。