Mica::Testing::FuzzCampaign
Runs seeded fuzz cases through a format and tallies what happened.
The format's block parses one input and returns a Trial; anything the
block raises is caught here. A case is:
- accepted when the block returns without an error,
- rejected when the trial carries a
Mica::Error(the only acceptable failure), - a crash when the block raises anything that is not a
Mica::Error, or returns a trial with failed checks.
Every case is also checked for:
- budget overruns: operations above the allowance plus the format's check interval (the meter must stop work in time);
- determinism (when enabled): the same bytes give the same outcome twice.
campaign = Mica::Testing::FuzzCampaign.new(mutator, seed: 7_i64, overrun_slack: 70_000_i64)
report = campaign.run(10_000) do |bytes|
meter = Mica::Core::WorkMeter.new
begin
Mica::XML.parse(bytes, meter: meter)
Mica::Testing::FuzzCampaign::Trial.new("ok", nil, meter)
rescue error : Mica::Error
Mica::Testing::FuzzCampaign::Trial.new(error.message.to_s, error, meter)
end
end
report.list_of_crashes # => [] of String
Constructors
Instance methods
report
Source