Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
runtime
提交
8b391f60
R
runtime
项目概览
dotNET Platform
/
runtime
11 个月 前同步成功
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
runtime
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
8b391f60
编写于
2月 23, 2021
作者:
A
Adam Sitnik
提交者:
GitHub
2月 23, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
implement test for Long Paths support in ProcessModule.FileName (#46685)
上级
a78e7e46
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
59 addition
and
0 deletion
+59
-0
src/libraries/System.Diagnostics.Process/System.Diagnostics.Process.sln
...System.Diagnostics.Process/System.Diagnostics.Process.sln
+7
-0
src/libraries/System.Diagnostics.Process/tests/LongPath/ClassDefinedInAssemblyWithAVeryLongPath.cs
...tests/LongPath/ClassDefinedInAssemblyWithAVeryLongPath.cs
+11
-0
src/libraries/System.Diagnostics.Process/tests/LongPath/LongPath.csproj
...System.Diagnostics.Process/tests/LongPath/LongPath.csproj
+8
-0
src/libraries/System.Diagnostics.Process/tests/ProcessModuleTests.cs
...es/System.Diagnostics.Process/tests/ProcessModuleTests.cs
+30
-0
src/libraries/System.Diagnostics.Process/tests/System.Diagnostics.Process.Tests.csproj
...ics.Process/tests/System.Diagnostics.Process.Tests.csproj
+3
-0
未找到文件。
src/libraries/System.Diagnostics.Process/System.Diagnostics.Process.sln
浏览文件 @
8b391f60
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestUtilities", "..\Common\tests\TestUtilities\TestUtilities.csproj", "{3742D5F8-5C86-49FD-BAEA-050742CCEB7A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LongPath", "tests\LongPath\LongPath.csproj", "{C67553AE-F09B-407D-AD3E-D61950E06BE8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Win32.Registry", "..\Microsoft.Win32.Registry\ref\Microsoft.Win32.Registry.csproj", "{AA583AE2-BE26-4AA4-845F-916133916B7D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Win32.Registry", "..\Microsoft.Win32.Registry\src\Microsoft.Win32.Registry.csproj", "{E5AE4EB3-DB23-4F33-858B-63B68A60F7F1}"
...
...
@@ -50,6 +52,7 @@ EndProject
Global
GlobalSection(NestedProjects) = preSolution
{3742D5F8-5C86-49FD-BAEA-050742CCEB7A} = {05C87914-711A-4589-9672-8169DB6A6BA4}
{C67553AE-F09B-407D-AD3E-D61950E06BE8} = {05C87914-711A-4589-9672-8169DB6A6BA4}
{ABA61FEF-EB06-441D-9D3D-F25FFC7CD83D} = {05C87914-711A-4589-9672-8169DB6A6BA4}
{AA583AE2-BE26-4AA4-845F-916133916B7D} = {9ABDFB23-5430-4410-81C3-3C0327996580}
{4792FFA1-1AD2-4230-8DE3-D2BCF1CF804F} = {9ABDFB23-5430-4410-81C3-3C0327996580}
...
...
@@ -160,6 +163,10 @@ Global
{9C521ED1-5221-4C93-BBA0-86C13D4C23C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C521ED1-5221-4C93-BBA0-86C13D4C23C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C521ED1-5221-4C93-BBA0-86C13D4C23C7}.Release|Any CPU.Build.0 = Release|Any CPU
{C67553AE-F09B-407D-AD3E-D61950E06BE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C67553AE-F09B-407D-AD3E-D61950E06BE8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C67553AE-F09B-407D-AD3E-D61950E06BE8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C67553AE-F09B-407D-AD3E-D61950E06BE8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
...
...
src/libraries/System.Diagnostics.Process/tests/LongPath/ClassDefinedInAssemblyWithAVeryLongPath.cs
0 → 100644
浏览文件 @
8b391f60
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
namespace
System
{
// this type is not used anywhere, but it exists so the containing `.dll` is not empty and
// can be copied to the output folder and be dynamically loaded during test execution
public
class
ClassDefinedInAssemblyWithAVeryLongPath
{
}
}
src/libraries/System.Diagnostics.Process/tests/LongPath/LongPath.csproj
0 → 100644
浏览文件 @
8b391f60
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent)</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<Compile Include="ClassDefinedInAssemblyWithAVeryLongPath.cs" />
</ItemGroup>
</Project>
src/libraries/System.Diagnostics.Process/tests/ProcessModuleTests.cs
浏览文件 @
8b391f60
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using
System.IO
;
using
System.Linq
;
using
System.Reflection
;
using
Microsoft.DotNet.RemoteExecutor
;
using
Xunit
;
...
...
@@ -89,5 +91,33 @@ public void ModulesAreDisposedWhenProcessIsDisposed()
process
.
Dispose
();
Assert
.
Equal
(
expectedCount
,
disposedCount
);
}
[
ActiveIssue
(
"https://github.com/dotnet/runtime/pull/335059"
)]
[
ConditionalFact
(
typeof
(
PathFeatures
),
nameof
(
PathFeatures
.
AreAllLongPathsAvailable
))]
[
PlatformSpecific
(
TestPlatforms
.
Windows
)]
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.
// 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"
;
string
testBinPath
=
Path
.
GetDirectoryName
(
typeof
(
ProcessModuleTests
).
Assembly
.
Location
);
string
libraryToCopy
=
Path
.
Combine
(
testBinPath
,
libraryName
);
Assert
.
True
(
File
.
Exists
(
libraryToCopy
),
$"
{
libraryName
}
was not present in bin folder '
{
testBinPath
}
'"
);
string
directoryWithLongName
=
Path
.
Combine
(
TestDirectory
,
new
string
(
'a'
,
Math
.
Max
(
1
,
261
-
TestDirectory
.
Length
)));
Directory
.
CreateDirectory
(
directoryWithLongName
);
string
longNamePath
=
Path
.
Combine
(
directoryWithLongName
,
libraryName
);
Assert
.
True
(
longNamePath
.
Length
>
260
);
File
.
Copy
(
libraryToCopy
,
longNamePath
);
Assembly
loaded
=
Assembly
.
LoadFile
(
longNamePath
);
Assert
.
Contains
(
Process
.
GetCurrentProcess
().
Modules
.
Cast
<
ProcessModule
>(),
module
=>
module
.
FileName
==
longNamePath
);
}
}
}
src/libraries/System.Diagnostics.Process/tests/System.Diagnostics.Process.Tests.csproj
浏览文件 @
8b391f60
...
...
@@ -17,6 +17,8 @@
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" />
...
...
@@ -50,5 +52,6 @@
<ItemGroup>
<ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Win32.Registry\src\Microsoft.Win32.Registry.csproj" />
<ProjectReference Include="$(LibrariesProjectRoot)System.DirectoryServices\src\System.DirectoryServices.csproj" />
<ProjectReference Include="LongPath\LongPath.csproj" />
</ItemGroup>
</Project>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录