Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
4756d8d9
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4756d8d9
编写于
10月 06, 2017
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
smoke: log main and renderer processes
上级
3a399200
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
63 addition
and
21 deletion
+63
-21
build/tfs/darwin/build.sh
build/tfs/darwin/build.sh
+1
-1
build/tfs/linux/build.sh
build/tfs/linux/build.sh
+1
-1
build/tfs/win32/1_build.ps1
build/tfs/win32/1_build.ps1
+1
-1
build/tfs/win32/build_unsigned.ps1
build/tfs/win32/build_unsigned.ps1
+1
-1
test/smoke/src/main.ts
test/smoke/src/main.ts
+2
-2
test/smoke/src/spectron/application.ts
test/smoke/src/spectron/application.ts
+57
-15
未找到文件。
build/tfs/darwin/build.sh
浏览文件 @
4756d8d9
...
...
@@ -41,7 +41,7 @@ function smoketest {
ARTIFACTS
=
"
$AGENT_BUILDDIRECTORY
/smoketest-artifacts"
rm
-rf
$ARTIFACTS
npm run smoketest
--
--build
"
$AGENT_BUILDDIRECTORY
/VSCode-darwin/Visual Studio Code - Insiders.app"
--
debu
g
$ARTIFACTS
npm run smoketest
--
--build
"
$AGENT_BUILDDIRECTORY
/VSCode-darwin/Visual Studio Code - Insiders.app"
--
lo
g
$ARTIFACTS
}
step
"Run smoke test"
\
...
...
build/tfs/linux/build.sh
浏览文件 @
4756d8d9
...
...
@@ -49,7 +49,7 @@ function smoketest {
chown
-R
testuser
$ARTIFACTS
ps
-o
pid
=
-u
testuser | xargs
sudo kill
-9
DISPLAY
=
:10
sudo
-i
-u
testuser
--
sh
-c
"cd
$BUILD_SOURCESDIRECTORY
/test/smoke && ./node_modules/.bin/mocha --build
$AGENT_BUILDDIRECTORY
/VSCode-linux-
$ARCH
--
debu
g
$ARTIFACTS
"
DISPLAY
=
:10
sudo
-i
-u
testuser
--
sh
-c
"cd
$BUILD_SOURCESDIRECTORY
/test/smoke && ./node_modules/.bin/mocha --build
$AGENT_BUILDDIRECTORY
/VSCode-linux-
$ARCH
--
lo
g
$ARTIFACTS
"
# DISPLAY=:10 sudo -i -u testuser -- sh -c "cd /vso/work/1/s/test/smoke && ./node_modules/.bin/mocha --build /vso/work/1/VSCode-linux-ia32"
}
...
...
build/tfs/win32/1_build.ps1
浏览文件 @
4756d8d9
...
...
@@ -56,7 +56,7 @@ step "Run smoke test" {
$Artifacts
=
"
$
env
:
AGENT_BUILDDIRECTORY
\smoketest-artifacts"
Remove-Item
-Recurse
-Force
-ErrorAction
Ignore
$Artifacts
exec
{
&
npm
run
smoketest
--
--build
"
$
env
:
AGENT_BUILDDIRECTORY
\VSCode-win32-
$
global
:
arch
"
--
debu
g
"
$Artifacts
"
}
exec
{
&
npm
run
smoketest
--
--build
"
$
env
:
AGENT_BUILDDIRECTORY
\VSCode-win32-
$
global
:
arch
"
--
lo
g
"
$Artifacts
"
}
}
done
build/tfs/win32/build_unsigned.ps1
浏览文件 @
4756d8d9
...
...
@@ -51,7 +51,7 @@ step "Run smoke test" {
$Artifacts
=
"
$
env
:
AGENT_BUILDDIRECTORY
\smoketest-artifacts"
Remove-Item
-Recurse
-Force
-ErrorAction
Ignore
$Artifacts
exec
{
&
npm
run
smoketest
--
--build
"
$
env
:
AGENT_BUILDDIRECTORY
\VSCode-win32-
$
global
:
arch
"
--
debu
g
"
$Artifacts
"
}
exec
{
&
npm
run
smoketest
--
--build
"
$
env
:
AGENT_BUILDDIRECTORY
\VSCode-win32-
$
global
:
arch
"
--
lo
g
"
$Artifacts
"
}
}
step
"Create archive and setup package"
{
...
...
test/smoke/src/main.ts
浏览文件 @
4756d8d9
...
...
@@ -21,12 +21,12 @@ const opts = minimist(args, {
string
:
[
'
build
'
,
'
stable-build
'
,
'
debu
g
'
,
'
lo
g
'
,
'
wait-time
'
]
});
process
.
env
.
ARTIFACTS_DIR
=
opts
.
debu
g
||
''
;
process
.
env
.
ARTIFACTS_DIR
=
opts
.
lo
g
||
''
;
const
workspacePath
=
path
.
join
(
testDataPath
,
'
smoketest.code-workspace
'
);
const
testRepoUrl
=
'
https://github.com/Microsoft/vscode-smoketest-express
'
;
...
...
test/smoke/src/spectron/application.ts
浏览文件 @
4756d8d9
...
...
@@ -54,12 +54,15 @@ export class SpectronApplication {
private
_workbench
:
Workbench
;
private
_screenCapturer
:
ScreenCapturer
;
private
spectron
:
Application
;
private
keybindings
:
any
[];
private
keybindings
:
any
[];
private
stopLogCollection
:
(()
=>
Promise
<
void
>
)
|
undefined
;
constructor
(
private
_electronPath
:
string
=
LATEST_PATH
,
private
_workspace
:
string
=
WORKSPACE_PATH
,
private
_userDir
:
string
=
USER_DIR
)
{
}
constructor
(
private
_electronPath
:
string
=
LATEST_PATH
,
private
_workspace
:
string
=
WORKSPACE_PATH
,
private
_userDir
:
string
=
USER_DIR
)
{
}
public
get
build
():
VSCODE_BUILD
{
get
build
():
VSCODE_BUILD
{
switch
(
VSCODE_EDITION
)
{
case
'
dev
'
:
return
VSCODE_BUILD
.
DEV
;
...
...
@@ -69,27 +72,27 @@ export class SpectronApplication {
return
VSCODE_BUILD
.
STABLE
;
}
public
get
app
():
Application
{
get
app
():
Application
{
return
this
.
spectron
;
}
public
get
client
():
SpectronClient
{
get
client
():
SpectronClient
{
return
this
.
_client
;
}
public
get
webclient
():
WebClient
{
get
webclient
():
WebClient
{
return
this
.
spectron
.
client
;
}
public
get
screenCapturer
():
ScreenCapturer
{
get
screenCapturer
():
ScreenCapturer
{
return
this
.
_screenCapturer
;
}
public
get
workbench
():
Workbench
{
get
workbench
():
Workbench
{
return
this
.
_workbench
;
}
public
async
start
(
testSuiteName
:
string
,
codeArgs
:
string
[]
=
[],
env
=
process
.
env
):
Promise
<
any
>
{
async
start
(
testSuiteName
:
string
,
codeArgs
:
string
[]
=
[],
env
=
process
.
env
):
Promise
<
any
>
{
await
this
.
retrieveKeybindings
();
cp
.
execSync
(
'
git checkout .
'
,
{
cwd
:
WORKSPACE_PATH
});
await
this
.
startApplication
(
testSuiteName
,
codeArgs
,
env
);
...
...
@@ -98,17 +101,22 @@ export class SpectronApplication {
await
this
.
screenCapturer
.
capture
(
'
Application started
'
);
}
public
async
reload
():
Promise
<
any
>
{
async
reload
():
Promise
<
any
>
{
await
this
.
workbench
.
quickopen
.
runCommand
(
'
Reload Window
'
);
// TODO @sandy: Find a proper condition to wait for reload
await
new
Promise
(
c
=>
setTimeout
(
c
,
500
));
await
this
.
checkWindowReady
();
}
public
async
stop
():
Promise
<
any
>
{
async
stop
():
Promise
<
any
>
{
if
(
this
.
stopLogCollection
)
{
await
this
.
stopLogCollection
();
this
.
stopLogCollection
=
undefined
;
}
if
(
this
.
spectron
&&
this
.
spectron
.
isRunning
())
{
await
this
.
screenCapturer
.
capture
(
'
Stopping application
'
);
return
await
this
.
spectron
.
stop
();
await
this
.
spectron
.
stop
();
}
}
...
...
@@ -158,10 +166,11 @@ export class SpectronApplication {
requireName
:
'
nodeRequire
'
};
let
testsuiteRootPath
:
string
|
undefined
=
undefined
;
let
screenshotsDirPath
:
string
|
undefined
=
undefined
;
if
(
ARTIFACTS_DIR
)
{
const
testsuiteRootPath
=
path
.
join
(
ARTIFACTS_DIR
,
sanitize
(
testSuiteName
));
testsuiteRootPath
=
path
.
join
(
ARTIFACTS_DIR
,
sanitize
(
testSuiteName
));
mkdirp
.
sync
(
testsuiteRootPath
);
// Collect screenshots
...
...
@@ -181,6 +190,39 @@ export class SpectronApplication {
this
.
spectron
=
new
Application
(
opts
);
await
this
.
spectron
.
start
();
if
(
testsuiteRootPath
)
{
// Collect logs
const
mainProcessLogPath
=
path
.
join
(
testsuiteRootPath
,
'
main.log
'
);
const
rendererProcessLogPath
=
path
.
join
(
testsuiteRootPath
,
'
renderer.log
'
);
const
flush
=
async
()
=>
{
const
mainLogs
=
await
this
.
spectron
.
client
.
getMainProcessLogs
();
await
new
Promise
((
c
,
e
)
=>
fs
.
appendFile
(
mainProcessLogPath
,
mainLogs
.
join
(
'
\n
'
),
{
encoding
:
'
utf8
'
},
err
=>
err
?
e
(
err
)
:
c
()));
const
rendererLogs
=
(
await
this
.
spectron
.
client
.
getRenderProcessLogs
()).
map
(
m
=>
`
${
m
.
timestamp
}
-
${
m
.
level
}
-
${
m
.
message
}
`
);
await
new
Promise
((
c
,
e
)
=>
fs
.
appendFile
(
rendererProcessLogPath
,
rendererLogs
.
join
(
'
\n
'
),
{
encoding
:
'
utf8
'
},
err
=>
err
?
e
(
err
)
:
c
()));
};
let
running
=
true
;
const
loopFlush
=
async
()
=>
{
while
(
true
)
{
await
flush
();
if
(
!
running
)
{
return
;
}
await
new
Promise
(
c
=>
setTimeout
(
c
,
1000
));
}
};
const
loopPromise
=
loopFlush
();
this
.
stopLogCollection
=
()
=>
{
running
=
false
;
return
loopPromise
;
};
}
this
.
_screenCapturer
=
new
ScreenCapturer
(
this
.
spectron
,
screenshotsDirPath
);
this
.
_client
=
new
SpectronClient
(
this
.
spectron
,
this
);
this
.
_workbench
=
new
Workbench
(
this
);
...
...
@@ -220,7 +262,7 @@ export class SpectronApplication {
* Retrieves the command from keybindings file and executes it with WebdriverIO client API
* @param command command (e.g. 'workbench.action.files.newUntitledFile')
*/
public
command
(
command
:
string
,
capture
?:
boolean
):
Promise
<
any
>
{
command
(
command
:
string
,
capture
?:
boolean
):
Promise
<
any
>
{
const
binding
=
this
.
keybindings
.
find
(
x
=>
x
[
'
command
'
]
===
command
);
if
(
!
binding
)
{
return
this
.
workbench
.
quickopen
.
runCommand
(
command
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录