Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
48492a1f
A
avocado
项目概览
openeuler
/
avocado
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
avocado
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
48492a1f
编写于
4月 19, 2018
作者:
A
Amador Pahim
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'clebergnu-python3_enable_functional_v3'
Signed-off-by:
N
Amador Pahim
<
apahim@redhat.com
>
上级
e5d5064a
0c9da234
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
27 addition
and
18 deletion
+27
-18
optional_plugins/varianter_yaml_to_mux/tests/test_multiplex.py
...nal_plugins/varianter_yaml_to_mux/tests/test_multiplex.py
+5
-0
selftests/checkall
selftests/checkall
+4
-9
selftests/functional/test_basic.py
selftests/functional/test_basic.py
+2
-0
selftests/functional/test_loader.py
selftests/functional/test_loader.py
+5
-0
selftests/functional/test_output.py
selftests/functional/test_output.py
+6
-1
selftests/functional/test_output_check.py
selftests/functional/test_output_check.py
+4
-1
selftests/run
selftests/run
+1
-7
未找到文件。
optional_plugins/varianter_yaml_to_mux/tests/test_multiplex.py
浏览文件 @
48492a1f
...
@@ -2,6 +2,7 @@ import os
...
@@ -2,6 +2,7 @@ import os
import
tempfile
import
tempfile
import
shutil
import
shutil
import
unittest
import
unittest
import
sys
from
avocado.core
import
exit_codes
from
avocado.core
import
exit_codes
from
avocado.utils
import
process
from
avocado.utils
import
process
...
@@ -54,6 +55,8 @@ class MultiplexTests(unittest.TestCase):
...
@@ -54,6 +55,8 @@ class MultiplexTests(unittest.TestCase):
result
=
self
.
run_and_check
(
cmd_line
,
expected_rc
)
result
=
self
.
run_and_check
(
cmd_line
,
expected_rc
)
self
.
assertIn
(
'No such file or directory'
,
result
.
stderr_text
)
self
.
assertIn
(
'No such file or directory'
,
result
.
stderr_text
)
@
unittest
.
skipIf
(
sys
.
version_info
[
0
]
==
3
,
"Test currently broken on Python 3"
)
def
test_mplex_debug
(
self
):
def
test_mplex_debug
(
self
):
cmd_line
=
(
'%s variants -c -d -m '
cmd_line
=
(
'%s variants -c -d -m '
'/:optional_plugins/varianter_yaml_to_mux/tests/.data/mux-selftest.yaml '
'/:optional_plugins/varianter_yaml_to_mux/tests/.data/mux-selftest.yaml '
...
@@ -139,6 +142,8 @@ class MultiplexTests(unittest.TestCase):
...
@@ -139,6 +142,8 @@ class MultiplexTests(unittest.TestCase):
"passtest.py"
%
(
AVOCADO
,
self
.
tmpdir
))
"passtest.py"
%
(
AVOCADO
,
self
.
tmpdir
))
self
.
run_and_check
(
cmd_line
,
exit_codes
.
AVOCADO_ALL_OK
,
(
1
,
0
))
self
.
run_and_check
(
cmd_line
,
exit_codes
.
AVOCADO_ALL_OK
,
(
1
,
0
))
@
unittest
.
skipIf
(
sys
.
version_info
[
0
]
==
3
,
"Test currently broken on Python 3"
)
def
test_run_mplex_params
(
self
):
def
test_run_mplex_params
(
self
):
for
variant_msg
in
((
'/run/short'
,
'A'
),
for
variant_msg
in
((
'/run/short'
,
'A'
),
(
'/run/medium'
,
'ASDFASDF'
),
(
'/run/medium'
,
'ASDFASDF'
),
...
...
selftests/checkall
浏览文件 @
48492a1f
...
@@ -24,19 +24,14 @@ parallel_selftests() {
...
@@ -24,19 +24,14 @@ parallel_selftests() {
local
ERR
=
0
local
ERR
=
0
local
FIND_UNITTESTS
=
$(
readlink
-f
./contrib/scripts/avocado-find-unittests
)
local
FIND_UNITTESTS
=
$(
readlink
-f
./contrib/scripts/avocado-find-unittests
)
local
NO_WORKERS
=
$((
$(
cat
/proc/cpuinfo |
grep
-c
processor
)
*
2
))
local
NO_WORKERS
=
$((
$(
cat
/proc/cpuinfo |
grep
-c
processor
)
*
2
))
local
PY3
=
$(
python
--version
2>&1 |
grep
-q
"
$Python
3
\.
"
)
$?
# The directories that may contain files with tests, from the Avocado core
# The directories that may contain files with tests, from the Avocado core
# and from all optional plugins
# and from all optional plugins
declare
-A
DIR_GLOB_MAP
declare
-A
DIR_GLOB_MAP
if
[
$PY3
-eq
1
]
;
then
DIR_GLOB_MAP[selftests]
=
"selftests/unit/test_*.py selftests/functional/test_*.py selftests/doc/test_*.py"
DIR_GLOB_MAP[selftests]
=
"selftests/unit/test_*.py selftests/functional/test_*.py selftests/doc/test_*.py"
for
PLUGIN
in
$(
find optional_plugins
-mindepth
1
-maxdepth
1
-type
d
)
;
do
for
PLUGIN
in
$(
find optional_plugins
-mindepth
1
-maxdepth
1
-type
d
)
;
do
DIR_GLOB_MAP[
$PLUGIN
]=
"tests/test_*.py"
DIR_GLOB_MAP[
$PLUGIN
]=
"tests/test_*.py"
done
;
done
;
else
DIR_GLOB_MAP[selftests]
=
"selftests/unit/test_*.py selftests/doc/test_*.py"
fi
declare
-A
TESTS
declare
-A
TESTS
for
TEST_DIR
in
"
${
!DIR_GLOB_MAP[@]
}
"
;
do
for
TEST_DIR
in
"
${
!DIR_GLOB_MAP[@]
}
"
;
do
...
...
selftests/functional/test_basic.py
浏览文件 @
48492a1f
...
@@ -606,6 +606,8 @@ class RunnerHumanOutputTest(unittest.TestCase):
...
@@ -606,6 +606,8 @@ class RunnerHumanOutputTest(unittest.TestCase):
b
'INTERRUPT 0 | CANCEL 1'
,
b
'INTERRUPT 0 | CANCEL 1'
,
result
.
stdout
)
result
.
stdout
)
@
unittest
.
skipIf
(
sys
.
version_info
[
0
]
==
3
,
"Test currently broken on Python 3"
)
@
unittest
.
skipIf
(
not
GNU_ECHO_BINARY
,
@
unittest
.
skipIf
(
not
GNU_ECHO_BINARY
,
'GNU style echo binary not available'
)
'GNU style echo binary not available'
)
def
test_ugly_echo_cmd
(
self
):
def
test_ugly_echo_cmd
(
self
):
...
...
selftests/functional/test_loader.py
浏览文件 @
48492a1f
...
@@ -6,6 +6,7 @@ import stat
...
@@ -6,6 +6,7 @@ import stat
import
tempfile
import
tempfile
import
shutil
import
shutil
import
signal
import
signal
import
sys
import
unittest
import
unittest
from
avocado.core
import
exit_codes
from
avocado.core
import
exit_codes
...
@@ -268,6 +269,8 @@ class LoaderTestFunctional(unittest.TestCase):
...
@@ -268,6 +269,8 @@ class LoaderTestFunctional(unittest.TestCase):
%
(
AVOCADO
,
self
.
tmpdir
,
mytest
))
%
(
AVOCADO
,
self
.
tmpdir
,
mytest
))
self
.
_run_with_timeout
(
cmd_line
,
5
)
self
.
_run_with_timeout
(
cmd_line
,
5
)
@
unittest
.
skipIf
(
sys
.
version_info
[
0
]
==
3
,
"Test currently broken on Python 3"
)
@
unittest
.
skipUnless
(
os
.
path
.
exists
(
"/bin/true"
),
"/bin/true not "
@
unittest
.
skipUnless
(
os
.
path
.
exists
(
"/bin/true"
),
"/bin/true not "
"available"
)
"available"
)
@
unittest
.
skipUnless
(
os
.
path
.
exists
(
"/bin/echo"
),
"/bin/echo not "
@
unittest
.
skipUnless
(
os
.
path
.
exists
(
"/bin/echo"
),
"/bin/echo not "
...
@@ -326,6 +329,8 @@ class LoaderTestFunctional(unittest.TestCase):
...
@@ -326,6 +329,8 @@ class LoaderTestFunctional(unittest.TestCase):
self
.
assertEqual
(
test
,
11
,
"Number of tests is not 12 (%s):
\n
%s"
self
.
assertEqual
(
test
,
11
,
"Number of tests is not 12 (%s):
\n
%s"
%
(
test
,
result
))
%
(
test
,
result
))
@
unittest
.
skipIf
(
sys
.
version_info
[
0
]
==
3
,
"Test currently broken on Python 3"
)
def
test_python_unittest
(
self
):
def
test_python_unittest
(
self
):
test_path
=
os
.
path
.
join
(
basedir
,
"selftests"
,
".data"
,
"unittests.py"
)
test_path
=
os
.
path
.
join
(
basedir
,
"selftests"
,
".data"
,
"unittests.py"
)
cmd
=
(
"%s run --sysinfo=off --job-results-dir %s --json - -- %s"
cmd
=
(
"%s run --sysinfo=off --job-results-dir %s --json - -- %s"
...
...
selftests/functional/test_output.py
浏览文件 @
48492a1f
import
json
import
json
import
tempfile
import
os
import
os
import
re
import
re
import
shutil
import
shutil
import
sys
import
tempfile
import
unittest
import
unittest
from
xml.dom
import
minidom
from
xml.dom
import
minidom
...
@@ -162,6 +163,8 @@ class OutputTest(unittest.TestCase):
...
@@ -162,6 +163,8 @@ class OutputTest(unittest.TestCase):
"Libc double free can be seen in avocado "
"Libc double free can be seen in avocado "
"doublefree output:
\n
%s"
%
output
)
"doublefree output:
\n
%s"
%
output
)
@
unittest
.
skipIf
(
sys
.
version_info
[
0
]
==
3
,
"Test currently broken on Python 3"
)
def
test_print_to_std
(
self
):
def
test_print_to_std
(
self
):
def
_check_output
(
path
,
exps
,
name
):
def
_check_output
(
path
,
exps
,
name
):
i
=
0
i
=
0
...
@@ -246,6 +249,8 @@ class OutputTest(unittest.TestCase):
...
@@ -246,6 +249,8 @@ class OutputTest(unittest.TestCase):
with
open
(
output_file_path
,
'r'
)
as
output
:
with
open
(
output_file_path
,
'r'
)
as
output
:
self
.
assertEqual
(
output
.
read
(),
''
)
self
.
assertEqual
(
output
.
read
(),
''
)
@
unittest
.
skipIf
(
sys
.
version_info
[
0
]
==
3
,
"Test currently broken on Python 3"
)
def
test_check_on_off
(
self
):
def
test_check_on_off
(
self
):
"""
"""
Checks that output will always be kept, but it will only make into
Checks that output will always be kept, but it will only make into
...
...
selftests/functional/test_output_check.py
浏览文件 @
48492a1f
import
json
import
json
import
os
import
os
import
tempfile
import
shutil
import
shutil
import
sys
import
tempfile
import
unittest
import
unittest
from
avocado.core
import
exit_codes
from
avocado.core
import
exit_codes
...
@@ -138,6 +139,8 @@ class RunnerSimpleTest(unittest.TestCase):
...
@@ -138,6 +139,8 @@ class RunnerSimpleTest(unittest.TestCase):
(
expected_rc
,
result
))
(
expected_rc
,
result
))
self
.
assertIn
(
tampered_msg
,
result
.
stdout
)
self
.
assertIn
(
tampered_msg
,
result
.
stdout
)
@
unittest
.
skipIf
(
sys
.
version_info
[
0
]
==
3
,
"Test currently broken on Python 3"
)
def
test_output_diff
(
self
):
def
test_output_diff
(
self
):
self
.
_check_output_record_all
()
self
.
_check_output_record_all
()
tampered_msg_stdout
=
b
"I PITY THE FOOL THAT STANDS ON STDOUT!"
tampered_msg_stdout
=
b
"I PITY THE FOOL THAT STANDS ON STDOUT!"
...
...
selftests/run
浏览文件 @
48492a1f
...
@@ -30,15 +30,9 @@ def test_suite():
...
@@ -30,15 +30,9 @@ def test_suite():
loader
=
unittest
.
TestLoader
()
loader
=
unittest
.
TestLoader
()
selftests_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
selftests_dir
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
basedir
=
os
.
path
.
dirname
(
selftests_dir
)
basedir
=
os
.
path
.
dirname
(
selftests_dir
)
if
sys
.
version_info
[
0
]
==
3
:
for
section
in
(
'unit'
,
'functional'
,
'doc'
):
sections
=
(
'unit'
,
'doc'
)
else
:
sections
=
(
'unit'
,
'functional'
,
'doc'
)
for
section
in
sections
:
suite
.
addTests
(
loader
.
discover
(
start_dir
=
os
.
path
.
join
(
selftests_dir
,
section
),
suite
.
addTests
(
loader
.
discover
(
start_dir
=
os
.
path
.
join
(
selftests_dir
,
section
),
top_level_dir
=
basedir
))
top_level_dir
=
basedir
))
if
sys
.
version_info
[
0
]
==
3
:
return
suite
plugins
=
((
'avocado-framework-plugin-varianter-yaml-to-mux'
,
plugins
=
((
'avocado-framework-plugin-varianter-yaml-to-mux'
,
'varianter_yaml_to_mux'
),
'varianter_yaml_to_mux'
),
(
'avocado-framework-plugin-runner-remote'
,
(
'avocado-framework-plugin-runner-remote'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录