From e39bdd0ac877a663f8ae5903096f9c021a9ca43f Mon Sep 17 00:00:00 2001 From: Alexis Christoforides Date: Tue, 20 Aug 2019 13:53:59 -0400 Subject: [PATCH 1/4] Use the proper method for getting fully resolved temporary file paths This was a bug in the tests from https://github.com/mono/mono/pull/15616 --- src/System.IO.FileSystem/tests/File/Copy.cs | 6 +++--- src/System.IO.FileSystem/tests/File/Move.cs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/System.IO.FileSystem/tests/File/Copy.cs b/src/System.IO.FileSystem/tests/File/Copy.cs index 2cf108e8db09..81599984c6a9 100644 --- a/src/System.IO.FileSystem/tests/File/Copy.cs +++ b/src/System.IO.FileSystem/tests/File/Copy.cs @@ -56,9 +56,9 @@ public void CopyOntoSelf() [PlatformSpecific(TestPlatforms.AnyUnix)] public void DanglingSymlinkCopy() { - string dangling_symlink = GetTestFileName(); - string missing_target = GetTestFileName(); - string dangling_symlink_new_location = GetTestFileName(); + string dangling_symlink = GetTestFilePath(); + string missing_target = GetTestFilePath(); + string dangling_symlink_new_location = GetTestFilePath(); Assert.False(File.Exists(missing_target)); Assert.Equal(symlink(missing_target, dangling_symlink), 0); Copy(dangling_symlink, dangling_symlink_new_location); diff --git a/src/System.IO.FileSystem/tests/File/Move.cs b/src/System.IO.FileSystem/tests/File/Move.cs index 6548b4f5641e..4cdbf068beb5 100644 --- a/src/System.IO.FileSystem/tests/File/Move.cs +++ b/src/System.IO.FileSystem/tests/File/Move.cs @@ -182,9 +182,9 @@ public void MultipleMoves() [PlatformSpecific(TestPlatforms.AnyUnix)] public void DanglingSymlinkMove() { - string dangling_symlink = GetTestFileName(); - string missing_target = GetTestFileName(); - string dangling_symlink_new_location = GetTestFileName(); + string dangling_symlink = GetTestFilePath(); + string missing_target = GetTestFilePath(); + string dangling_symlink_new_location = GetTestFilePath(); Assert.False(File.Exists(missing_target)); Assert.Equal(symlink(missing_target, dangling_symlink), 0); Move(dangling_symlink, dangling_symlink_new_location); From 17919d0c3954f12418d88bf7025bf3d91988da99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Tue, 20 Aug 2019 20:14:36 +0200 Subject: [PATCH 2/4] Fix order in Assert.Equal --- src/System.IO.FileSystem/tests/File/Copy.cs | 2 +- src/System.IO.FileSystem/tests/File/Move.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/System.IO.FileSystem/tests/File/Copy.cs b/src/System.IO.FileSystem/tests/File/Copy.cs index 81599984c6a9..5814d44ad41a 100644 --- a/src/System.IO.FileSystem/tests/File/Copy.cs +++ b/src/System.IO.FileSystem/tests/File/Copy.cs @@ -60,7 +60,7 @@ public void DanglingSymlinkCopy() string missing_target = GetTestFilePath(); string dangling_symlink_new_location = GetTestFilePath(); Assert.False(File.Exists(missing_target)); - Assert.Equal(symlink(missing_target, dangling_symlink), 0); + Assert.Equal(0, symlink(missing_target, dangling_symlink)); Copy(dangling_symlink, dangling_symlink_new_location); Assert.True(File.Exists(dangling_symlink_new_location)); // File.Exists returns true for dangling symlinks } diff --git a/src/System.IO.FileSystem/tests/File/Move.cs b/src/System.IO.FileSystem/tests/File/Move.cs index 4cdbf068beb5..ec966e375015 100644 --- a/src/System.IO.FileSystem/tests/File/Move.cs +++ b/src/System.IO.FileSystem/tests/File/Move.cs @@ -186,7 +186,7 @@ public void DanglingSymlinkMove() string missing_target = GetTestFilePath(); string dangling_symlink_new_location = GetTestFilePath(); Assert.False(File.Exists(missing_target)); - Assert.Equal(symlink(missing_target, dangling_symlink), 0); + Assert.Equal(0, symlink(missing_target, dangling_symlink)); Move(dangling_symlink, dangling_symlink_new_location); Assert.True(File.Exists(dangling_symlink_new_location)); // File.Exists returns true for dangling symlinks } From 97b998ae6f0f918a274c18eab95a84819e1d3b93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Tue, 20 Aug 2019 20:16:41 +0200 Subject: [PATCH 3/4] Update Copy.cs --- src/System.IO.FileSystem/tests/File/Copy.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.IO.FileSystem/tests/File/Copy.cs b/src/System.IO.FileSystem/tests/File/Copy.cs index 5814d44ad41a..610f8e0414f2 100644 --- a/src/System.IO.FileSystem/tests/File/Copy.cs +++ b/src/System.IO.FileSystem/tests/File/Copy.cs @@ -60,7 +60,7 @@ public void DanglingSymlinkCopy() string missing_target = GetTestFilePath(); string dangling_symlink_new_location = GetTestFilePath(); Assert.False(File.Exists(missing_target)); - Assert.Equal(0, symlink(missing_target, dangling_symlink)); + Assert.Equal(0, symlink(missing_target, dangling_symlink)); Copy(dangling_symlink, dangling_symlink_new_location); Assert.True(File.Exists(dangling_symlink_new_location)); // File.Exists returns true for dangling symlinks } From 2fa65ece4dfab72c156d4833e0724ada905fc090 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Tue, 20 Aug 2019 20:17:00 +0200 Subject: [PATCH 4/4] Update Move.cs --- src/System.IO.FileSystem/tests/File/Move.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.IO.FileSystem/tests/File/Move.cs b/src/System.IO.FileSystem/tests/File/Move.cs index ec966e375015..ce2c7d0918c1 100644 --- a/src/System.IO.FileSystem/tests/File/Move.cs +++ b/src/System.IO.FileSystem/tests/File/Move.cs @@ -186,7 +186,7 @@ public void DanglingSymlinkMove() string missing_target = GetTestFilePath(); string dangling_symlink_new_location = GetTestFilePath(); Assert.False(File.Exists(missing_target)); - Assert.Equal(0, symlink(missing_target, dangling_symlink)); + Assert.Equal(0, symlink(missing_target, dangling_symlink)); Move(dangling_symlink, dangling_symlink_new_location); Assert.True(File.Exists(dangling_symlink_new_location)); // File.Exists returns true for dangling symlinks }