aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/cpp
diff options
context:
space:
mode:
authorGravatar Laszlo Csomor <laszlocsomor@google.com>2017-01-10 20:40:27 +0000
committerGravatar Marcel Hlopko <hlopko@google.com>2017-01-10 20:45:48 +0000
commit5e9eb1977ec030fa66815d79b5cdab158317bf25 (patch)
tree016484faaf38f3eb8f707656112ae82fa46be57b /src/test/cpp
parentfa623121db22c0350007d1c3690252b50f48e0b7 (diff)
*** Reason for rollback *** Bad rollback, was only partial. *** Original change description *** Automated [] rollback of commit 9a13899b1492738f8d1a9118cebc9ef9d90c6b34. *** Reason for rollback *** Fixed the problem with the CL. *** Original change description *** Bazel client, Windows: implement UnlinkPath See https://github.com/bazelbuild/bazel/issues/2107 -- PiperOrigin-RevId: 144115263 MOS_MIGRATED_REVID=144115263
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 1d73d65e53..5c2f68ee27 100644
--- a/src/test/cpp/util/file_windows_test.cc
+++ b/src/test/cpp/util/file_windows_test.cc
@@ -290,37 +290,6 @@ 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()));
-}
-
TEST(FileTest, TestIsDirectory) {
ASSERT_FALSE(IsDirectory(""));