aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/cpp
diff options
context:
space:
mode:
authorGravatar Marcel Hlopko <hlopko@google.com>2017-01-10 15:51:06 +0000
committerGravatar Marcel Hlopko <hlopko@google.com>2017-01-10 15:53:50 +0000
commit284bbda34a3405779da67dc4fa15ef0fea76a88e (patch)
treedcd6d6fcb39827a53b98f7df4b437a1bd13b977f /src/test/cpp
parent62a6f695f95b8dde15fe9b287a290dc7ac06e173 (diff)
*** Reason for rollback *** Breaks windows: bazel-out/local-fastbuild/bin/src/main/cpp/util/libfile.a(file_windows.o):file_windows.cc:(.text+0x11e2): multiple definition of `blaze_util::UnlinkPath(std::string const&)' bazel-out/local-fastbuild/bin/src/main/cpp/util/libfile.a(file_posix.o):file_posix.cc:(.text+0x3ff): first defined here *** Original change description *** Bazel client, Windows: implement UnlinkPath See https://github.com/bazelbuild/bazel/issues/2107 -- PiperOrigin-RevId: 144082937 MOS_MIGRATED_REVID=144082937
Diffstat (limited to 'src/test/cpp')
-rw-r--r--src/test/cpp/util/file_windows_test.cc31
1 files changed, 0 insertions, 31 deletions
diff --git a/src/test/cpp/util/file_windows_test.cc b/src/test/cpp/util/file_windows_test.cc
index 3b51642950..1cf49d88c5 100644
--- a/src/test/cpp/util/file_windows_test.cc
+++ b/src/test/cpp/util/file_windows_test.cc
@@ -290,35 +290,4 @@ TEST(FileTest, TestPathExistsWindows) {
ASSERT_FALSE(PathExists(JoinPath(tmpdir, "junc2")));
}
-TEST(FileTest, TestUnlinkPath) {
- string tmpdir(GetTestTmpDir());
- ASSERT_LT(0, tmpdir.size());
- ASSERT_TRUE(PathExists(tmpdir));
-
- // Create a directory under `tempdir`, a file inside it, and a junction
- // pointing to it.
- string dir1(JoinPath(tmpdir, "dir1"));
- ASSERT_EQ(0, mkdir(dir1.c_str()));
- FILE* fh = fopen(JoinPath(dir1, "foo.txt").c_str(), "wt");
- ASSERT_NE(nullptr, fh);
- ASSERT_LT(0, fprintf(fh, "hello\n"));
- fclose(fh);
- string junc1(JoinPath(tmpdir, "junc1"));
- RunCommand(string("cmd.exe /C mklink /J \"") + junc1 + "\" \"" + dir1 +
- "\" >NUL 2>NUL");
- ASSERT_TRUE(PathExists(junc1));
- ASSERT_TRUE(PathExists(JoinPath(junc1, "foo.txt")));
-
- // Non-existent files cannot be unlinked.
- ASSERT_FALSE(UnlinkPath("does.not.exist"));
- // Directories cannot be unlinked.
- ASSERT_FALSE(UnlinkPath(dir1));
- // Junctions can be unlinked, even if the pointed directory is not empty.
- ASSERT_TRUE(UnlinkPath(JoinPath(junc1, "foo.txt")));
- // Files can be unlinked.
- ASSERT_TRUE(UnlinkPath(junc1));
- // Clean up the now empty directory.
- ASSERT_EQ(0, rmdir(dir1.c_str()));
-}
-
} // namespace blaze_util