Errors when trying to generate a test coverage report
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- haskell
調査の方向性
カバレッジコマンド cabal test intmap-lazy-properties --enable-coverage を再現し、emitPrimop における PtrEquality.hs と compiler/GHC/StgToCmm/Prim.hs を調査します。次に、報告された HPC の mix ディレクトリと、手動での hpc markup の呼び出しを比較します。reallyUnsafePtrEquality# のコードを削除したり、mix ディレクトリを手動で指定したりせずにカバレッジレポートを生成できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
I tried to generate a test coverage report and ran into an entire zoo of errors.
I'll describe the issues so we can try to get this fixed, and a workaround. Skip to the end for the workaround.
Issue 1
Let's start with
$ cabal test intmap-lazy-properties --enable-coverage
<...>
[ 5 of 37] Compiling Utils.Containers.Internal.PtrEquality ( <...> )
<no location info>: error:
compiler/GHC/StgToCmm/Prim.hs:(344,32)-(345,74): Non-exhaustive patterns in lambda
Error: cabal: Failed to build containers-0.6.8 (which is required by
containers-tests-0).
The locations leads us to the emitPrimop for ReallyUnsafePtrEqualityOp.
https://gitlab.haskell.org/ghc/ghc/-/blob/ghc-9.6/compiler/GHC/StgToCmm/Prim.hs?ref_type=heads#L344-345
I am baffled.
Let's continue with a workaround, by removing all the reallyUnsafePtrEquality# stuff in PtrEquality.hs.
Issue 2
$ cabal test intmap-lazy-properties --enable-coverage
<...>
Running 1 test suites...
Test suite intmap-lazy-properties: RUNNING...
Test suite intmap-lazy-properties: PASS
Test suite logged to:
/home/meooow/dev/containers/dist-newstyle/build/x86_64-linux/ghc-9.6.3/containers-tests-0/test/containers-tests-0-intmap-lazy-properties.log
hpc-ghc-9.6.3: can not find containers-0.6.8-inplace/Utils.Containers.Internal.StrictPair in ./.hpc, /home/meooow/dev/containers/dist-newstyle/build/x86_64-linux/ghc-9.6.3/containers-tests-0/hpc/vanilla/mix/containers-tests-0, /home/meooow/dev/containers/dist-newstyle/build/x86_64-linux/ghc-9.6.3/containers-tests-0/hpc/vanilla/mix/intmap-lazy-properties
CallStack (from HasCallStack):
error, called at libraries/hpc/Trace/Hpc/Mix.hs:122:15 in hpc-0.6.2.0:Trace.Hpc.Mix
Error: cabal: Tests failed for containers-tests-0.
Okay we got the tests to run successfully. But hpc failed.
I find that I have two vanilla/mix dirs:
- dist-newstyle/build/x86_64-linux/ghc-9.6.3/containers-tests-0/hpc/vanilla/mix
- dist-newstyle/build/x86_64-linux/ghc-9.6.3/containers-0.6.8/hpc/vanilla/mix
For some reason, hpc attempts to find containers-0.6.8 mix files without being aware of the containers-0.6.8 directory. This looks like a Cabal issue? Let's try to work around it by running hpc manually.
Using hpc
I had to jump through a few hoops with hpc but they aren't really bugs so I won't go into the details. The gist is that I needed to go into containers-test and run hpc providing the tix file and mix dirs manually.
$ cd containers-tests
$ hpc markup \
../dist-newstyle/build/x86_64-linux/ghc-9.6.3/containers-tests-0/hpc/vanilla/tix/intmap-lazy-properties/intmap-lazy-properties.tix \
--hpcdir ../dist-newstyle/build/x86_64-linux/ghc-9.6.3/containers-tests-0/hpc/vanilla/mix/containers-tests-0 \
--hpcdir ../dist-newstyle/build/x86_64-linux/ghc-9.6.3/containers-tests-0/hpc/vanilla/mix/intmap-lazy-properties \
--hpcdir ../dist-newstyle/build/x86_64-linux/ghc-9.6.3/containers-0.6.8/hpc/vanilla/mix/containers-0.6.8
Writing: containers-0.6.8-inplace/Utils.Containers.Internal.Coercions.hs.html
<...>
Writing: IntMapValidity.hs.html
Writing: hpc_index.html
Writing: hpc_index_fun.html
Writing: hpc_index_alt.html
Writing: hpc_index_exp.html
Success!
Workaround tl;dr
- Delete the imports and usages of
reallyUnsafePtrEquality#inPtrEquality.hs - Run the test with
cabal test intmap-lazy-properties --enable-coverage. The test will run but hpc will fail, that's fine. cd containers-tests- Run hpc providing the tix file and mix dirs
hpc markup \ ../dist-newstyle/build/x86_64-linux/ghc-9.6.3/containers-tests-0/hpc/vanilla/tix/intmap-lazy-properties/intmap-lazy-properties.tix \ --hpcdir ../dist-newstyle/build/x86_64-linux/ghc-9.6.3/containers-tests-0/hpc/vanilla/mix/containers-tests-0 \ --hpcdir ../dist-newstyle/build/x86_64-linux/ghc-9.6.3/containers-tests-0/hpc/vanilla/mix/intmap-lazy-properties \ --hpcdir ../dist-newstyle/build/x86_64-linux/ghc-9.6.3/containers-0.6.8/hpc/vanilla/mix/containers-0.6.8
- 主要言語
- Haskell
- スター
- 355
- フォーク
- 194
- 平均マージ
- 3日 4時間
- マージ済み PR(30日)
- 7
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
haskell/containers のほかの issue
-
major-release strictness Tree
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
haskell/containers#1260 ·
メンテナーはふだん 2 日以内に返信
-
IntSet low-hanging-fruit performance
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
haskell/containers#1251 ·
メンテナーはふだん 2 日以内に返信
-
maintainability major-release
難易度 3/5 1〜2日 初心者へのやさしさ 70/100
haskell/containers#1250 ·
メンテナーはふだん 2 日以内に返信
-
performance Tree
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
haskell/containers#1247 ·
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 50/100
haskell/containers#1242 ·
メンテナーはふだん 2 日以内に返信
haskell/containers の issue をすべて見る
似ている issue
-
Preserve bind arrowオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
alunduil/siren-json.hs#233 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 84/100
alunduil/network-arbitrary#180 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
jgm/asciidoc-hs#14 ·