[Toybox] dd tests for transaction size?

Rob Landley rob at landley.net
Sun Jul 9 00:41:45 PDT 2017


This time around I'm cleaning up dd in small chunks, dealing with the
code that's there before reading the spec and trying to do it a proper
version. (That way at least I'm not likely to abandon a large half-done
rewrite for a _fourth_ time.)

Each time I make sure it passes "make test_dd" before checking it in,
but what's there isn't complete. I know I've ruminated about this on the
list before, but does anybody have a decent strategy for testing the ibs
and obs options? I can't do it with pipes because thanks to the Great
Pipe Rewrite of 2006 (http://yarchive.net/comp/linux/splice.html) those
collate the data going through them.

I think I asked about this on the list before, but the best thing I'm
coming up with right now is trying to parse the output of strace, which
can't be right. (Maybe I could do something with ptys? Or fifos? I want
something that forces the write to _block_ until acknowledged so there
isn't a potentially collating race condition in there.)

Then again strace should work, and I've been meaning to add a simple one
to toybox. "Are read() and write() called with the correct size" is
pretty much what I'm trying to _check_. Pity dd hasn't got a "verbose"
mode. (Yes I'm aware of siginfo, race condition city trying to test with
that.)

Mabye I can have a command that meters out input based on the output
received, but that's the loop problem again. (For years I've wanted a
"loop" command built into the shell that feeds the output of a pipeline
back into the input of the same pipeline. You'd think there'd be a way
to do it with exec but the closest I managed involved fifos...)

Rob


More information about the Toybox mailing list