From a979677021143b7d039daef9c7696b53484ac030 Mon Sep 17 00:00:00 2001 From: Mihai Maruseac Date: Mon, 6 Jan 2020 11:22:54 -0800 Subject: [PATCH] Make modular filesystems test run on windows. This is prerequisite to having windows filesystem be a module. PiperOrigin-RevId: 288339089 Change-Id: Ia4794639aeb5f1c21c8e5c9cd7d55049b32ed5ed --- .../filesystem/modular_filesystem_test.cc | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tensorflow/c/experimental/filesystem/modular_filesystem_test.cc b/tensorflow/c/experimental/filesystem/modular_filesystem_test.cc index cf665d8f981..020c32e893a 100644 --- a/tensorflow/c/experimental/filesystem/modular_filesystem_test.cc +++ b/tensorflow/c/experimental/filesystem/modular_filesystem_test.cc @@ -27,11 +27,18 @@ limitations under the License. #include "tensorflow/core/platform/test.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) -#error Windows is not yet supported. Need mkdir(). -#endif +// Make mkdir resolve to _mkdir to create the test temporary directory. +#include +#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 // defined by `filesystem_interface.h`. @@ -86,9 +93,6 @@ class ModularFileSystemTest : public ::testing::TestWithParam { } 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) { int error_code = errno; GTEST_SKIP() << "Cannot create working directory: "