I haven't looked into the context deeply, so perhaps I'm missing something. But why not just use setbuf/setvbuf to fix the buffer size in the test to match the assumption encoded in the choice of padding size to write?