12

I have been sending small fixes to uutils, the Rust rewrites of coreutils, findutils, sed and procps. The way I find the bugs is simple: record how the GNU tool behaves on a few hundred cases (stdout, stderr, exit code, files it touches), then replay the same cases against the uutils build and read the diffs.

The write-up is about what that turned up. Almost nothing was a crash. It was error message wording, option parsing edge cases like a bare - being eaten as an option value, exit codes, and a few GNU version differences that look like bugs but are really version pins.

So far that is 44 bug reports and 51 fix PRs upstream, 34 of them merged. The recorder is a small open source tool I wrote: https://github.com/emirmrkaljevic/behave

Happy to hear how others test rewrites for compatibility.

you are viewing a single comment's thread
view the rest of the comments
[-] INeedMana@piefed.zip 4 points 2 days ago

You could have been creating the test cases with just expect

[-] emirmrkaljevic@programming.dev 1 points 1 day ago

True, for a handful of hand-written cases expect works fine. The part I wanted to automate is before that: generating a few hundred cases from the tool's --help, recording what the original binary does on each, and then grouping the diffs when the same cases run against another binary. Writing that many cases by hand is where I always gave up. For interactive prompts expect is still the right tool, behave only covers non-interactive runs (arguments, stdin and files).

[-] INeedMana@piefed.zip 3 points 1 day ago

No, not by hand. That would be madness. autoexpect

[-] emirmrkaljevic@programming.dev 1 points 21 hours ago

Fair point, autoexpect does take the typing out of it. It still records one session that you drive yourself though. What I wanted was the step before that: read the tool's --help, try lots of flag combinations and odd inputs on its own, and keep hundreds of cases without me deciding each one. Then replay them against the rewrite. For a few interactive flows, autoexpect is probably the better tool.

[-] INeedMana@piefed.zip 1 points 18 hours ago

You can keep the loop as it is. My point is, you could have used existing tools for extraction and confirmation of behavior instad of reinventing the wheel

this post was submitted on 25 Nov 2026
12 points (83.3% liked)

Rust

8386 readers
23 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 3 years ago
MODERATORS