Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
79336999
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,发现更多精彩内容 >>
提交
79336999
编写于
11月 03, 2015
作者:
L
Lukáš Doktor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
selftests: Add selftests for test which uses quoted chars
Signed-off-by:
N
Lukáš Doktor
<
ldoktor@redhat.com
>
上级
c247876c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
41 addition
and
0 deletion
+41
-0
selftests/functional/test_basic.py
selftests/functional/test_basic.py
+41
-0
未找到文件。
selftests/functional/test_basic.py
浏览文件 @
79336999
...
...
@@ -5,6 +5,7 @@ import time
import
sys
import
tempfile
import
xml.dom.minidom
import
glob
if
sys
.
version_info
[:
2
]
==
(
2
,
6
):
import
unittest2
as
unittest
...
...
@@ -334,6 +335,32 @@ class RunnerHumanOutputTest(unittest.TestCase):
self
.
assertIn
(
'skiponsetup.py:SkipOnSetupTest.test_wont_be_executed:'
' SKIP'
,
result
.
stdout
)
def
test_ugly_echo_cmd
(
self
):
if
not
os
.
path
.
exists
(
"/bin/echo"
):
self
.
skipTest
(
"Program /bin/echo does not exist"
)
os
.
chdir
(
basedir
)
cmd_line
=
(
'./scripts/avocado run "/bin/echo -ne '
'foo
\\\\\\
n
\\\'\\\\\\
"
\\\\\\
nbar/baz" --job-results-dir %s'
' --sysinfo=off --show-job-log'
%
self
.
tmpdir
)
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
expected_rc
=
exit_codes
.
AVOCADO_ALL_OK
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
,
"Avocado did not return rc %s:
\n
%s"
%
(
expected_rc
,
result
))
self
.
assertIn
(
'[stdout] foo'
,
result
.
stdout
,
result
)
self
.
assertIn
(
'[stdout]
\'
"'
,
result
.
stdout
,
result
)
self
.
assertIn
(
'[stdout] bar/baz'
,
result
.
stdout
,
result
)
self
.
assertIn
(
'PASS /bin/echo -ne foo
\\\\
n
\\\'\\
"
\\\\
nbar/baz'
,
result
.
stdout
,
result
)
# logdir name should escape special chars (/)
test_dirs
=
glob
.
glob
(
os
.
path
.
join
(
self
.
tmpdir
,
'latest'
,
'test-results'
,
'*'
))
self
.
assertEqual
(
len
(
test_dirs
),
1
,
"There are multiple directories in"
" test-results dir, but only one test was executed: "
"%s"
%
(
test_dirs
))
self
.
assertEqual
(
os
.
path
.
basename
(
test_dirs
[
0
]),
'_bin_echo -ne foo
\\\\
n
\\\'\\
"
\\\\
nbar_baz'
)
def
tearDown
(
self
):
shutil
.
rmtree
(
self
.
tmpdir
)
...
...
@@ -695,6 +722,7 @@ class PluginsJSONTest(AbsPluginsTest, unittest.TestCase):
n_skip
=
json_data
[
'skip'
]
self
.
assertEqual
(
n_skip
,
e_nskip
,
"Different number of skipped tests"
)
return
json_data
def
test_json_plugin_passtest
(
self
):
self
.
run_and_check
(
'passtest'
,
exit_codes
.
AVOCADO_ALL_OK
,
...
...
@@ -712,6 +740,19 @@ class PluginsJSONTest(AbsPluginsTest, unittest.TestCase):
self
.
run_and_check
(
'errortest'
,
exit_codes
.
AVOCADO_TESTS_FAIL
,
1
,
1
,
0
,
0
)
def
test_ugly_echo_cmd
(
self
):
if
not
os
.
path
.
exists
(
"/bin/echo"
):
self
.
skipTest
(
"Program /bin/echo does not exist"
)
data
=
self
.
run_and_check
(
'"/bin/echo -ne foo
\\\\\\
n
\\\'\\\\\\
"
\\\\\\
'
'nbar/baz"'
,
exit_codes
.
AVOCADO_ALL_OK
,
1
,
0
,
0
,
0
)
# The executed test should be this
self
.
assertEqual
(
data
[
'tests'
][
0
][
'url'
],
'/bin/echo -ne foo
\\\\
n
\\\'\\
"
\\\\
nbar/baz'
)
# logdir name should escape special chars (/)
self
.
assertEqual
(
os
.
path
.
basename
(
data
[
'tests'
][
0
][
'logdir'
]),
'_bin_echo -ne foo
\\\\
n
\\\'\\
"
\\\\
nbar_baz'
)
def
tearDown
(
self
):
shutil
.
rmtree
(
self
.
tmpdir
)
super
(
PluginsJSONTest
,
self
).
tearDown
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录