Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Unity
提交
7a437665
T
Third Party Unity
项目概览
OpenHarmony
/
Third Party Unity
1 年多 前同步成功
通知
36
Star
144
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Unity
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7a437665
编写于
2月 22, 2018
作者:
F
Fabian Zahn
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
- Fixed whitespaces and formatting
- Added more expressiveness to the code - Fixed some of the rubocop hints
上级
ea51e2b3
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
19 addition
and
18 deletion
+19
-18
auto/parse_output.rb
auto/parse_output.rb
+19
-18
未找到文件。
auto/parse_output.rb
浏览文件 @
7a437665
#============================================================
#============================================================
# Author: John Theofanopoulos
# Author: John Theofanopoulos
# A simple parser.
Takes the output files generated during the build process and
# A simple parser.
Takes the output files generated during the
# extracts information relating to the tests.
#
build process and
extracts information relating to the tests.
#
#
# Notes:
# Notes:
# To capture an output file under VS builds use the following:
# To capture an output file under VS builds use the following:
# devenv [build instructions] > Output.txt & type Output.txt
# devenv [build instructions] > Output.txt & type Output.txt
#
#
# To capture an output file under
GCC/
Linux builds use the following:
# To capture an output file under Linux builds use the following:
# make | tee Output.txt
# make | tee Output.txt
#
#
# To use this parser use the following command
# To use this parser use the following command
# ruby parseOutput.rb [options] [file]
# ruby parseOutput.rb [options] [file]
# options: -xml : produce a JUnit compatible XML file
# options: -xml : produce a JUnit compatible XML file
# file
: file to scan for results
# file: file to scan for results
#============================================================
#============================================================
# Parser class for handling the input file
class
ParseOutput
class
ParseOutput
def
initialize
def
initialize
@xml_out
=
false
@xml_out
=
false
...
@@ -26,12 +27,12 @@ class ParseOutput
...
@@ -26,12 +27,12 @@ class ParseOutput
@path_delim
=
nil
@path_delim
=
nil
end
end
#
Set the flag to indicate if there will be an XML output file or not
# Set the flag to indicate if there will be an XML output file or not
def
set_xml_output
def
set_xml_output
@xml_out
=
true
@xml_out
=
true
end
end
#
If write our output to XML
# If write our output to XML
def
write_xml_output
def
write_xml_output
output
=
File
.
open
(
'report.xml'
,
'w'
)
output
=
File
.
open
(
'report.xml'
,
'w'
)
output
<<
"<?xml version=
\"
1.0
\"
encoding=
\"
UTF-8
\"
?>
\n
"
output
<<
"<?xml version=
\"
1.0
\"
encoding=
\"
UTF-8
\"
?>
\n
"
...
@@ -44,18 +45,17 @@ class ParseOutput
...
@@ -44,18 +45,17 @@ class ParseOutput
# This function will try and determine when the suite is changed. This is
# This function will try and determine when the suite is changed. This is
# is the name that gets added to the classname parameter.
# is the name that gets added to the classname parameter.
def
test_suite_verify
(
test_suite_name
)
def
test_suite_verify
(
test_suite_name
)
# Split the path name
# Split the path name
test_name
=
test_suite_name
.
split
(
@path_delim
)
test_name
=
test_suite_name
.
split
(
@path_delim
)
# Remove the extension and extract the base_name
# Remove the extension and extract the base_name
base_name
=
test_name
[
test_name
.
size
-
1
].
split
(
'.'
)[
0
]
base_name
=
test_name
[
test_name
.
size
-
1
].
split
(
'.'
)[
0
]
#
Is this a new test suite?
#
Return if the test suite hasn't changed
if
base_name
.
to_s
!=
@test_suite
.
to_s
return
unless
base_name
.
to_s
!=
@test_suite
.
to_s
@test_suite
=
base_name
printf
"New Test: %s
\n
"
,
@test_suit
e
@test_suite
=
base_nam
e
end
printf
"New Test: %s
\n
"
,
@test_suite
end
end
# Test was flagged as having passed so format the output
# Test was flagged as having passed so format the output
...
@@ -78,6 +78,7 @@ class ParseOutput
...
@@ -78,6 +78,7 @@ class ParseOutput
test_name
=
array
[
1
].
sub
(
')'
,
''
)
test_name
=
array
[
1
].
sub
(
')'
,
''
)
test_suite_verify
(
array
[
@class_name
])
test_suite_verify
(
array
[
@class_name
])
printf
"%-40s PASS
\n
"
,
test_name
printf
"%-40s PASS
\n
"
,
test_name
return
unless
@xml_out
return
unless
@xml_out
@array_list
.
push
' <testcase classname="'
+
test_suite
+
'" name="'
+
test_name
+
'"/>'
@array_list
.
push
' <testcase classname="'
+
test_suite
+
'" name="'
+
test_name
+
'"/>'
...
@@ -152,10 +153,10 @@ class ParseOutput
...
@@ -152,10 +153,10 @@ class ParseOutput
end
end
# Main function used to parse the file that was captured.
# Main function used to parse the file that was captured.
def
process
(
name
)
def
process
(
file_
name
)
@array_list
=
[]
@array_list
=
[]
puts
'Parsing file: '
+
name
puts
'Parsing file: '
+
file_
name
test_pass
=
0
test_pass
=
0
test_fail
=
0
test_fail
=
0
...
@@ -163,7 +164,7 @@ class ParseOutput
...
@@ -163,7 +164,7 @@ class ParseOutput
puts
''
puts
''
puts
'=================== RESULTS ====================='
puts
'=================== RESULTS ====================='
puts
''
puts
''
File
.
open
(
name
).
each
do
|
line
|
File
.
open
(
file_
name
).
each
do
|
line
|
# Typical test lines look like this:
# Typical test lines look like this:
# <path>/<test_file>.c:36:test_tc1000_opsys:FAIL: Expected 1 Was 0
# <path>/<test_file>.c:36:test_tc1000_opsys:FAIL: Expected 1 Was 0
# <path>/<test_file>.c:112:test_tc5004_initCanChannel:IGNORE: Not Yet Implemented
# <path>/<test_file>.c:112:test_tc5004_initCanChannel:IGNORE: Not Yet Implemented
...
@@ -219,11 +220,11 @@ end
...
@@ -219,11 +220,11 @@ end
parse_my_file
=
ParseOutput
.
new
parse_my_file
=
ParseOutput
.
new
if
ARGV
.
size
>=
1
if
ARGV
.
size
>=
1
ARGV
.
each
do
|
a
|
ARGV
.
each
do
|
a
rg
|
if
a
==
'-xml'
if
a
rg
==
'-xml'
parse_my_file
.
set_xml_output
parse_my_file
.
set_xml_output
else
else
parse_my_file
.
process
(
a
)
parse_my_file
.
process
(
a
rg
)
break
break
end
end
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录