A differential run can carry a killed outcome onto a surviving mutant and exit 0
I maintainer di solito rispondono entro 3 giorni
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Read functions.mutation_id, _select, and _carry_forward, then trace how mutation IDs and form digests are built and reused. Reproduce the reported Go case with the 7-byte comment and compare it with --mutate-all and the 8-byte comment case. Done means the differential run preserves the surviving mutant’s outcome correctly and avoids rerunning unaffected functions; pull request #23 is already open.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
A mutation id holds the site's byte offsets in the file. When text above an unchanged function moves it by exactly the distance between two identical sites in it, a site takes the id its neighbour had in the last run. It inherits that outcome without being run.
Repro (mutator a5a0cb8, crapper 6fd92c4, go 1.27.3, macOS 27)
go.mod: module example.com/shop
calc/calc.go:
package calc
func F(a, b, c, d int) (bool, bool) {
return a > b, c > d
}
calc/calc_test.go (it checks only the second result, so a > b → a >= b survives):
package calc
import "testing"
func TestF(t *testing.T) {
if _, y := F(0, 0, 1, 1); y {
t.Fatal("c > d")
}
}
$ ../mutator/mutator --no-coverage calc/calc.go
SURVIVED calc/calc.go:4 > -> >=
KILLED calc/calc.go:4 > -> >=
$ echo $?
3
The snapshot has […,"defn/F",62,63,">",">="] :survived and […,"defn/F",69,70,">",">="] :killed. Now add a 7-byte comment above F, the distance between the two >:
package calc
// ab
func F(a, b, c, d int) (bool, bool) {
return a > b, c > d
}
$ ../mutator/mutator --no-coverage calc/calc.go
KILLED calc/calc.go:6 > -> >=
KILLED calc/calc.go:6 > -> >=
$ echo $?
0
With --verbose, only one mutant runs. The first > is now at 69..70: it takes the killed id and is carried forward. --mutate-all on the same file reports the survivor again and exits 3, as does an 8-byte comment instead of 7.
Cause, as far as I can tell
functions.mutation_id uses site.start and site.end, which are offsets in the file. _select and _carry_forward reuse an outcome when the form's digest is unchanged and the id matches. The digest covers only the function's text, so it does not change when the function moves, while the offsets do.
Why it matters
Used as a gate, the run reports 100% and exits 0 with a surviving mutant. In Go a function often repeats a site, such as err != nil, so an edit above it can line up with a gap between two of them. The same offsets also make every function below an edit rerun all its mutants, which loses most of the gain of a differential run.
Possible fix
Key the id by offsets relative to the start of its form, or by the site's ordinal among identical sites in the form, rather than by offsets in the file.
- Lingua principale
- Python
- Stelle
- 97
- Fork
- 45
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di unclebob/mutator
-
test_git_status_keeps_real_names_and_fails_closed fails when git output is translatedForse già presa @bennibyx l’ha presa 1 giorno fa. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 83/100
unclebob/mutator#24 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 3 giorni
-
Workers leave out source in a directory named build, out, dist, target or coverage, so every mutant is reported KILLEDForse già presa @lohmag l’ha presa 4 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 3 giorni
-
Edits made to the file under test during a run are reverted when the run endsForse già presa @andrewmolyuk l’ha presa 2 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
unclebob/mutator#19 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
Tutte le issue di unclebob/mutator
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 80/100
Imbad0202/academic-research-skills#1039 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
alexgreensh/token-optimizer#297 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
superdesigndev/treg#1343 ·
I maintainer di solito rispondono entro 1 giorno
-
GitHub handle should allow underscoresForse già presa @PrakarshSrivastav l’ha presa oggi. Apertabug good-first-issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
nf-core/tools#4581 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue test
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
ANCORATE/EncryptHome#8 ·