Skip to content

C6 Mutation testing ​

IDGroupTypeBackendsFigureProgram
C6ContractsCCPU (gfortran 16.2, tests-gnu)noscripts/mutation_test.py

Case and scope ​

A test suite can pass because the code is right, or because the tests cannot see the defect. Mutation testing asks the second question directly. It plants one defect at a time in a scratch copy of the tree, rebuilds, runs the whole suite, and the defect (the mutant) is killed when at least one program fails. A surviving mutant is a defect the suite is blind to.

Setup ​

MutantWhat it changes
ssp22-weight, ssp33-weight, rk4-weighta Butcher weight in the fifth digit
ssp54-shu-osher-beta, ssp104-alphaa Shu–Osher coefficient (converted at run time)
ssp33-two-register-ca two-register coefficient
lsrk33-A, lsrk54-Ba 2N coefficient (lsrk54-B in the 13th digit)
yoshida-w1, blanes-moan-s6-a1a splitting coefficient
ssp-coefficient-maxthe SSP coefficient as the maximum instead of the minimum ratio
axpy-sign, lincomb-beta, stage-state-dt, step-update-dq-zero, shu-osher-2r-swapa kernel body
williamson-a0-readsthe 2N stage with A=0 reads its register again
mask-signthe mask's sign convention inverted in one kernel
box-ghost-boundthe box's allocation lower bound off by one
stage-state-copy-n1the copy shortcut taken for one register instead of none
registers-butcherone register too few for the Butcher form
rhs-slotthe residual register is the stage state's
stage-weight-cstage_weight returns ck instead of bk
ketcheson-euler-step, ketcheson-combinationKetcheson's recipe: the Euler step, the mid-step combination
stages-on-q-allevery stage treated as evaluated on q
two-register-no-qnthe two-register form forgets to keep qn
splitting-subflowthe splitting sub-flow scaled by 1.0001

Program ​

bash
python3 scripts/mutation_test.py [--only NAME ...]     # about half an hour for the 28 mutants

Results ​

28 of 28 mutants killed (2026-11-17; the run record is notes/mutation-run-2026-11-17.txt).

Findings ​

  • The first run killed 27. The survivor, ssp104-alpha, changed the coefficient of un in ssp-104's last Shu–Osher stage. Nothing in the library reads it: the Butcher conversion skips the row of un, and the SSP coefficient skips β=0. So a wrong value in the public shu_osher() result was invisible. selah_test_schemes now checks that every Shu–Osher form is consistent (each row of α sums to 1), and the mutant is killed.
  • Most mutants are caught by several programs at once: the golden file, the orders and the contract checks overlap.

GPL-3.0-or-later, BSD-2-Clause, BSD-3-Clause or MIT, at your choice