lundi 19 septembre 2016

Looking for a way to force a short read in linux

I am looking for a method of producing short reads in linux so I can unit test the handling code around them.

I have a number of methods which at the lower levels call pread / pread64 to read from a file within the file system. These are designed to handle situations where a short read occurs (the number of bytes read is less than the number requested).

I have seen situations where short reads occur (across networked file systems).

Ideally I would be able to create a file that would allow N bytes to be read and then a short read of M bytes would occur, followed by normal reads as expected. This would allow unit tests to point at the file / file system.

Thanks!

Aucun commentaire:

Enregistrer un commentaire