I'm writing a library that calls recvmsg
, and now I'm writing tests for that library. I want to test the error paths: the code that runs when recvmsg
returns an error. I could mock out recvmsg
but if it's possible I would prefer to test the real code as much as I can.
Is there a way to induce recvmsg
to return an error? For my current use case I don't care which error, as I handle all errors the same, but being able to induce particular errors would be a nice-to-have.
In case it matters, the socket I'm receiving from is a UDP socket.