Skip Navigation

emirmrkaljevic

@emirmrkaljevic.programming.dev.ap.tdpl.io

10 Posts7 Comments0 Memberships

Joined November 2026

  • rust What 27 merged PRs taught me about testing a Rust rewrite (uutils) as a black box

    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.

    0 1
  • cool_github_projects behave: record how a CLI tool behaves, then replay it against a rewrite of that tool

    Good question. expect is for scripting interactive programs: you write the dialogue by hand (send this, wait for that prompt) and it drives the program through a pseudo-terminal.

    behave is for non-interactive commands, and you don't write the cases. It reads --help and the man page, generates a few hundred invocations (single flags, flag pairs, listed values, odd stdin, missing files, bad values), and records stdout, stderr and the exit code of each one as YAML. Then it replays the same cases against a second binary and diffs them. So the main use is checking a rewrite or a refactor against the original, like the uutils coreutils ports against GNU.

    Each case just gets a fixed stdin and no terminal, so for a REPL or anything that prompts, expect is still the right tool.

    1 1
  • rust What 27 merged PRs taught me about testing a Rust rewrite (uutils) as a black box

    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).

    0 1
  • linux I made usb-rea: point it at a USB capture of a Windows-only vendor app and it writes a Linux driver

    Partly. The capture side is USB specific (it reads usbmon/USBPcap pcapng, endpoints and control setup packets), but the inference part is not: it diffs payloads between labelled actions and looks for constant headers, counters, length fields, checksums and value fields. Network protocols would mostly need a different front end that feeds it TCP/UDP payloads. That isn't built in today. For network protocols Netzob is worth a look, it has been doing that kind of inference for years. File formats are harder because you rarely get clean "I changed exactly one thing" pairs, but the same diffing trick works if you save the file twice with one setting changed.

    2 0
  • commandline behave: record how a CLI behaves, then replay it against a rewrite

    Yes, I used AI coding tools a lot while building it, both for the Go code and for working through the uutils differences. The part I care about is that everything is checkable: the specs are plain files recorded from the real GNU binaries, every reported difference is a command plus expected and actual output you can rerun yourself, and the upstream fixes went through normal review by the uutils maintainers before they were merged.

    1 0