Fix build of tests with mingw

very, very partial backport of 2f795d8fc50d81641d95723d9ddd92795886bed3 to maint/v0.21 branch

without this include, O_RDWR and O_CREAT are undeclared when building tests/path/win32.c with mingw