Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 0 additions & 98 deletions src/libraries/Common/tests/System/IO/PathFeatures.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ namespace System.Diagnostics.Tests
{
public partial class ProcessModuleTests : ProcessTestBase
{
[ConditionalFact(typeof(PathFeatures), nameof(PathFeatures.AreAllLongPathsAvailable))]
[Fact]
public void LongModuleFileNamesAreSupported()
{
// To be able to test Long Path support for ProcessModule.FileName we need a .dll that has a path > 260 chars.
// Since Long Paths support can be disabled (see the ConditionalFact attribute usage above),
// we just copy "LongName.dll" from bin to a temp directory with a long name and load it from there.
// We just copy "LongName.dll" from bin to a temp directory with a long name and load it from there.
// Loading from new path is possible because the type exposed by the assembly is not referenced in any explicit way.
const string libraryName = "LongPath.dll";
const int minPathLength = 261;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
Link="Common\Microsoft\Win32\TempRegistryKey.cs" />
<Compile Include="$(CommonPath)System\Text\ValueStringBuilder.cs"
Link="Common\System\Text\ValueStringBuilder.cs" />
<Compile Include="$(CommonTestPath)System\IO\PathFeatures.cs"
Link="Common\System\IO\PathFeatures.cs" />
<Compile Include="DelegateSynchronizeInvoke.cs" />
<Compile Include="FileAssociations.cs" />
<Compile Include="Helpers.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
<Compile Include="ZipArchive\zip_ReadTests.cs" />
<Compile Include="ZipArchive\zip_UpdateTests.cs" />
<Compile Include="ZipArchive\zip_UpdateTests.Comments.cs" />
<Compile Include="$(CommonTestPath)System\IO\PathFeatures.cs" Link="Common\System\IO\PathFeatures.cs" />
<Compile Include="$(CommonTestPath)System\IO\CallTrackingStream.cs" Link="Common\System\IO\CallTrackingStream.cs" />
<Compile Include="$(CommonTestPath)System\IO\Compression\CRC.cs" Link="Common\System\IO\Compression\CRC.cs" />
<Compile Include="$(CommonTestPath)System\IO\Compression\CompressionStreamTestBase.cs" Link="Common\System\IO\Compression\CompressionStreamTestBase.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ namespace System.IO.Compression.Tests
{
public class zip_ManualAndCompatibilityTests : ZipFileTestBase
{
public static bool IsUsingNewPathNormalization => !PathFeatures.IsUsingLegacyPathNormalization();

public static IEnumerable<object[]> Get_CompatibilityTests_Data()
{
foreach (bool async in _bools)
Expand Down Expand Up @@ -67,7 +65,7 @@ public static async Task CompatibilityTestsMsFiles(string withTrailing, string w
/// For example, the file "aa\bb\cc\dd" in a zip created on Unix should be one file "aa\bb\cc\dd" whereas the same file
/// in a zip created on Windows should be interpreted as the file "dd" underneath three subdirectories.
/// </summary>
[ConditionalTheory(nameof(IsUsingNewPathNormalization))]
[Theory]
[InlineData("backslashes_FromUnix.zip", "aa\\bb\\cc\\dd")]
[InlineData("backslashes_FromWindows.zip", "dd")]
[InlineData("WindowsInvalid_FromUnix.zip", "aa<b>d")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public void ValidPathWithTrailingSlash(string component)
Assert.True(result.Exists);
}

[ConditionalTheory(nameof(UsingNewNormalization)),
[Theory,
MemberData(nameof(ValidPathComponentNames))]
[PlatformSpecific(TestPlatforms.Windows)] // trailing slash
public void ValidExtendedPathWithTrailingSlash(string component)
Expand Down Expand Up @@ -239,7 +239,7 @@ public void PathsWithInvalidColons_ThrowIOException_Core(string invalidPath)
Assert.ThrowsAny<IOException>(() => Create(invalidPath));
}

[ConditionalFact(nameof(AreAllLongPathsAvailable))]
[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // long directory path succeeds
public void DirectoryLongerThanMaxPath_Succeeds()
{
Expand All @@ -262,7 +262,7 @@ public void DirectoryLongerThanMaxLongPath_ThrowsPathTooLongException()
});
}

[ConditionalFact(nameof(LongPathsAreNotBlocked), nameof(UsingNewNormalization))]
[Fact]
[PlatformSpecific(TestPlatforms.Windows)]
public void DirectoryLongerThanMaxLongPathWithExtendedSyntax_ThrowsException()
{
Expand All @@ -274,7 +274,7 @@ public void DirectoryLongerThanMaxLongPathWithExtendedSyntax_ThrowsException()
AssertExtensions.ThrowsAny<PathTooLongException, DirectoryNotFoundException, IOException>(() => Create(path)));
}

[ConditionalFact(nameof(LongPathsAreNotBlocked), nameof(UsingNewNormalization))]
[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // long directory path with extended syntax succeeds
public void ExtendedDirectoryLongerThanLegacyMaxPath_Succeeds()
{
Expand All @@ -285,7 +285,7 @@ public void ExtendedDirectoryLongerThanLegacyMaxPath_Succeeds()
});
}

[ConditionalFact(nameof(AreAllLongPathsAvailable))]
[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // long directory path succeeds
public void DirectoryLongerThanMaxDirectoryAsPath_Succeeds()
{
Expand Down Expand Up @@ -374,7 +374,7 @@ public void TrailingSpace_NotTrimmed(string component)
Assert.Equal(testDir.FullName, IOServices.RemoveTrailingSlash(result.FullName));
}

[ConditionalTheory(nameof(UsingNewNormalization)),
[Theory,
MemberData(nameof(SimpleWhiteSpace))]
[PlatformSpecific(TestPlatforms.Windows)] // extended syntax with whitespace
public void WindowsExtendedSyntaxWhiteSpace(string path)
Expand Down Expand Up @@ -423,7 +423,7 @@ public void PathWithReservedDeviceNameAsPath_ThrowsDirectoryNotFoundException(st
Assert.Throws<DirectoryNotFoundException>(() => Create(path));
}

[ConditionalTheory(nameof(ReservedDeviceNamesAreBlocked), nameof(UsingNewNormalization))] // device name prefixes
[ConditionalTheory(nameof(ReservedDeviceNamesAreBlocked))] // device name prefixes
[MemberData(nameof(ReservedDeviceNames))]
public void PathWithReservedDeviceNameAsExtendedPath(string path)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ public class Directory_Delete_str : FileSystemTest

static bool IsBindMountSupportedAndPrivilegedProcess => IsBindMountSupported && PlatformDetection.IsPrivilegedProcess;

static bool IsRemoteExecutorSupportedAndUsingNewNormalization => RemoteExecutor.IsSupported && UsingNewNormalization;

static bool IsRemoteExecutorSupportedAndLongPathsAreNotBlockedAndUsingNewNormalization => RemoteExecutor.IsSupported && LongPathsAreNotBlocked && UsingNewNormalization;

#region Utilities

protected virtual void Delete(string path)
Expand Down Expand Up @@ -126,7 +122,7 @@ public void DeletingSymLinkDoesntDeleteTarget()
Assert.False(Directory.Exists(linkPath), "linkPath should no longer exist");
}

[ConditionalFact(nameof(IsRemoteExecutorSupportedAndUsingNewNormalization))]
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void ExtendedDirectoryWithSubdirectories()
{
RemoteExecutor.Invoke(() =>
Expand All @@ -139,7 +135,7 @@ public void ExtendedDirectoryWithSubdirectories()
}).Dispose();
}

[ConditionalFact(nameof(IsRemoteExecutorSupportedAndLongPathsAreNotBlockedAndUsingNewNormalization))]
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void LongPathExtendedDirectory()
{
RemoteExecutor.Invoke(() =>
Expand All @@ -166,7 +162,7 @@ public void WindowsDeleteReadOnlyDirectory()
testDir.Attributes = FileAttributes.Normal;
}

[ConditionalFact(nameof(UsingNewNormalization))]
[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // Deleting extended readonly directory throws IOException
public void WindowsDeleteExtendedReadOnlyDirectory()
{
Expand Down Expand Up @@ -197,7 +193,7 @@ public void WindowsShouldBeAbleToDeleteHiddenDirectory()
Assert.False(testDir.Exists);
}

[ConditionalFact(nameof(UsingNewNormalization))]
[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // Deleting extended hidden directory succeeds
public void WindowsShouldBeAbleToDeleteExtendedHiddenDirectory()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public void SymlinkToNewDirectory()

#region PlatformSpecific

[ConditionalTheory(nameof(UsingNewNormalization)),
[Theory,
MemberData(nameof(ValidPathComponentNames))]
[PlatformSpecific(TestPlatforms.Windows)] // Extended path exists
public void ValidExtendedPathExists_ReturnsTrue(string component)
Expand All @@ -169,7 +169,7 @@ public void ValidExtendedPathExists_ReturnsTrue(string component)
Assert.True(Exists(path));
}

[ConditionalFact(nameof(UsingNewNormalization))]
[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // Extended path already exists as directory
public void ExtendedPathAlreadyExistsAsDirectory()
{
Expand All @@ -181,7 +181,7 @@ public void ExtendedPathAlreadyExistsAsDirectory()
Assert.True(Exists(IOServices.RemoveTrailingSlash(IOServices.AddTrailingSlashIfNeeded(path))));
}

[ConditionalFact(nameof(AreAllLongPathsAvailable))]
[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // Long directory path doesn't throw on Exists
public void DirectoryLongerThanMaxDirectoryAsPath_DoesntThrow()
{
Expand Down Expand Up @@ -219,7 +219,7 @@ public void DoesCaseSensitiveComparisons()
Assert.False(Exists(testDir.FullName.ToLowerInvariant()));
}

[ConditionalTheory(nameof(UsingNewNormalization)),
[Theory,
MemberData(nameof(SimpleWhiteSpace))]
[PlatformSpecific(TestPlatforms.Windows)] // In Windows, trailing whitespace in a path is trimmed appropriately
public void TrailingWhitespaceExistence_SimpleWhiteSpace(string component)
Expand Down Expand Up @@ -347,7 +347,7 @@ public void DriveAsPath()
Assert.Contains(IOServices.GetReadyDrives(), drive => Exists(drive));
}

[ConditionalFact(nameof(UsingNewNormalization))]
[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // drive labels
public void ExtendedDriveAsPath()
{
Expand Down Expand Up @@ -380,7 +380,7 @@ public void PathAlreadyExistsAsFile()
Assert.False(Directory.Exists(IOServices.RemoveTrailingSlash(IOServices.AddTrailingSlashIfNeeded(path))));
}

[ConditionalFact(nameof(UsingNewNormalization))]
[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // Extended path already exists as file
public void ExtendedPathAlreadyExistsAsFile()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ public void PatternTests_DosDot(string pattern, string[] sourceFiles, string[] e
}

// Can't do these without extended path support on Windows, UsingNewNormalization filters appropriately
[ConditionalTheory(nameof(UsingNewNormalization)),
[Theory,
// Periods are optional if left of * or ? and end of match
InlineData(
"foo.*",
Expand Down Expand Up @@ -357,7 +357,7 @@ public void PatternTests_DosStar(string pattern, string[] sourceFiles, string[]
}

// Can't do these without extended path support on Windows, UsingNewNormalization filters appropriately
[ConditionalTheory(nameof(UsingNewNormalization)),
[Theory,
InlineData(
"foo*.",
new string[] { @"foo", @"foo.", @"foo.t", @"foo.tx", @"foo.txt", @"bar.txt", @"foo..", @"foo...", @"foo .", @"foo. . .", @"foo. t" },
Expand Down Expand Up @@ -580,7 +580,7 @@ public void WindowsSearchPatternLongSegment()
GetEntries(testDir.FullName, longName);
}

[ConditionalFact(nameof(AreAllLongPathsAvailable))]
[Fact]
public void SearchPatternLongPath()
{
// Create a destination path longer than the traditional Windows limit of 256 characters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void EnumerateWithSymLinkToFile()
Assert.Equal(0, GetEntries(containingFolder.FullName).Count());
}

[ConditionalFact(nameof(AreAllLongPathsAvailable))]
[Fact]
public void EnumerateFilesOverLegacyMaxPath()
{
// We want to test that directories under the legacy MAX_PATH (260 characters, including the null) can iterate files
Expand All @@ -61,7 +61,7 @@ public void EnumerateFilesOverLegacyMaxPath()
Assert.Equal(6, files.Length);
}

[ConditionalFact(nameof(AreAllLongPathsAvailable))]
[Fact]
public void EnumerateFilesDirectoryOverLegacyMaxPath()
{
// Check enumerating when the entire path is over MAX_PATH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ public void MoveDirectory_FailToMoveLowerCaseDirectoryWhenUpperCaseDirectoryExis
Assert.Throws<IOException>(() => Move($"{TestDirectory}/foo", $"{TestDirectory}/bar/foo"));
}

[ConditionalFact(nameof(AreAllLongPathsAvailable))]
[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // Long path succeeds
public void Path_With_Longer_Than_MaxDirectory_Succeeds()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public void UnixNonSignificantTrailingWhiteSpace(string component)
Assert.NotEqual(testDir.FullName, IOServices.RemoveTrailingSlash(result.FullName));
}

[ConditionalFact(nameof(UsingNewNormalization))]
[Fact]
[PlatformSpecific(TestPlatforms.Windows)] // Extended windows path
public void ExtendedPathSubdirectory()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
<Compile Include="..\PortedCommon\IOServices.cs" />
<Compile Include="$(CommonPath)DisableRuntimeMarshalling.cs"
Link="Common\DisableRuntimeMarshalling.cs" />
<Compile Include="$(CommonTestPath)System\IO\PathFeatures.cs" Link="Common\System\IO\PathFeatures.cs" />
<Compile Include="$(CommonTestPath)Tests\TheoryDataExtensions.cs" Link="Common\Tests\TheoryDataExtensions.cs" />
<Compile Include="$(CommonTestPath)TestUtilities\System\DisableParallelization.cs" Link="Common\TestUtilities\System\DisableParallelization.cs" />
</ItemGroup>
Expand Down
Loading