views:

36

answers:

1

I have some software that is usually relies on data that is stored on a local hard drive. However one of my clients is encountering an error that I am unable to reproduce, and I think this may have something to do with the fact that their data is on a SAN. The program crashes randomly, and only when manipulating files.

It would be useful to have some software that could simulate a shared drive on the network that would allow me to cause different kinds of network/permissions errors so we can reproduce the bug. Is there something out there that does this for a Windows-based environment?

+1  A: 

In some sense, what you are asking for is simply a network file server (map a drive to a server on the network). You can set permissions on a file so that a client has no access to it, change it so it can read a file but not write to it, etc. And you can even resort to low tech operations such as unplugging the network cable randomly. I suspect that the number of bugs reproduced/demonstrated by that big hammer type of operation is non-zero.

Another possibility, though, would be to simply wrap the I/O calls with your own functions and “randomly” return errors from those functions. Unless you are doing particularly esoteric operations or using I/O completion ports or possibly overlapped I/O, it might not be very much work to do that with some cleverly constructed macros (#define originalfunc(x,y,z) mycrashyfunc(x,y,z)). The number of file functions used by many applications is a fairly small set (open, seek, read, write, flush, close, etc.) Your version of each function might be something such as:

if ( rand() % 5 == 0 )
    return an error
 else
    return originalfunc(x,y,z);
Mark Wilkins