News for hackers. Stuff that matters.
Re:You can use C-Reduce for any language by lambda on Wednesday November 27, 2024 @02:06PM (#42258733)
Note that as recommended by John Regehr, author of C-Reduce, for this use case you might also want to try Shrinkray, a tool that was written to be format independent and works well for cases that C-Reduce dow not: https://mastodon.social/@regehr/113489759789563570
Re:You can use C-Reduce for any language by canu7 on Wednesday November 27, 2024 @05:51PM (#42260604)
Looking forward to try it! A shout out to cvise (https://github.com/marxin/cvise) as a python alternative that works well too for non c languages.
Re:You can use C-Reduce for any language by droideqa on Wednesday November 27, 2024 @06:53PM (#42261020)
Is this[0] the official repo of Shrinkray?

[0]: https://github.com/DRMacIver/shrinkray

Re:You can use C-Reduce for any language by eru on Wednesday November 27, 2024 @09:35PM (#42261900)
Interesting, isn't that also the author of Python's hypothesis?
Re:You can use C-Reduce for any language by lambda on Wednesday November 27, 2024 @09:46PM (#42261949)
Yes, hypothesis also does minimization of failed test cases, so it's kind of a similar problem, just a question if what format the data is in and how you invoke your test.
Re:You can use C-Reduce for any language by DRMacIver on Thursday November 28, 2024 @08:23AM (#42265073)
Yes, that's me.

I accidentally got obsessed with test-case reduction as a result of writing Hypothesis, and wrote shrinkray because I thought it was ridiculous that I hadn't put all of the things I'd learned about test-case reduction into some general purpose tool that other people could benefit from.

Shrinkray is still a bit under-advertised and rough around the edges in places, but I think that basically there's no good reason to use C-reduce over shrinkray for things that aren't C or C++. Shrinkray has very good generic heuristics that should work in most languages (it even works pretty well on binary files apparently, although I've not tested this myself), a couple of language specific passes for other languages, and is much more fun to watch.

It might even be the case that you should use shrinkray for C and C++ too (because I use C-Reduce's transformations for those languages), but I'm less confident that that's true. The best I'll confidently claim is "probably more competitive than you'd expect".

Re:You can use C-Reduce for any language by lambda on Wednesday November 27, 2024 @09:50PM (#42261974)
Yep!