Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
99bbd3a0
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,发现更多精彩内容 >>
未验证
提交
99bbd3a0
编写于
8月 08, 2018
作者:
C
Cleber Rosa
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'clebergnu/selftests_fixes'
Signed-off-by:
N
Cleber Rosa
<
crosa@redhat.com
>
上级
f4ddaf73
4052b3c5
变更
30
隐藏空白更改
内联
并排
Showing
30 changed file
with
122 addition
and
189 deletion
+122
-189
selftests/__init__.py
selftests/__init__.py
+10
-0
selftests/doc/test_doc_build.py
selftests/doc/test_doc_build.py
+2
-4
selftests/functional/test_argument_parsing.py
selftests/functional/test_argument_parsing.py
+5
-9
selftests/functional/test_basic.py
selftests/functional/test_basic.py
+10
-13
selftests/functional/test_export_variables.py
selftests/functional/test_export_variables.py
+2
-6
selftests/functional/test_gdb.py
selftests/functional/test_gdb.py
+3
-6
selftests/functional/test_getdata.py
selftests/functional/test_getdata.py
+4
-8
selftests/functional/test_interrupt.py
selftests/functional/test_interrupt.py
+5
-10
selftests/functional/test_job_timeout.py
selftests/functional/test_job_timeout.py
+3
-7
selftests/functional/test_journal.py
selftests/functional/test_journal.py
+2
-5
selftests/functional/test_json_variants.py
selftests/functional/test_json_variants.py
+2
-6
selftests/functional/test_loader.py
selftests/functional/test_loader.py
+5
-9
selftests/functional/test_output.py
selftests/functional/test_output.py
+8
-8
selftests/functional/test_output_check.py
selftests/functional/test_output_check.py
+5
-8
selftests/functional/test_plugin_diff.py
selftests/functional/test_plugin_diff.py
+11
-8
selftests/functional/test_plugin_jobscripts.py
selftests/functional/test_plugin_jobscripts.py
+1
-3
selftests/functional/test_replay_basic.py
selftests/functional/test_replay_basic.py
+2
-6
selftests/functional/test_replay_external_runner.py
selftests/functional/test_replay_external_runner.py
+2
-6
selftests/functional/test_replay_failfast.py
selftests/functional/test_replay_failfast.py
+2
-6
selftests/functional/test_skiptests.py
selftests/functional/test_skiptests.py
+5
-8
selftests/functional/test_standalone.py
selftests/functional/test_standalone.py
+4
-6
selftests/functional/test_statuses.py
selftests/functional/test_statuses.py
+2
-5
selftests/functional/test_streams.py
selftests/functional/test_streams.py
+11
-8
selftests/functional/test_sysinfo.py
selftests/functional/test_sysinfo.py
+4
-7
selftests/functional/test_teststmpdir.py
selftests/functional/test_teststmpdir.py
+2
-5
selftests/functional/test_thirdparty_bugs.py
selftests/functional/test_thirdparty_bugs.py
+1
-4
selftests/functional/test_unittest_compat.py
selftests/functional/test_unittest_compat.py
+3
-5
selftests/functional/test_wrapper.py
selftests/functional/test_wrapper.py
+4
-7
selftests/unit/test_archive.py
selftests/unit/test_archive.py
+1
-3
selftests/unit/test_jobdata.py
selftests/unit/test_jobdata.py
+1
-3
未找到文件。
selftests/__init__.py
浏览文件 @
99bbd3a0
import
os
import
sys
import
unittest
#: The base directory for the avocado source tree
BASEDIR
=
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
))
#: The name of the avocado test runner entry point
AVOCADO
=
os
.
environ
.
get
(
"UNITTEST_AVOCADO_CMD"
,
"%s ./scripts/avocado"
%
sys
.
executable
)
selftests/doc/test_doc_build.py
浏览文件 @
99bbd3a0
...
...
@@ -9,9 +9,7 @@ import unittest
from
avocado.utils
import
process
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
basedir
=
os
.
path
.
abspath
(
basedir
)
from
..
import
BASEDIR
class
DocBuildError
(
Exception
):
...
...
@@ -52,7 +50,7 @@ class DocBuildTest(unittest.TestCase):
'nonexisting document u
\'
api/test/avocado.plugins
\'
'
)
ignore_list
.
append
(
'WARNING: toctree contains reference to '
+
'nonexisting document u
\'
api/test/avocado.utils
\'
'
)
doc_dir
=
os
.
path
.
join
(
basedir
,
'docs'
)
doc_dir
=
os
.
path
.
join
(
BASEDIR
,
'docs'
)
process
.
run
(
'make -C %s clean'
%
doc_dir
)
result
=
process
.
run
(
'make -C %s html'
%
doc_dir
,
ignore_status
=
True
)
self
.
assertFalse
(
result
.
exit_status
,
"Doc build reported non-zero "
...
...
selftests/functional/test_argument_parsing.py
浏览文件 @
99bbd3a0
...
...
@@ -7,17 +7,13 @@ from avocado.core import job_id
from
avocado.core
import
exit_codes
from
avocado.utils
import
process
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
basedir
=
os
.
path
.
abspath
(
basedir
)
AVOCADO
=
os
.
environ
.
get
(
"UNITTEST_AVOCADO_CMD"
,
"./scripts/avocado"
)
from
..
import
AVOCADO
,
BASEDIR
class
ArgumentParsingTest
(
unittest
.
TestCase
):
def
test_unknown_command
(
self
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
cmd_line
=
'%s whacky-command-that-doesnt-exist'
%
AVOCADO
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
expected_rc
=
exit_codes
.
AVOCADO_FAIL
...
...
@@ -25,7 +21,7 @@ class ArgumentParsingTest(unittest.TestCase):
'Avocado did not return rc %d:
\n
%s'
%
(
expected_rc
,
result
))
def
test_known_command_bad_choice
(
self
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
cmd_line
=
'%s run --sysinfo=foo passtest'
%
AVOCADO
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
expected_rc
=
exit_codes
.
AVOCADO_FAIL
...
...
@@ -33,7 +29,7 @@ class ArgumentParsingTest(unittest.TestCase):
'Avocado did not return rc %d:
\n
%s'
%
(
expected_rc
,
result
))
def
test_known_command_bad_argument
(
self
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
cmd_line
=
'%s run --sysinfo=off --whacky-argument passtest'
%
AVOCADO
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
expected_rc
=
exit_codes
.
AVOCADO_FAIL
...
...
@@ -54,7 +50,7 @@ class ArgumentParsingErrorEarlyTest(unittest.TestCase):
:param complement_args: the complement arguments to an 'avocado run'
command line
"""
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
log_dir
=
data_dir
.
get_logs_dir
()
self
.
assertIsNotNone
(
log_dir
)
job
=
job_id
.
create_unique_job_id
()
...
...
selftests/functional/test_basic.py
浏览文件 @
99bbd3a0
...
...
@@ -35,11 +35,8 @@ from avocado.utils import process
from
avocado.utils
import
script
from
avocado.utils
import
path
as
utils_path
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
basedir
=
os
.
path
.
abspath
(
basedir
)
from
..
import
AVOCADO
,
BASEDIR
AVOCADO
=
os
.
environ
.
get
(
"UNITTEST_AVOCADO_CMD"
,
"%s ./scripts/avocado"
%
sys
.
executable
)
LOCAL_IMPORT_TEST_CONTENTS
=
'''
from avocado import Test
...
...
@@ -160,7 +157,7 @@ class RunnerOperationTest(unittest.TestCase):
def
setUp
(
self
):
self
.
tmpdir
=
tempfile
.
mkdtemp
(
prefix
=
'avocado_'
+
__name__
)
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
def
test_show_version
(
self
):
result
=
process
.
run
(
'%s -v'
%
AVOCADO
,
ignore_status
=
True
)
...
...
@@ -565,7 +562,7 @@ class RunnerHumanOutputTest(unittest.TestCase):
def
setUp
(
self
):
self
.
tmpdir
=
tempfile
.
mkdtemp
(
prefix
=
'avocado_'
+
__name__
)
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
def
test_output_pass
(
self
):
cmd_line
=
(
'%s run --sysinfo=off --job-results-dir %s '
...
...
@@ -663,7 +660,7 @@ class RunnerSimpleTest(unittest.TestCase):
'avocado_simpletest_'
'functional'
)
self
.
fail_script
.
save
()
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
def
test_simpletest_pass
(
self
):
cmd_line
=
(
'%s run --job-results-dir %s --sysinfo=off'
...
...
@@ -735,7 +732,7 @@ class RunnerSimpleTest(unittest.TestCase):
os
.
environ
[
'PATH'
]
+=
":"
+
os
.
path
.
dirname
(
AVOCADO
)
# simplewarning.sh calls "avocado exec-path" which hasn't
# access to an installed location for the libexec scripts
os
.
environ
[
'PATH'
]
+=
":"
+
os
.
path
.
join
(
basedir
,
'libexec'
)
os
.
environ
[
'PATH'
]
+=
":"
+
os
.
path
.
join
(
BASEDIR
,
'libexec'
)
cmd_line
=
(
'%s run --job-results-dir %s --sysinfo=off '
'examples/tests/simplewarning.sh --show-job-log'
%
(
AVOCADO
,
self
.
tmpdir
))
...
...
@@ -755,7 +752,7 @@ class RunnerSimpleTest(unittest.TestCase):
@
unittest
.
skipIf
(
not
GNU_ECHO_BINARY
,
"Uses echo as test"
)
def
test_fs_unfriendly_run
(
self
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
commands_path
=
os
.
path
.
join
(
self
.
tmpdir
,
"commands"
)
script
.
make_script
(
commands_path
,
"echo '
\"\\
/|?*<>'"
)
config_path
=
os
.
path
.
join
(
self
.
tmpdir
,
"config.conf"
)
...
...
@@ -790,7 +787,7 @@ class RunnerSimpleTest(unittest.TestCase):
self
.
assertTrue
(
sysinfo
)
def
test_non_absolute_path
(
self
):
avocado_path
=
os
.
path
.
join
(
basedir
,
'scripts'
,
'avocado'
)
avocado_path
=
os
.
path
.
join
(
BASEDIR
,
'scripts'
,
'avocado'
)
test_base_dir
=
os
.
path
.
dirname
(
self
.
pass_script
.
path
)
os
.
chdir
(
test_base_dir
)
test_file_name
=
os
.
path
.
basename
(
self
.
pass_script
.
path
)
...
...
@@ -867,7 +864,7 @@ class RunnerSimpleTestStatus(unittest.TestCase):
"skip_regex = ^SKIP$
\n
"
"skip_location = stdout
\n
"
)
self
.
config_file
.
save
()
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
def
test_simpletest_status
(
self
):
# Multi-line warning in STDERR should by default be handled
...
...
@@ -930,7 +927,7 @@ class ExternalRunnerTest(unittest.TestCase):
"exit 1"
,
'avocado_externalrunner_functional'
)
self
.
fail_script
.
save
()
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
def
test_externalrunner_pass
(
self
):
cmd_line
=
(
'%s run --job-results-dir %s --sysinfo=off '
...
...
@@ -987,7 +984,7 @@ class AbsPluginsTest(object):
def
setUp
(
self
):
self
.
base_outputdir
=
tempfile
.
mkdtemp
(
prefix
=
'avocado_'
+
__name__
)
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
def
tearDown
(
self
):
shutil
.
rmtree
(
self
.
base_outputdir
)
...
...
selftests/functional/test_export_variables.py
浏览文件 @
99bbd3a0
...
...
@@ -8,11 +8,7 @@ from avocado.core import exit_codes
from
avocado.utils
import
process
from
avocado.utils
import
script
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
basedir
=
os
.
path
.
abspath
(
basedir
)
AVOCADO
=
os
.
environ
.
get
(
"UNITTEST_AVOCADO_CMD"
,
"./scripts/avocado"
)
from
..
import
AVOCADO
,
BASEDIR
SCRIPT_CONTENT
=
"""#!/bin/sh
echo "Avocado Version: $AVOCADO_VERSION"
...
...
@@ -44,7 +40,7 @@ class EnvironmentVariablesTest(unittest.TestCase):
self
.
script
.
save
()
def
test_environment_vars
(
self
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
cmd_line
=
(
'%s run --job-results-dir %s --sysinfo=on %s'
%
(
AVOCADO
,
self
.
tmpdir
,
self
.
script
.
path
))
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
...
...
selftests/functional/test_gdb.py
浏览文件 @
99bbd3a0
...
...
@@ -5,10 +5,7 @@ import unittest
from
avocado.utils
import
process
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
basedir
=
os
.
path
.
abspath
(
basedir
)
AVOCADO
=
os
.
environ
.
get
(
"UNITTEST_AVOCADO_CMD"
,
"./scripts/avocado"
)
from
..
import
AVOCADO
,
BASEDIR
class
GDBPluginTest
(
unittest
.
TestCase
):
...
...
@@ -17,14 +14,14 @@ class GDBPluginTest(unittest.TestCase):
self
.
tmpdir
=
tempfile
.
mkdtemp
(
prefix
=
'avocado_'
+
__name__
)
def
test_gdb_prerun_commands
(
self
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
cmd_line
=
(
'%s run --job-results-dir %s --sysinfo=off '
'--gdb-prerun-commands=/dev/null passtest.py'
%
(
AVOCADO
,
self
.
tmpdir
))
process
.
run
(
cmd_line
)
def
test_gdb_multiple_prerun_commands
(
self
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
cmd_line
=
(
'%s run --job-results-dir %s --sysinfo=off '
'--gdb-prerun-commands=/dev/null '
'--gdb-prerun-commands=foo:/dev/null passtest.py'
...
...
selftests/functional/test_getdata.py
浏览文件 @
99bbd3a0
...
...
@@ -6,22 +6,18 @@ import unittest
from
avocado.core
import
exit_codes
from
avocado.utils
import
process
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
basedir
=
os
.
path
.
abspath
(
basedir
)
AVOCADO
=
os
.
environ
.
get
(
"UNITTEST_AVOCADO_CMD"
,
"./scripts/avocado"
)
from
..
import
AVOCADO
,
BASEDIR
class
GetData
(
unittest
.
TestCase
):
def
setUp
(
self
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
self
.
tmpdir
=
tempfile
.
mkdtemp
(
prefix
=
'avocado_'
+
__name__
)
def
test
(
self
):
test_path
=
os
.
path
.
join
(
basedir
,
"selftests"
,
".data"
,
"get_data.py"
)
test_variants_path
=
os
.
path
.
join
(
basedir
,
"selftests"
,
".data"
,
test_path
=
os
.
path
.
join
(
BASEDIR
,
"selftests"
,
".data"
,
"get_data.py"
)
test_variants_path
=
os
.
path
.
join
(
BASEDIR
,
"selftests"
,
".data"
,
"get_data.py.data"
,
"get_data.yaml"
)
cmd_line
=
"%s run --sysinfo=off --job-results-dir '%s' -m %s -- %s"
cmd_line
%=
(
AVOCADO
,
self
.
tmpdir
,
test_variants_path
,
test_path
)
...
...
selftests/functional/test_interrupt.py
浏览文件 @
99bbd3a0
...
...
@@ -14,12 +14,7 @@ from avocado.utils import wait
from
avocado.utils
import
script
from
avocado.utils
import
data_factory
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
basedir
=
os
.
path
.
abspath
(
basedir
)
AVOCADO
=
os
.
environ
.
get
(
"UNITTEST_AVOCADO_CMD"
,
"./scripts/avocado"
)
from
..
import
AVOCADO
,
BASEDIR
# What is commonly known as "0755" or "u=rwx,g=rx,o=rx"
DEFAULT_MODE
=
(
stat
.
S_IRUSR
|
stat
.
S_IWUSR
|
stat
.
S_IXUSR
|
...
...
@@ -119,7 +114,7 @@ class InterruptTest(unittest.TestCase):
mode
=
DEFAULT_MODE
)
bad_test
.
save
()
self
.
test_module
=
bad_test
.
path
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
cmd
=
(
'%s run %s --sysinfo=off --job-results-dir %s '
%
(
AVOCADO
,
self
.
test_module
,
self
.
tmpdir
))
self
.
proc
=
subprocess
.
Popen
(
cmd
.
split
(),
...
...
@@ -167,7 +162,7 @@ class InterruptTest(unittest.TestCase):
mode
=
DEFAULT_MODE
)
bad_test
.
save
()
self
.
test_module
=
bad_test
.
path
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
cmd
=
(
'%s run %s --sysinfo=off --job-results-dir %s '
%
(
AVOCADO
,
self
.
test_module
,
self
.
tmpdir
))
self
.
proc
=
subprocess
.
Popen
(
cmd
.
split
(),
...
...
@@ -207,7 +202,7 @@ class InterruptTest(unittest.TestCase):
mode
=
DEFAULT_MODE
)
good_test
.
save
()
self
.
test_module
=
good_test
.
path
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
cmd
=
(
'%s run %s --sysinfo=off --job-results-dir %s '
%
(
AVOCADO
,
self
.
test_module
,
self
.
tmpdir
))
self
.
proc
=
subprocess
.
Popen
(
cmd
.
split
(),
...
...
@@ -251,7 +246,7 @@ class InterruptTest(unittest.TestCase):
mode
=
DEFAULT_MODE
)
good_test
.
save
()
self
.
test_module
=
good_test
.
path
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
cmd
=
(
'%s run %s --sysinfo=off --job-results-dir %s '
%
(
AVOCADO
,
self
.
test_module
,
self
.
tmpdir
))
self
.
proc
=
subprocess
.
Popen
(
cmd
.
split
(),
...
...
selftests/functional/test_job_timeout.py
浏览文件 @
99bbd3a0
...
...
@@ -10,11 +10,7 @@ from avocado.utils import genio
from
avocado.utils
import
process
from
avocado.utils
import
script
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
basedir
=
os
.
path
.
abspath
(
basedir
)
AVOCADO
=
os
.
environ
.
get
(
"UNITTEST_AVOCADO_CMD"
,
"./scripts/avocado"
)
from
..
import
AVOCADO
,
BASEDIR
SCRIPT_CONTENT
=
"""#!/bin/bash
...
...
@@ -53,11 +49,11 @@ class JobTimeOutTest(unittest.TestCase):
'avocado_timeout_functional'
)
self
.
py
.
save
()
self
.
tmpdir
=
tempfile
.
mkdtemp
(
prefix
=
'avocado_'
+
__name__
)
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
def
run_and_check
(
self
,
cmd_line
,
e_rc
,
e_ntests
,
e_nerrors
,
e_nfailures
,
e_nskip
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
xml_output
=
result
.
stdout
self
.
assertEqual
(
result
.
exit_status
,
e_rc
,
...
...
selftests/functional/test_journal.py
浏览文件 @
99bbd3a0
...
...
@@ -8,16 +8,13 @@ import unittest
from
avocado.core
import
exit_codes
from
avocado.utils
import
process
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
basedir
=
os
.
path
.
abspath
(
basedir
)
AVOCADO
=
os
.
environ
.
get
(
"UNITTEST_AVOCADO_CMD"
,
"./scripts/avocado"
)
from
..
import
AVOCADO
,
BASEDIR
class
JournalPluginTests
(
unittest
.
TestCase
):
def
setUp
(
self
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
self
.
tmpdir
=
tempfile
.
mkdtemp
(
prefix
=
'avocado_'
+
__name__
)
self
.
cmd_line
=
(
'%s run --job-results-dir %s --sysinfo=off --json - '
'--journal examples/tests/passtest.py'
...
...
selftests/functional/test_json_variants.py
浏览文件 @
99bbd3a0
...
...
@@ -6,11 +6,7 @@ import unittest
from
avocado.utils
import
process
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
basedir
=
os
.
path
.
abspath
(
basedir
)
AVOCADO
=
os
.
environ
.
get
(
"UNITTEST_AVOCADO_CMD"
,
"./scripts/avocado"
)
from
..
import
AVOCADO
,
BASEDIR
class
VariantsDumpLoadTests
(
unittest
.
TestCase
):
...
...
@@ -18,7 +14,7 @@ class VariantsDumpLoadTests(unittest.TestCase):
def
setUp
(
self
):
self
.
tmpdir
=
tempfile
.
mkdtemp
(
prefix
=
'avocado_'
+
__name__
)
self
.
variants_file
=
os
.
path
.
join
(
self
.
tmpdir
,
'variants.json'
)
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
def
test_variants_dump
(
self
):
cmd_line
=
(
'%s variants --json-variants-dump %s'
%
...
...
selftests/functional/test_loader.py
浏览文件 @
99bbd3a0
...
...
@@ -13,11 +13,7 @@ from avocado.core import exit_codes
from
avocado.utils
import
script
from
avocado.utils
import
process
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
basedir
=
os
.
path
.
abspath
(
basedir
)
AVOCADO
=
os
.
environ
.
get
(
"UNITTEST_AVOCADO_CMD"
,
"./scripts/avocado"
)
from
..
import
AVOCADO
,
BASEDIR
AVOCADO_TEST_OK
=
"""#!/usr/bin/env python
...
...
@@ -155,7 +151,7 @@ class LoaderTestFunctional(unittest.TestCase):
stat
.
S_IROTH
|
stat
.
S_IXOTH
)
def
setUp
(
self
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
self
.
tmpdir
=
tempfile
.
mkdtemp
(
prefix
=
'avocado_'
+
__name__
)
def
_test
(
self
,
name
,
content
,
exp_str
,
mode
=
MODE_0664
,
count
=
1
):
...
...
@@ -243,7 +239,7 @@ class LoaderTestFunctional(unittest.TestCase):
mytest
=
script
.
Script
(
os
.
path
.
join
(
os
.
path
.
dirname
(
mylib
.
path
),
'test.py'
),
AVOCADO_SIMPLE_PYTHON_LIKE_MULTIPLE_FILES
)
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
mytest
.
save
()
cmd_line
=
"%s list -V %s"
%
(
AVOCADO
,
mytest
)
result
=
process
.
run
(
cmd_line
)
...
...
@@ -262,7 +258,7 @@ class LoaderTestFunctional(unittest.TestCase):
AVOCADO_TEST_SIMPLE_USING_MAIN
,
'avocado_simpletest_functional'
)
mytest
.
save
()
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
# job should be able to finish under 5 seconds. If this fails, it's
# possible that we hit the "simple test fork bomb" bug
cmd_line
=
(
"%s run --sysinfo=off --job-results-dir '%s' -- '%s'"
...
...
@@ -330,7 +326,7 @@ class LoaderTestFunctional(unittest.TestCase):
%
(
test
,
result
))
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"
%
(
AVOCADO
,
self
.
tmpdir
,
test_path
))
result
=
process
.
run
(
cmd
,
ignore_status
=
True
)
...
...
selftests/functional/test_output.py
浏览文件 @
99bbd3a0
...
...
@@ -15,16 +15,16 @@ from avocado.utils import process
from
avocado.utils
import
script
from
avocado.utils
import
path
as
utils_path
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
basedir
=
os
.
path
.
abspath
(
basedir
)
AVOCADO
=
os
.
environ
.
get
(
"UNITTEST_AVOCADO_CMD"
,
"./scripts/avocado"
)
from
..
import
AVOCADO
,
BASEDIR
# AVOCADO may contain more than a single command, as it can be
# prefixed by the Python interpreter
AVOCADO_QUOTED
=
", "
.
join
([
"'%s'"
%
cmd
for
cmd
in
AVOCADO
.
split
(
' '
)])
PERL_TAP_PARSER_SNIPPET
=
"""#!/bin/env perl
use TAP::Parser;
my $parser = TAP::Parser->new( { exec => [
'%s'
, 'run', 'passtest.py', 'errortest.py', 'warntest.py', '--tap', '-', '--sysinfo', 'off', '--job-results-dir', '%%s'] } );
my $parser = TAP::Parser->new( { exec => [
%s
, 'run', 'passtest.py', 'errortest.py', 'warntest.py', '--tap', '-', '--sysinfo', 'off', '--job-results-dir', '%%s'] } );
while ( my $result = $parser->next ) {
$result->is_unknown && die "Unknown line
\\
"" . $result->as_string . "
\\
" in the TAP output!
\n
";
...
...
@@ -32,7 +32,7 @@ while ( my $result = $parser->next ) {
$parser->parse_errors == 0 || die "Parser errors!
\n
";
$parser->is_good_plan || die "Plan is not a good plan!
\n
";
$parser->plan eq '1..3' || die "Plan does not match what was expected!
\n
";
"""
%
AVOCADO
"""
%
AVOCADO
_QUOTED
OUTPUT_TEST_CONTENT
=
"""#!/bin/env python
...
...
@@ -144,7 +144,7 @@ class OutputTest(unittest.TestCase):
def
setUp
(
self
):
self
.
tmpdir
=
tempfile
.
mkdtemp
(
prefix
=
'avocado_'
+
__name__
)
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
@
unittest
.
skipIf
(
missing_binary
(
'cc'
),
"C compiler is required by the underlying doublefree.py test"
)
...
...
@@ -281,7 +281,7 @@ class OutputPluginTest(unittest.TestCase):
def
setUp
(
self
):
self
.
tmpdir
=
tempfile
.
mkdtemp
(
prefix
=
'avocado_'
+
__name__
)
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
def
check_output_files
(
self
,
debug_log
):
base_dir
=
os
.
path
.
dirname
(
debug_log
)
...
...
selftests/functional/test_output_check.py
浏览文件 @
99bbd3a0
...
...
@@ -8,12 +8,9 @@ from avocado.core import exit_codes
from
avocado.utils
import
process
from
avocado.utils
import
script
from
..
import
AVOCADO
,
BASEDIR
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
basedir
=
os
.
path
.
abspath
(
basedir
)
AVOCADO
=
os
.
environ
.
get
(
"UNITTEST_AVOCADO_CMD"
,
"./scripts/avocado"
)
STDOUT
=
b
"Hello,
\xc4\x9b\xc5\xa1\xc4\x8d\xc5\x99\xc5\xbe\xc3\xbd\xc3\xa1\xc3\xad\xc3\xa9
!"
STDERR
=
b
"Hello, stderr!"
...
...
@@ -33,7 +30,7 @@ class RunnerSimpleTest(unittest.TestCase):
self
.
output_script
.
save
()
def
_check_output_record_all
(
self
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
cmd_line
=
(
'%s run --job-results-dir %s --sysinfo=off %s '
'--output-check-record all'
%
(
AVOCADO
,
self
.
tmpdir
,
self
.
output_script
.
path
))
...
...
@@ -50,7 +47,7 @@ class RunnerSimpleTest(unittest.TestCase):
self
.
assertEqual
(
fd_stderr
.
read
(),
STDERR
)
def
_check_output_record_combined
(
self
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
cmd_line
=
(
'%s run --job-results-dir %s --sysinfo=off %s '
'--output-check-record combined'
%
(
AVOCADO
,
self
.
tmpdir
,
self
.
output_script
.
path
))
...
...
@@ -64,7 +61,7 @@ class RunnerSimpleTest(unittest.TestCase):
self
.
assertEqual
(
fd_output
.
read
(),
STDOUT
+
STDERR
)
def
test_output_record_none
(
self
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
cmd_line
=
(
'%s run --job-results-dir %s --sysinfo=off %s '
'--output-check-record none'
%
(
AVOCADO
,
self
.
tmpdir
,
self
.
output_script
.
path
))
...
...
@@ -79,7 +76,7 @@ class RunnerSimpleTest(unittest.TestCase):
self
.
assertFalse
(
os
.
path
.
isfile
(
stderr_file
))
def
test_output_record_stdout
(
self
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
cmd_line
=
(
'%s run --job-results-dir %s --sysinfo=off %s '
'--output-check-record stdout'
%
(
AVOCADO
,
self
.
tmpdir
,
self
.
output_script
.
path
))
...
...
selftests/functional/test_plugin_diff.py
浏览文件 @
99bbd3a0
import
glob
import
os
import
sys
import
tempfile
import
shutil
import
unittest
...
...
@@ -8,11 +9,7 @@ from avocado.core import exit_codes
from
avocado.utils
import
process
from
avocado.utils
import
script
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
basedir
=
os
.
path
.
abspath
(
basedir
)
AVOCADO
=
os
.
environ
.
get
(
"UNITTEST_AVOCADO_CMD"
,
"./scripts/avocado"
)
from
..
import
AVOCADO
,
BASEDIR
class
DiffTests
(
unittest
.
TestCase
):
...
...
@@ -38,7 +35,7 @@ class DiffTests(unittest.TestCase):
self
.
jobdir2
=
''
.
join
(
glob
.
glob
(
os
.
path
.
join
(
self
.
tmpdir2
,
'job-*'
)))
def
run_and_check
(
self
,
cmd_line
,
expected_rc
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
,
"Command %s did not return rc "
...
...
@@ -50,9 +47,15 @@ class DiffTests(unittest.TestCase):
(
AVOCADO
,
self
.
jobdir
,
self
.
jobdir2
))
expected_rc
=
exit_codes
.
AVOCADO_ALL_OK
result
=
self
.
run_and_check
(
cmd_line
,
expected_rc
)
# Avocado won't know about the Python interpreter used on the
# command line
if
AVOCADO
.
startswith
(
sys
.
executable
):
avocado_in_log
=
AVOCADO
[
len
(
sys
.
executable
)
+
1
:]
else
:
avocado_in_log
=
AVOCADO
self
.
assertIn
(
b
"# COMMAND LINE"
,
result
.
stdout
)
self
.
assertIn
(
"-%s run"
%
AVOCADO
,
result
.
stdout_text
)
self
.
assertIn
(
"+%s run"
%
AVOCADO
,
result
.
stdout_text
)
self
.
assertIn
(
"-%s run"
%
avocado_in_log
,
result
.
stdout_text
)
self
.
assertIn
(
"+%s run"
%
avocado_in_log
,
result
.
stdout_text
)
def
test_diff_nocmdline
(
self
):
cmd_line
=
(
'%s diff %s %s --diff-filter nocmdline'
%
...
...
selftests/functional/test_plugin_jobscripts.py
浏览文件 @
99bbd3a0
...
...
@@ -7,10 +7,8 @@ from avocado.core import exit_codes
from
avocado.utils
import
process
from
avocado.utils
import
script
BASEDIR
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
BASEDIR
=
os
.
path
.
abspath
(
BASEDIR
)
from
..
import
AVOCADO
,
BASEDIR
AVOCADO
=
os
.
environ
.
get
(
"UNITTEST_AVOCADO_CMD"
,
"./scripts/avocado"
)
SCRIPT_PRE_TOUCH
=
"""#!/bin/sh -e
touch %s"""
...
...
selftests/functional/test_replay_basic.py
浏览文件 @
99bbd3a0
...
...
@@ -9,11 +9,7 @@ import pkg_resources
from
avocado.core
import
exit_codes
from
avocado.utils
import
process
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
basedir
=
os
.
path
.
abspath
(
basedir
)
AVOCADO
=
os
.
environ
.
get
(
"UNITTEST_AVOCADO_CMD"
,
"./scripts/avocado"
)
from
..
import
AVOCADO
,
BASEDIR
def
remote_capable
():
...
...
@@ -40,7 +36,7 @@ class ReplayTests(unittest.TestCase):
self
.
jobid
=
f
.
read
().
strip
(
'
\n
'
)
def
run_and_check
(
self
,
cmd_line
,
expected_rc
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
,
"Command %s did not return rc "
...
...
selftests/functional/test_replay_external_runner.py
浏览文件 @
99bbd3a0
...
...
@@ -8,11 +8,7 @@ from avocado.core import exit_codes
from
avocado.utils
import
process
from
avocado.utils
import
script
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
basedir
=
os
.
path
.
abspath
(
basedir
)
AVOCADO
=
os
.
environ
.
get
(
"UNITTEST_AVOCADO_CMD"
,
"./scripts/avocado"
)
from
..
import
AVOCADO
,
BASEDIR
class
ReplayExtRunnerTests
(
unittest
.
TestCase
):
...
...
@@ -33,7 +29,7 @@ class ReplayExtRunnerTests(unittest.TestCase):
self
.
jobid
=
f
.
read
().
strip
(
'
\n
'
)
def
run_and_check
(
self
,
cmd_line
,
expected_rc
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
,
"Command %s did not return rc "
...
...
selftests/functional/test_replay_failfast.py
浏览文件 @
99bbd3a0
...
...
@@ -7,11 +7,7 @@ import unittest
from
avocado.core
import
exit_codes
from
avocado.utils
import
process
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
basedir
=
os
.
path
.
abspath
(
basedir
)
AVOCADO
=
os
.
environ
.
get
(
"UNITTEST_AVOCADO_CMD"
,
"./scripts/avocado"
)
from
..
import
AVOCADO
,
BASEDIR
class
ReplayFailfastTests
(
unittest
.
TestCase
):
...
...
@@ -29,7 +25,7 @@ class ReplayFailfastTests(unittest.TestCase):
self
.
jobid
=
f
.
read
().
strip
(
'
\n
'
)
def
run_and_check
(
self
,
cmd_line
,
expected_rc
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
)
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
,
"Command %s did not return rc "
...
...
selftests/functional/test_skiptests.py
浏览文件 @
99bbd3a0
...
...
@@ -9,10 +9,7 @@ from avocado.utils import genio
from
avocado.utils
import
process
from
avocado.utils
import
script
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
basedir
=
os
.
path
.
abspath
(
basedir
)
AVOCADO
=
os
.
environ
.
get
(
"UNITTEST_AVOCADO_CMD"
,
"./scripts/avocado"
)
from
..
import
AVOCADO
,
BASEDIR
AVOCADO_TEST_SKIP_DECORATORS
=
"""
import avocado
...
...
@@ -81,7 +78,7 @@ class AvocadoSkipTests(avocado.Test):
class
TestSkipDecorators
(
unittest
.
TestCase
):
def
setUp
(
self
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
self
.
tmpdir
=
tempfile
.
mkdtemp
(
prefix
=
'avocado_'
+
__name__
)
test_path
=
os
.
path
.
join
(
self
.
tmpdir
,
'test_skip_decorators.py'
)
...
...
@@ -106,7 +103,7 @@ class TestSkipDecorators(unittest.TestCase):
self
.
bad_teardown
.
save
()
def
test_skip_decorators
(
self
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
cmd_line
=
[
AVOCADO
,
'run'
,
'--sysinfo=off'
,
...
...
@@ -126,7 +123,7 @@ class TestSkipDecorators(unittest.TestCase):
self
.
assertFalse
(
'teardown executed'
in
debuglog_contents
)
def
test_skip_setup
(
self
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
cmd_line
=
[
AVOCADO
,
'run'
,
'--sysinfo=off'
,
...
...
@@ -140,7 +137,7 @@ class TestSkipDecorators(unittest.TestCase):
self
.
assertEqual
(
json_results
[
'skip'
],
1
)
def
test_skip_teardown
(
self
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
cmd_line
=
[
AVOCADO
,
'run'
,
'--sysinfo=off'
,
...
...
selftests/functional/test_standalone.py
浏览文件 @
99bbd3a0
...
...
@@ -5,9 +5,7 @@ import unittest
from
avocado.core
import
exit_codes
from
avocado.utils
import
process
,
astring
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
basedir
=
os
.
path
.
abspath
(
basedir
)
from
..
import
BASEDIR
PY_CMD
=
sys
.
executable
...
...
@@ -18,12 +16,12 @@ class StandaloneTests(unittest.TestCase):
def
setUp
(
self
):
self
.
original_pypath
=
os
.
environ
.
get
(
'PYTHONPATH'
)
if
self
.
original_pypath
is
not
None
:
os
.
environ
[
'PYTHONPATH'
]
=
'%s:%s'
%
(
basedir
,
self
.
original_pypath
)
os
.
environ
[
'PYTHONPATH'
]
=
'%s:%s'
%
(
BASEDIR
,
self
.
original_pypath
)
else
:
os
.
environ
[
'PYTHONPATH'
]
=
'%s'
%
basedir
os
.
environ
[
'PYTHONPATH'
]
=
'%s'
%
BASEDIR
def
run_and_check
(
self
,
cmd_line
,
expected_rc
,
tstname
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
,
encoding
=
astring
.
ENCODING
)
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
,
...
...
selftests/functional/test_statuses.py
浏览文件 @
99bbd3a0
...
...
@@ -7,11 +7,8 @@ import unittest
from
avocado.utils
import
genio
from
avocado.utils
import
process
from
..
import
AVOCADO
,
BASEDIR
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
basedir
=
os
.
path
.
abspath
(
basedir
)
AVOCADO
=
os
.
environ
.
get
(
"UNITTEST_AVOCADO_CMD"
,
"./scripts/avocado"
)
ALL_MESSAGES
=
[
'setup pre'
,
'setup post'
,
...
...
@@ -139,7 +136,7 @@ class TestStatuses(unittest.TestCase):
".data"
,
'test_statuses.py'
))
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
cmd
=
(
'%s run %s --sysinfo=off --job-results-dir %s --json -'
%
(
AVOCADO
,
test_file
,
self
.
tmpdir
))
...
...
selftests/functional/test_streams.py
浏览文件 @
99bbd3a0
import
os
import
shutil
import
sys
import
tempfile
import
unittest
from
avocado.core
import
exit_codes
from
avocado.utils
import
process
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
basedir
=
os
.
path
.
abspath
(
basedir
)
AVOCADO
=
os
.
environ
.
get
(
"UNITTEST_AVOCADO_CMD"
,
"./scripts/avocado"
)
from
..
import
AVOCADO
,
BASEDIR
class
StreamsTest
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
tmpdir
=
tempfile
.
mkdtemp
(
prefix
=
'avocado_'
+
__name__
)
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
def
test_app_info_stdout
(
self
):
"""
...
...
@@ -60,7 +57,10 @@ class StreamsTest(unittest.TestCase):
self
.
assertEqual
(
result
.
exit_status
,
exit_codes
.
AVOCADO_ALL_OK
)
self
.
assertIn
(
b
"stevedore.extension: found extension EntryPoint.parse"
,
result
.
stdout
)
self
.
assertIn
(
"avocado.test: Command line: %s"
%
cmd
,
# Avocado won't know about the Python interpreter used on the
# command line
cmd_in_log
=
cmd
[
len
(
sys
.
executable
)
+
1
:]
self
.
assertIn
(
"avocado.test: Command line: %s"
%
cmd_in_log
,
result
.
stdout_text
)
self
.
assertEqual
(
b
''
,
result
.
stderr
)
...
...
@@ -80,7 +80,10 @@ class StreamsTest(unittest.TestCase):
result
.
stdout
)
self
.
assertNotIn
(
b
"stevedore.extension: found extension EntryPoint.parse"
,
result
.
stderr
)
self
.
assertIn
(
"Command line: %s"
%
cmd
,
# Avocado won't know about the Python interpreter used on the
# command line
cmd_in_log
=
cmd
[
len
(
sys
.
executable
)
+
1
:]
self
.
assertIn
(
"Command line: %s"
%
cmd_in_log
,
result
.
stdout_text
)
self
.
assertIn
(
b
"
\n
START 1-passtest.py:PassTest.test"
,
result
.
stdout
)
...
...
selftests/functional/test_sysinfo.py
浏览文件 @
99bbd3a0
...
...
@@ -7,11 +7,8 @@ from avocado.core import exit_codes
from
avocado.utils
import
process
from
avocado.utils
import
script
from
..
import
AVOCADO
,
BASEDIR
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
basedir
=
os
.
path
.
abspath
(
basedir
)
AVOCADO
=
os
.
environ
.
get
(
"UNITTEST_AVOCADO_CMD"
,
"./scripts/avocado"
)
COMMANDS_TIMEOUT_CONF
=
"""
[sysinfo.collect]
...
...
@@ -28,7 +25,7 @@ class SysInfoTest(unittest.TestCase):
self
.
tmpdir
=
tempfile
.
mkdtemp
(
prefix
=
'avocado_'
+
__name__
)
def
test_sysinfo_enabled
(
self
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
cmd_line
=
(
'%s run --job-results-dir %s --sysinfo=on '
'passtest.py'
%
(
AVOCADO
,
self
.
tmpdir
))
result
=
process
.
run
(
cmd_line
)
...
...
@@ -54,7 +51,7 @@ class SysInfoTest(unittest.TestCase):
self
.
assertTrue
(
os
.
path
.
exists
(
sysinfo_subdir
),
msg
)
def
test_sysinfo_disabled
(
self
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
cmd_line
=
(
'%s run --job-results-dir %s --sysinfo=off passtest.py'
%
(
AVOCADO
,
self
.
tmpdir
))
result
=
process
.
run
(
cmd_line
)
...
...
@@ -77,7 +74,7 @@ class SysInfoTest(unittest.TestCase):
shutil
.
rmtree
(
self
.
tmpdir
)
def
run_sysinfo_interrupted
(
self
,
sleep
,
timeout
,
exp_duration
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
commands_path
=
os
.
path
.
join
(
self
.
tmpdir
,
"commands"
)
script
.
make_script
(
commands_path
,
"sleep %s"
%
sleep
)
config_path
=
os
.
path
.
join
(
self
.
tmpdir
,
"config.conf"
)
...
...
selftests/functional/test_teststmpdir.py
浏览文件 @
99bbd3a0
...
...
@@ -8,11 +8,8 @@ from avocado.core import test
from
avocado.utils
import
process
from
avocado.utils
import
script
from
..
import
AVOCADO
,
BASEDIR
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
basedir
=
os
.
path
.
abspath
(
basedir
)
AVOCADO
=
os
.
environ
.
get
(
"UNITTEST_AVOCADO_CMD"
,
"./scripts/avocado"
)
INSTRUMENTED_SCRIPT
=
"""import os
import tempfile
...
...
@@ -50,7 +47,7 @@ class TestsTmpDirTests(unittest.TestCase):
self
.
instrumented_test
.
save
()
def
run_and_check
(
self
,
cmd_line
,
expected_rc
,
env
=
None
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
result
=
process
.
run
(
cmd_line
,
ignore_status
=
True
,
env
=
env
)
self
.
assertEqual
(
result
.
exit_status
,
expected_rc
,
"Command %s did not return rc "
...
...
selftests/functional/test_thirdparty_bugs.py
浏览文件 @
99bbd3a0
...
...
@@ -2,10 +2,7 @@ import re
import
json
import
unittest
try
:
from
urllib2
import
URLError
except
ImportError
:
from
urllib.error
import
URLError
from
six.moves.urllib.error
import
URLError
from
avocado.utils
import
download
...
...
selftests/functional/test_unittest_compat.py
浏览文件 @
99bbd3a0
...
...
@@ -7,9 +7,7 @@ import unittest
from
avocado.utils
import
script
from
avocado.utils
import
process
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
basedir
=
os
.
path
.
abspath
(
basedir
)
from
..
import
BASEDIR
UNITTEST_GOOD
=
"""from avocado import Test
...
...
@@ -68,9 +66,9 @@ class UnittestCompat(unittest.TestCase):
self
.
original_pypath
=
os
.
environ
.
get
(
'PYTHONPATH'
)
if
self
.
original_pypath
is
not
None
:
os
.
environ
[
'PYTHONPATH'
]
=
'%s:%s'
%
(
basedir
,
self
.
original_pypath
)
BASEDIR
,
self
.
original_pypath
)
else
:
os
.
environ
[
'PYTHONPATH'
]
=
'%s'
%
basedir
os
.
environ
[
'PYTHONPATH'
]
=
'%s'
%
BASEDIR
self
.
unittest_script_good
=
script
.
TemporaryScript
(
'unittest_good.py'
,
UNITTEST_GOOD
%
self
.
tmpdir
,
...
...
selftests/functional/test_wrapper.py
浏览文件 @
99bbd3a0
...
...
@@ -8,11 +8,8 @@ from avocado.utils import process
from
avocado.utils
import
script
from
avocado.utils
import
path
as
utils_path
from
..
import
AVOCADO
,
BASEDIR
basedir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
basedir
=
os
.
path
.
abspath
(
basedir
)
AVOCADO
=
os
.
environ
.
get
(
"UNITTEST_AVOCADO_CMD"
,
"./scripts/avocado"
)
SCRIPT_CONTENT
=
"""#!/bin/bash
touch %s
...
...
@@ -51,7 +48,7 @@ class WrapperTest(unittest.TestCase):
@
unittest
.
skipIf
(
missing_binary
(
'cc'
),
"C compiler is required by the underlying datadir.py test"
)
def
test_global_wrapper
(
self
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
cmd_line
=
(
'%s run --job-results-dir %s --sysinfo=off --wrapper %s '
'examples/tests/datadir.py'
%
(
AVOCADO
,
self
.
tmpdir
,
self
.
script
.
path
))
...
...
@@ -68,7 +65,7 @@ class WrapperTest(unittest.TestCase):
@
unittest
.
skipIf
(
missing_binary
(
'cc'
),
"C compiler is required by the underlying datadir.py test"
)
def
test_process_wrapper
(
self
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
cmd_line
=
(
'%s run --job-results-dir %s --sysinfo=off '
'--wrapper %s:*/datadir examples/tests/datadir.py'
%
(
AVOCADO
,
self
.
tmpdir
,
self
.
script
.
path
))
...
...
@@ -85,7 +82,7 @@ class WrapperTest(unittest.TestCase):
@
unittest
.
skipIf
(
missing_binary
(
'cc'
),
"C compiler is required by the underlying datadir.py test"
)
def
test_both_wrappers
(
self
):
os
.
chdir
(
basedir
)
os
.
chdir
(
BASEDIR
)
cmd_line
=
(
'%s run --job-results-dir %s --sysinfo=off --wrapper %s '
'--wrapper %s:*/datadir examples/tests/datadir.py'
%
(
AVOCADO
,
self
.
tmpdir
,
self
.
dummy
.
path
,
...
...
selftests/unit/test_archive.py
浏览文件 @
99bbd3a0
...
...
@@ -11,9 +11,7 @@ from avocado.utils import archive
from
avocado.utils
import
crypto
from
avocado.utils
import
data_factory
BASEDIR
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
BASEDIR
=
os
.
path
.
abspath
(
BASEDIR
)
from
..
import
BASEDIR
class
ArchiveTest
(
unittest
.
TestCase
):
...
...
selftests/unit/test_jobdata.py
浏览文件 @
99bbd3a0
...
...
@@ -5,9 +5,7 @@ from six import PY3
from
avocado.core
import
jobdata
BASEDIR
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'..'
)
BASEDIR
=
os
.
path
.
abspath
(
BASEDIR
)
from
..
import
BASEDIR
class
JobdataTest
(
unittest
.
TestCase
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录