Add support for Windows
The main problem for Windows support was the timeout_readwrite
crate that only supports linux. The possible options to fix that are:
- Add support in
timeout_readwrite
. However, that doesn't seem to be a priority for the maintainer (as mentioned here). They support more than justChildStdout
pipes in that crate and the Windows implementation would vary depending on the type of handle. - Fork
timeout_readwrite
(internally?) to only support named pipes and add support for windows. - Add an internal implementation of
TimeoutReader
for Windows and keep using thetimeout_readwrite
crate for linux. That's the approach I'm taking in this MR, usingmiow
(component oftokio
) forNamedPipe
andOverlapped
abstractions. - Use another crate altogether for reading with a timeout.
mio
could probably fit the bill and is well maintained, but we would need to pull in another library for timer implementation as it's not part ofmio
. That also seems to be a big dependency for such a small piece.
With the current approach, there is also some latitude about the reliance on external crates. I can try to push a read_with_timeout
function upstream into miow
or pull Overlapped::initialize_with_autoreset_event
and NamedPipe::read_overlapped
into deqp-runner
.
There was also an issue with the timeout
unit tests that are relying on cat
. There is no comparable utility on windows (that I could find). There is the possibility of replicating that behaviour in another internal binary (stdin -> stdout
) and it does work (I've tested it), but that would need to be an integration test (so that the binary is built). There are already integration tests testing that feature, so I've simply removed the unit tests. I've still a novice in Rust, so there might be a way to build cat.rs
to use in the unit test, but I couldn't find it.
Note: Marking this as a WIP as I haven't completely tested if just yet. However, all of the deqp-runner
tests are succeeding on Windows and Linux.