c4-project / c4f

The C4 Concurrent C Fuzzer
MIT License
13 stars 1 forks source link

Add payload shrinking support #224

Open MattWindsor91 opened 3 years ago

MattWindsor91 commented 3 years ago

It occurs to me that a fairly straightforward form of test case reduction is to require action bodies have a member with one of these signatures:

module Payload : sig
  (* ... *)
  val shrinker : t Base_quickcheck.Shrinker.t (* or *)
  val shrinker : t -> t Sequence.t
end

The idea is that the payload shrinker would, in the QuickCheck tradition, propose a lazy sequence of ways in which the payload can be shrunk. I suspect the sequence would need to contain drastic shrinks first and then step backwards.

Ideas of useful shrinks:

Most of these shrinks wouldn't affect path motion (at least, not until we add in-expression pathing), and so could be added before we fix #218. We could then add to the bisector the ability to trawl through every remaining action's payload and perform payload shrinking (and, eventually, once we have path motion compensation, we'd be able to knock other actions out too).