atilaneves / dpp

Directly include C headers in D source code
Boost Software License 1.0
230 stars 31 forks source link

Add tests from Rust bindgen #155

Open Laeeth opened 5 years ago

Laeeth commented 5 years ago

To start with you could just check dpp doesn't choke on their headers, linked here:

https://github.com/rust-lang/rust-bindgen

Someday we can check the D declaration is right but it's not urgent.

They have a cool fuzzer here:

https://github.com/rust-lang/rust-bindgen/blob/master/tests/quickchecking/src/fuzzers.rs

Laeeth commented 5 years ago

Note that it's just rust code that generates random headers. So we could use directly just by creating relevant dpp file in a bash script.

bindgen with quickchecking quickchecking generates random C headers to test bindgen using the quickcheck property testing crate. When testing bindgen with quickchecking, the generated header files are passed to bindgen's csmith-fuzzing/predicate.py script. If that script fails, quickchecking panics, and you can report an issue containing the test case!

Prerequisites Running Prerequisites

Laeeth commented 5 years ago

Also they have a driver for csmith. https://github.com/rust-lang/rust-bindgen/blob/master/csmith-fuzzing/README.md