Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
03f53b4c
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
03f53b4c
编写于
5月 22, 2017
作者:
J
Jared Parsons
提交者:
Jared Parsons
5月 22, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Respond to PR feedback
上级
0e147358
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
44 addition
and
45 deletion
+44
-45
build/scripts/cibuild.ps1
build/scripts/cibuild.ps1
+7
-0
src/Tools/Source/RunTests/Cache/CachingTestExecutor.cs
src/Tools/Source/RunTests/Cache/CachingTestExecutor.cs
+1
-1
src/Tools/Source/RunTests/Cache/LocalDataStorage.cs
src/Tools/Source/RunTests/Cache/LocalDataStorage.cs
+3
-3
src/Tools/Source/RunTests/Logger.cs
src/Tools/Source/RunTests/Logger.cs
+19
-0
src/Tools/Source/RunTests/ProcessRunner.cs
src/Tools/Source/RunTests/ProcessRunner.cs
+1
-1
src/Tools/Source/RunTests/ProcessUtil.cs
src/Tools/Source/RunTests/ProcessUtil.cs
+0
-20
src/Tools/Source/RunTests/Program.cs
src/Tools/Source/RunTests/Program.cs
+13
-20
未找到文件。
build/scripts/cibuild.ps1
浏览文件 @
03f53b4c
...
...
@@ -55,6 +55,13 @@ function Terminate-BuildProcesses() {
# Ensure that procdump is available on the machine. Returns the path to the directory that contains
# the procdump binaries (both 32 and 64 bit)
function
Ensure-ProcDump
()
{
# Jenkins images default to having procdump installed in the root. Use that if available to avoid
# an unnecessary download.
if
(
Test-Path
"c:\SysInternals\procdump.exe"
)
{
return
"c:\SysInternals"
;
}
$toolsDir
=
Join-Path
$binariesDir
"Tools"
$outDir
=
Join-Path
$toolsDir
"ProcDump"
$filePath
=
Join-Path
$outDir
"procdump.exe"
...
...
src/Tools/Source/RunTests/Cache/CachingTestExecutor.cs
浏览文件 @
03f53b4c
...
...
@@ -124,7 +124,7 @@ private async Task CacheTestResult(ContentFile contentFile, TestResult testResul
}
catch
(
Exception
ex
)
{
Logger
.
Log
(
$"Failed to create cached
{
ex
}
"
);
Logger
.
Log
(
"Failed to create cached"
,
ex
);
}
}
}
...
...
src/Tools/Source/RunTests/Cache/LocalDataStorage.cs
浏览文件 @
03f53b4c
...
...
@@ -80,7 +80,7 @@ public bool TryGetCachedTestResult(string checksum, out CachedTestResult testRes
catch
(
Exception
e
)
{
// Okay for exception to occur here on I/O
Logger
.
Log
(
$"Failed to read cache
{
checksum
}
{
e
.
Message
}
"
);
Logger
.
Log
(
$"Failed to read cache
{
checksum
}
"
,
e
);
}
return
false
;
...
...
@@ -107,7 +107,7 @@ public Task AddCachedTestResult(AssemblyInfo assemblyInfo, ContentFile contentFi
catch
(
Exception
e
)
{
// I/O errors are expected and okay here.
Logger
.
Log
(
$"Failed to log
{
checksum
}
{
e
.
Message
}
"
);
Logger
.
Log
(
$"Failed to log
{
checksum
}
"
,
e
);
FileUtil
.
DeleteDirectory
(
storagePath
);
}
...
...
@@ -159,7 +159,7 @@ private void CleanupStorage()
}
catch
(
Exception
ex
)
{
Logger
.
Log
(
$"Unable to cleanup storage
{
ex
.
Message
}
"
);
Logger
.
Log
(
"Unable to cleanup storage"
,
ex
);
}
}
}
...
...
src/Tools/Source/RunTests/Logger.cs
浏览文件 @
03f53b4c
...
...
@@ -26,6 +26,25 @@ internal static void LogError(Exception ex, string line)
}
}
internal
static
void
Log
(
string
message
,
Exception
ex
)
{
lock
(
s_lines
)
{
s_lines
.
Add
(
message
);
s_lines
.
Add
(
ex
.
Message
);
s_lines
.
Add
(
ex
.
StackTrace
);
}
}
internal
static
void
Log
(
Exception
ex
)
{
lock
(
s_lines
)
{
s_lines
.
Add
(
ex
.
Message
);
s_lines
.
Add
(
ex
.
StackTrace
);
}
}
internal
static
void
Log
(
string
line
)
{
lock
(
s_lines
)
...
...
src/Tools/Source/RunTests/ProcessRunner.cs
浏览文件 @
03f53b4c
...
...
@@ -36,8 +36,8 @@ public static void OpenFile(string file)
public
static
Task
<
ProcessOutput
>
RunProcessAsync
(
string
executable
,
string
arguments
,
bool
lowPriority
,
CancellationToken
cancellationToken
,
bool
lowPriority
=
false
,
string
workingDirectory
=
null
,
bool
captureOutput
=
false
,
bool
displayWindow
=
true
,
...
...
src/Tools/Source/RunTests/ProcessUtil.cs
浏览文件 @
03f53b4c
...
...
@@ -78,25 +78,5 @@ internal static List<Process> GetProcessTree(Process process)
return
list
;
}
internal
static
bool
Is64Bit
(
Process
process
)
{
if
(
Environment
.
GetEnvironmentVariable
(
"PROCESSOR_ARCHITECTURE"
)
==
"x86"
)
{
return
false
;
}
bool
isWow64
;
if
(!
IsWow64Process
(
process
.
Handle
,
out
isWow64
))
{
throw
new
Exception
(
$"
{
nameof
(
IsWow64Process
)}
failed with
{
Marshal
.
GetLastWin32Error
()}
"
);
}
return
!
isWow64
;
}
[
DllImport
(
"kernel32.dll"
,
SetLastError
=
true
,
CallingConvention
=
CallingConvention
.
Winapi
)]
[
return
:
MarshalAs
(
UnmanagedType
.
Bool
)]
private
static
extern
bool
IsWow64Process
([
In
]
IntPtr
process
,
[
Out
]
out
bool
wow64Process
);
}
}
src/Tools/Source/RunTests/Program.cs
浏览文件 @
03f53b4c
...
...
@@ -64,7 +64,7 @@ private static async Task<int> Run(Options options, CancellationToken cancellati
var
finishedTask
=
await
Task
.
WhenAny
(
timeoutTask
,
runTask
);
if
(
finishedTask
==
timeoutTask
)
{
HandleTimeout
(
options
);
await
HandleTimeout
(
options
,
cancellationToken
);
cts
.
Cancel
();
try
...
...
@@ -150,26 +150,18 @@ private static void WriteLogFile(Options options)
/// Invoked when a timeout occurs and we need to dump all of the test processes and shut down
/// the runnner.
/// </summary>
private
static
void
HandleTimeout
(
Options
options
)
private
static
async
Task
HandleTimeout
(
Options
options
,
CancellationToken
cancellationToken
)
{
string
GetProcDumpFilePath
(
Process
proc
)
=>
ProcessUtil
.
Is64Bit
(
proc
)
?
Path
.
Combine
(
options
.
ProcDumpPath
,
"procdump64.exe"
)
:
Path
.
Combine
(
options
.
ProcDumpPath
,
"procdump.exe"
);
var
procDumpFilePath
=
Path
.
Combine
(
options
.
ProcDumpPath
,
"procdump.exe"
);
void
DumpProcess
(
Process
targetProcess
,
string
dumpFilePath
)
async
Task
DumpProcess
(
Process
targetProcess
,
string
dumpFilePath
)
{
Console
.
Write
(
$"Dumping
{
targetProcess
.
ProcessName
}
{
targetProcess
.
Id
}
to
{
dumpFilePath
}
... "
);
try
{
var
processStartInfo
=
new
ProcessStartInfo
();
processStartInfo
.
FileName
=
GetProcDumpFilePath
(
targetProcess
);
processStartInfo
.
Arguments
=
$"-accepteula -ma
{
targetProcess
.
Id
}
{
dumpFilePath
}
"
;
processStartInfo
.
CreateNoWindow
=
true
;
processStartInfo
.
UseShellExecute
=
false
;
processStartInfo
.
WindowStyle
=
ProcessWindowStyle
.
Hidden
;
processStartInfo
.
RedirectStandardOutput
=
true
;
var
process
=
Process
.
Start
(
processStartInfo
);
process
.
WaitForExit
();
var
args
=
$"-accepteula -ma
{
targetProcess
.
Id
}
{
dumpFilePath
}
"
;
var
processTask
=
ProcessRunner
.
RunProcessAsync
(
procDumpFilePath
,
args
,
cancellationToken
);
var
processOutput
=
await
processTask
;
// The exit code for procdump doesn't obey standard windows rules. It will return non-zero
// for succesful cases (possibly returning the count of dumps that were written). Best
...
...
@@ -180,15 +172,16 @@ void DumpProcess(Process targetProcess, string dumpFilePath)
}
else
{
Console
.
WriteLine
(
$"FAILED with
{
process
.
ExitCode
}
"
);
Console
.
WriteLine
(
$"
{
proc
essStartInfo
.
FileName
}
{
processStartInfo
.
Argument
s
}
"
);
Console
.
WriteLine
(
process
.
StandardOutput
.
ReadToEnd
(
));
Console
.
WriteLine
(
$"FAILED with
{
process
Output
.
ExitCode
}
"
);
Console
.
WriteLine
(
$"
{
proc
DumpFilePath
}
{
arg
s
}
"
);
Console
.
WriteLine
(
string
.
Join
(
Environment
.
NewLine
,
processOutput
.
OutputLines
));
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
when
(!
cancellationToken
.
IsCancellationRequested
)
{
Console
.
WriteLine
(
"FAILED"
);
Console
.
WriteLine
(
ex
.
Message
);
Logger
.
Log
(
"Failed to dump process"
,
ex
);
}
}
...
...
@@ -204,7 +197,7 @@ void DumpProcess(Process targetProcess, string dumpFilePath)
foreach
(
var
proc
in
ProcessUtil
.
GetProcessTree
(
Process
.
GetCurrentProcess
()).
OrderBy
(
x
=>
x
.
ProcessName
))
{
var
dumpFilePath
=
Path
.
Combine
(
dumpDir
,
$"
{
proc
.
ProcessName
}
-
{
counter
}
.dmp"
);
DumpProcess
(
proc
,
dumpFilePath
);
await
DumpProcess
(
proc
,
dumpFilePath
);
counter
++;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录