Go: coverage profile is never matched, so every site is reported uncovered and the run exits 0
メンテナーはふだん 3 日以内に返信
評価
調査の方向性
Start in target/coverage/go/coverage.out handling and the coverage.covered_lines / _suffix_rank / _lookup functions the issue names. Reproduce with the given Go module repro, then add a candidate that strips the module path from go.mod off profile keys (or adds a root-relative path candidate). Done: Go profiles match on a covered module, mutants are killed, and the exit code reflects killed mutants.
索引モデルが issue の本文から書いたものです。
説明
On a Go module, mutator reports every site as uncovered and exits 0, even when the tests cover the line. With --no-coverage the same sites run.
Repro (mutator a5a0cb8, crapper 6fd92c4, go 1.25.8, macOS)
go.mod: module example.com/demo
calc/calc.go:
package calc
func Max(a, b int) int {
if a > b {
return a
}
return b
}
calc/calc_test.go:
package calc
import "testing"
func TestMax(t *testing.T) {
if Max(2, 1) != 2 || Max(1, 2) != 2 {
t.Fatal("wrong max")
}
}
$ ../mutator/mutator calc/calc.go
Max example.com/demo/calc 0 0 1 1 n/a
$ echo $?
0
$ ../mutator/mutator --no-coverage calc/calc.go
Max example.com/demo/calc 0 1 0 1 0.0%
crapper reads the same profile correctly (Max example.com/demo/calc 2 100.0% 2.0).
Cause, as far as I can tell
target/coverage/go/coverage.out names the file by import path, example.com/demo/calc/calc.go. coverage.covered_lines looks it up by absolute path, /…/mutrepro/calc/calc.go. _suffix_rank only matches when one path is a suffix of the other, and these two share only the tail calc/calc.go, so _lookup returns None and every line counts as uncovered.
Why it matters
Exit 0 means every executed mutant was killed. Used as a gate on a Go project, mutator passes without running a mutant.
Possible fix
Strip the module path from go.mod off Go profile keys before matching, or add the root-relative path to the lookup candidates.
- 主要言語
- Python
- スター
- 55
- フォーク
- 7
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
unclebob/mutator のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 83/100
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 3 日以内に返信
-
Workers leave out source in a directory named build, out, dist, target or coverage, so every mutant is reported KILLED対応中かも @lohmag が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 3 日以内に返信
-
A differential run can carry a killed outcome onto a surviving mutant and exit 0対応中かも @andrewmolyuk が今日担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
メンテナーはふだん 3 日以内に返信
-
Edits made to the file under test during a run are reverted when the run ends対応中かも @andrewmolyuk が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
メンテナーはふだん 3 日以内に返信
unclebob/mutator の issue をすべて見る
似ている issue
-
getchaintips leaves out the active tip once a header is staged on it, where Core always lists itオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
btclib-org/btclib-node#2158 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
dbt-msft/dbt-sqlserver#897 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
Gathin23/cleanyourtv#2770 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
vllm-project/vllm#64845 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
dekobon/big-code-analysis#1729 ·
メンテナーはふだん 1 日以内に返信