Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
a3ed4aad
J
jenkins
项目概览
xxadev
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a3ed4aad
编写于
10月 01, 2019
作者:
M
Marat Radchenko
提交者:
Oleg Nenashev
10月 01, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix formatting of ProcessTreeKillerTest.java (#4235)
Trailing whitespace, wrong indentation
上级
1004d327
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
24 deletion
+25
-24
test/src/test/java/hudson/util/ProcessTreeKillerTest.java
test/src/test/java/hudson/util/ProcessTreeKillerTest.java
+25
-24
未找到文件。
test/src/test/java/hudson/util/ProcessTreeKillerTest.java
浏览文件 @
a3ed4aad
...
...
@@ -35,35 +35,35 @@ public class ProcessTreeKillerTest {
@Rule
public
JenkinsRule
j
=
new
JenkinsRule
();
private
Process
process
;
@After
public
void
tearDown
()
throws
Exception
{
ProcessTree
.
vetoersExist
=
null
;
if
(
null
!=
process
)
process
.
destroy
();
}
}
@Test
public
void
manualAbortProcess
()
throws
Exception
{
ProcessTree
.
enabled
=
true
;
FreeStyleProject
project
=
j
.
createFreeStyleProject
();
public
void
manualAbortProcess
()
throws
Exception
{
ProcessTree
.
enabled
=
true
;
FreeStyleProject
project
=
j
.
createFreeStyleProject
();
// this contains a maven project with a single test that sleeps 5s.
project
.
setScm
(
new
ExtractResourceSCM
(
getClass
().
getResource
(
"ProcessTreeKiller-test-project.jar"
)));
project
.
getBuildersList
().
add
(
new
Maven
(
"install"
,
"maven"
));
// this contains a maven project with a single test that sleeps 5s.
project
.
setScm
(
new
ExtractResourceSCM
(
getClass
().
getResource
(
"ProcessTreeKiller-test-project.jar"
)));
project
.
getBuildersList
().
add
(
new
Maven
(
"install"
,
"maven"
));
// build the project, wait until tests are running, then cancel.
project
.
scheduleBuild2
(
0
).
waitForStart
();
// build the project, wait until tests are running, then cancel.
project
.
scheduleBuild2
(
0
).
waitForStart
();
FreeStyleBuild
b
=
project
.
getLastBuild
();
b
.
doStop
();
Thread
.
sleep
(
1000
);
Thread
.
sleep
(
1000
);
// will fail (at least on windows) if test process is still running
b
.
getWorkspace
().
deleteRecursive
();
}
// will fail (at least on windows) if test process is still running
b
.
getWorkspace
().
deleteRecursive
();
}
@Test
public
void
killNullProcess
()
throws
Exception
{
...
...
@@ -106,6 +106,7 @@ public class ProcessTreeKillerTest {
assertTrue
(
"Process should be dead"
,
!
spawner
.
proc
.
isAlive
());
}
}
public
static
final
class
SpawnBuilder
extends
TestBuilder
{
private
Proc
proc
;
...
...
@@ -117,7 +118,7 @@ public class ProcessTreeKillerTest {
return
true
;
}
}
@Test
@Issue
(
"JENKINS-9104"
)
public
void
considersKillingVetos
()
throws
Exception
{
...
...
@@ -146,35 +147,35 @@ public class ProcessTreeKillerTest {
// Means the process is still running
}
}
@Test
@Issue
(
"JENKINS-9104"
)
public
void
considersKillingVetosOnSlave
()
throws
Exception
{
// on some platforms where we fail to list any processes, this test will
// just not work
assumeTrue
(
ProcessTree
.
get
()
!=
ProcessTree
.
DEFAULT
);
// Define a process we (shouldn't) kill
ProcessBuilder
pb
=
new
ProcessBuilder
();
pb
.
environment
().
put
(
"cookie"
,
"testKeepDaemonsAlive"
);
if
(
File
.
pathSeparatorChar
==
';'
)
{
pb
.
command
(
"cmd"
);
}
else
{
pb
.
command
(
"sleep"
,
"5m"
);
}
// Create an agent so we can tell it to kill the process
Slave
s
=
j
.
createSlave
();
s
.
toComputer
().
connect
(
false
).
get
();
// Start the process
process
=
pb
.
start
();
// Call killall (somewhat roundabout though) to (not) kill it
StringWriter
out
=
new
StringWriter
();
s
.
createLauncher
(
new
StreamTaskListener
(
out
)).
kill
(
ImmutableMap
.
of
(
"cookie"
,
"testKeepDaemonsAlive"
));
try
{
process
.
exitValue
();
fail
(
"Process should have been excluded from the killing"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录