Random test generator for differential fuzzing #2748
Replies: 2 comments 1 reply
-
Nice, I also think that we should support something like https://hackage.haskell.org/package/QuickCheck in Scryer. The idea is to have a little bit more control over what kinds of predicates ought to be generated. |
Beta Was this translation helpful? Give feedback.
-
Very interesting, thank you a lot for working on this! Several of these test cases may be easier to describe in Prolog itself, is the Scryer library version usable for this? There are example usages of Scryer Prolog from within Rust programs in the repository: https://github.com/mthom/scryer-prolog/tree/master/src/machine/lib_machine |
Beta Was this translation helpful? Give feedback.
-
I've been inspired by the article on ZenBleed to do try out differential fuzzing, and from seeing instances of UB in
scryer-prolog
, I figured it would be a fun project to try to automatically find edge cases or UB through fuzzing.Right now all I have is a random predicate generator, which produces simple (but nonsensical, since they're random) predicates:
It works by randomly creating a new predicate, or a new case for an existing predicate, or by modifying the goals within a case.
One tricky area so far is termination; I'm enforcing a strictly decreasing term, but that of course limits the number of predicates that my code is able to generate. I hope to add more well orders for termination, so that I can cover more ground.
It's also quite easy to make predicates whose complexity blows up:
To solve that I made it so that the generator would let alone predicates which are complex enough, and would not add recursive calls to predicate cases that already have one.
It's, again, going to shrink the coverage that I can provide, but I need to be able to run the prolog code if I want to do some differential fuzzing :/
There's still a long way until this thing can produce prolog programs that properly stress the engine, but I'd love to hear your thoughts on this idea :)
Beta Was this translation helpful? Give feedback.
All reactions