candy icon indicating copy to clipboard operation
candy copied to clipboard

Add fuzzing to the CI

Open MarcelGarus opened this issue 3 years ago • 1 comments

Depends on #245

This makes the exit code of the candy fuzz command match whether errors were found during fuzzing. It also adds fuzzing to the CI and fixes some errors that were discovered.

MarcelGarus avatar Oct 19 '22 22:10 MarcelGarus

In the logs, you may have noticed that the functions in Core are fuzzed several times. That's because the tree of modules created from Core/_.candy contains the outer leaf files many times. For example, the core.bool module is imported by many other modules in the core package, causing it to be instantiated and evaluated many times. All the created closures are separate and fuzzed independently.

I guess I'll start working on some basic optimizations such as function inlining, duplicate subtree elimination, and compile-time evaluation soon to fix the problem described above. LLVM would also do those optimizations, but we'd have to turn the entire tree (including expanded uses, thus an exponential amount of code) into LLVM-IR for it to do its magic, so that's too late in the pipeline and it makes sense to do these optimizations in Candy itself.

MarcelGarus avatar Oct 19 '22 22:10 MarcelGarus

Fuzzing works fine locally. Seems like this is an issue of nightly cargo: https://github.com/rust-lang/cargo/issues/8557

MarcelGarus avatar Nov 10 '22 21:11 MarcelGarus

Fair enough, I'll just disable the fuzzing for now

MarcelGarus avatar Nov 10 '22 22:11 MarcelGarus