Make modular filesystems test run on windows.

This is prerequisite to having windows filesystem be a module.

PiperOrigin-RevId: 288339089
Change-Id: Ia4794639aeb5f1c21c8e5c9cd7d55049b32ed5ed
This commit is contained in:
Mihai Maruseac 2020-01-06 11:22:54 -08:00 committed by TensorFlower Gardener
parent 2561c27de3
commit a979677021
1 changed files with 11 additions and 7 deletions

View File

@ -27,11 +27,18 @@ limitations under the License.
#include "tensorflow/core/platform/test.h" #include "tensorflow/core/platform/test.h"
#include "tensorflow/core/util/command_line_flags.h" #include "tensorflow/core/util/command_line_flags.h"
// TODO(b/143949264): Testing is not yet supported on Windows. Will implement
// testing on Windows when implementing modular filesystems on Windows.
#if defined(PLATFORM_WINDOWS) #if defined(PLATFORM_WINDOWS)
#error Windows is not yet supported. Need mkdir(). // Make mkdir resolve to _mkdir to create the test temporary directory.
#endif #include <direct.h>
#define mkdir(name, mode) _mkdir(name)
// Windows defines the following macros to convert foo to fooA or fooW,
// depending on the type of the string argument. We don't use these macros, so
// undefine them here.
#undef LoadLibrary
#undef CopyFile
#undef DeleteFile
#endif // defined(PLATFORM_WINDOWS)
// The tests defined here test the compliance of filesystems with the API // The tests defined here test the compliance of filesystems with the API
// defined by `filesystem_interface.h`. // defined by `filesystem_interface.h`.
@ -86,9 +93,6 @@ class ModularFileSystemTest : public ::testing::TestWithParam<std::string> {
} }
void SetUp() override { void SetUp() override {
// TODO(b/143949264): Testing is not yet supported on Windows. Will
// implement testing on Windows when implementing modular filesystems on
// Windows.
if (mkdir(root_dir_.c_str(), 0755) != 0) { if (mkdir(root_dir_.c_str(), 0755) != 0) {
int error_code = errno; int error_code = errno;
GTEST_SKIP() << "Cannot create working directory: " GTEST_SKIP() << "Cannot create working directory: "