未验证 提交 dfc37482 编写于 作者: A Amador Pahim

Merge branch 'clebergnu-remove_pre_52_replay_compat'

Signed-off-by: NAmador Pahim <apahim@redhat.com>
......@@ -20,10 +20,7 @@ import ast
import glob
import json
import os
import pickle
import sys
from . import jobdata_compat_36_to_52
from . import varianter
from .output import LOG_UI, LOG_JOB
from .settings import settings
......@@ -31,38 +28,14 @@ from ..utils.path import init_dir
JOB_DATA_DIR = 'jobdata'
JOB_DATA_FALLBACK_DIR = 'replay'
CONFIG_FILENAME = 'config'
TEST_REFERENCES_FILENAME = 'test_references'
VARIANTS_FILENAME = 'variants'
# TODO: Remove when 36lts is discontinued
VARIANTS_FILENAME_LEGACY = 'multiplex'
VARIANTS_FILENAME = 'variants.json'
PWD_FILENAME = 'pwd'
ARGS_FILENAME = 'args'
ARGS_FILENAME = 'args.json'
CMDLINE_FILENAME = 'cmdline'
def _find_class(module, name):
"""
Look for a class including compatibility workarounds
"""
try:
mod = __import__(module)
mod = sys.modules[module]
return getattr(mod, name)
except ImportError:
if module == "avocado.core.multiplexer":
mod = __import__("avocado.core.jobdata_compat_36_to_52",
fromlist=[module])
return getattr(mod, name)
elif module == "avocado.plugins.yaml_to_mux":
mod = __import__("avocado_varianter_yaml_to_mux",
fromlist=[module])
return getattr(mod, name)
else:
raise
def record(args, logdir, mux, references=None, cmdline=None):
"""
Records all required job information.
......@@ -74,9 +47,9 @@ def record(args, logdir, mux, references=None, cmdline=None):
base_dir = init_dir(logdir, JOB_DATA_DIR)
path_cfg = os.path.join(base_dir, CONFIG_FILENAME)
path_references = os.path.join(base_dir, TEST_REFERENCES_FILENAME)
path_mux = os.path.join(base_dir, VARIANTS_FILENAME + ".json")
path_mux = os.path.join(base_dir, VARIANTS_FILENAME)
path_pwd = os.path.join(base_dir, PWD_FILENAME)
path_args = os.path.join(base_dir, ARGS_FILENAME + ".json")
path_args = os.path.join(base_dir, ARGS_FILENAME)
path_cmdline = os.path.join(base_dir, CMDLINE_FILENAME)
if references:
......@@ -114,9 +87,7 @@ def record(args, logdir, mux, references=None, cmdline=None):
def _retrieve(resultsdir, resource):
path = os.path.join(resultsdir, JOB_DATA_DIR, resource)
if not os.path.exists(path):
path = os.path.join(resultsdir, JOB_DATA_FALLBACK_DIR, resource)
if not os.path.exists(path):
return None
return None
return path
......@@ -136,10 +107,6 @@ def retrieve_references(resultsdir):
Retrieves the job test references from the results directory.
"""
recorded_references = _retrieve(resultsdir, TEST_REFERENCES_FILENAME)
# TODO: Remove if support for replaying jobs generated under older
# versions is also removed
if recorded_references is None:
recorded_references = _retrieve(resultsdir, 'urls')
if recorded_references is None:
return None
with open(recorded_references, 'r') as references_file:
......@@ -150,63 +117,20 @@ def retrieve_variants(resultsdir):
"""
Retrieves the job Mux object from the results directory.
"""
def _apply_36_to_52_workarounds(variants):
"""
The 36.x version of TreeNode did not contain `filters`. Let's
re-initialize it per each child.
"""
def get_fingerprint_meth(fingerprint):
"""
36.x TreeNode used to actually be equivalent of MuxTreeNode,
let's adjust the fingerprint to also contain self.ctrl
"""
def get():
return fingerprint
return get
for node in variants.variants.root.iter_children_preorder():
node.filters = [[], []]
node._environment = None
fingerprint = node.fingerprint()
node.fingerprint = get_fingerprint_meth("%s%s" % (fingerprint,
node.ctrl))
recorded_mux = _retrieve(resultsdir, VARIANTS_FILENAME + ".json")
if recorded_mux: # new json-based dump
recorded_mux = _retrieve(resultsdir, VARIANTS_FILENAME)
if recorded_mux:
with open(recorded_mux, 'r') as mux_file:
return varianter.Varianter(state=json.load(mux_file))
recorded_mux = _retrieve(resultsdir, VARIANTS_FILENAME)
if recorded_mux is None:
recorded_mux = _retrieve(resultsdir, VARIANTS_FILENAME_LEGACY)
if recorded_mux is None:
return None
# old pickle-based dump
# TODO: Remove when 36lts is discontinued
with open(recorded_mux, 'r') as mux_file:
unpickler = pickle.Unpickler(mux_file)
unpickler.find_class = _find_class
variants = unpickler.load()
if isinstance(variants, jobdata_compat_36_to_52.Mux):
LOG_UI.warn("Using outdated 36.x variants file.")
_apply_36_to_52_workarounds(variants)
state = varianter.dump_ivariants(variants.itertests)
return varianter.Varianter(state=state)
def retrieve_args(resultsdir):
"""
Retrieves the job args from the results directory.
"""
recorded_args = _retrieve(resultsdir, ARGS_FILENAME + ".json")
recorded_args = _retrieve(resultsdir, ARGS_FILENAME)
if recorded_args:
with open(recorded_args, 'r') as args_file:
return json.load(args_file)
recorded_args = _retrieve(resultsdir, ARGS_FILENAME)
if recorded_args is None:
return None
# old pickle-based dump
# TODO: Remove when 36lts is discontinued
with open(recorded_args, 'r') as args_file:
return pickle.load(args_file)
def retrieve_config(resultsdir):
......
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See LICENSE for more details.
#
# Copyright: Red Hat Inc. 2017
#
# Authors: Lukas Doktor <ldoktor@redhat.com>
"""
Jobdata compatibility layer from 36 to 52
"""
import hashlib
import itertools
from . import varianter
from . import mux
class MuxTree(mux.MuxPlugin):
"""
Excerpt of MuxTree object in order to make it compatible with 52
"""
pools = []
def __iter__(self):
"""
Iterates through variants
"""
pools = []
for pool in self.pools:
if isinstance(pool, list):
pools.append(itertools.chain(*pool))
else:
pools.append(pool)
pools = itertools.product(*pools)
while True:
# TODO: Implement 2nd level filters here
# TODO: This part takes most of the time, optimize it
yield list(itertools.chain(*next(pools)))
class AvocadoParams(varianter.AvocadoParams):
"""
Excerpt of original AvocadoParams in order to make it compatible
to the 52 version of AvocadoParams
"""
def __init__(self, leaves, test_id, tag, mux_path, default_params):
"""
:param leaves: List of TreeNode leaves defining current variant
:param test_id: test id
:param tag: test tag
:param mux_path: list of entry points
:param default_params: dict of params used when no matches found
"""
super(AvocadoParams, self).__init__(leaves, test_id, mux_path,
default_params)
class Mux(object):
"""
Excerpt of Mux object in order to emulate compatible object to 52
"""
variants = []
_mux_path = []
@staticmethod
def is_parsed():
"""
For jobdata purpose we only report True
"""
return True
def get_number_of_tests(self, test_suite):
"""
:return: overall number of tests * multiplex variants
"""
# Currently number of tests is symmetrical
if self.variants:
no_variants = sum(1 for _ in self.variants)
if no_variants > 1:
self._has_multiple_variants = True
return (len(test_suite) * no_variants)
else:
return len(test_suite)
def dump(self):
return varianter.dump_ivariants(self.itertests)
@staticmethod
def _get_variant_id(variant):
variant.sort(key=lambda x: x.path)
fingerprint = "-".join(_.fingerprint() for _ in variant)
return ("-".join(node.name for node in variant) + '-' +
hashlib.sha1(fingerprint).hexdigest()[:4])
def itertests(self):
"""
Processes the template and yields test definition with proper params
"""
if self.variants: # Copy template and modify it's params
handled = False
for variant in self.variants:
handled |= True
yield {"variant": variant,
"variant_id": self._get_variant_id(variant),
"mux_path": self._mux_path}
if not handled: # No variants, use template
yield {"variant": [],
"variant_id": None,
"mux_path": "/run"}
else: # No variants, use template
yield {"variant": [],
"variant_id": None,
"mux_path": "/run"}
# Simple example with 2 variants key/values in them
!mux
first:
variable_one: 1
second:
variable_two: 2
2017-06-22 18:27:22,725 sysinfo L0424 INFO | System log file not found (looked for ['/var/log/messages', '/var/log/syslog', '/var/log/system.log'])
2017-06-22 18:27:22,725 job L0364 INFO | Command line: /usr/local/bin/avocado run --external-runner /bin/echo -m examples/mux-0.yaml -- yes no
2017-06-22 18:27:22,725 job L0365 INFO |
[datadir.paths]
base_dir = /usr/share/avocado
test_dir = /usr/share/avocado/tests
data_dir = /usr/share/avocado/data
logs_dir = ~/avocado/job-results
[sysinfo.collect]
enabled = True
installed_packages = False
profiler = False
[sysinfo.collectibles]
commands = /etc/avocado/sysinfo/commands
files = /etc/avocado/sysinfo/files
profilers = /etc/avocado/sysinfo/profilers
[runner.output]
colored = True
utf8 =
[runner.behavior]
keep_tmp_files = False
[remoter.behavior]
reject_unknown_hosts = False
disable_known_hosts = False
[job.output]
loglevel = debug
[restclient.connection]
hostname = localhost
port = 9405
username =
password =
[plugins]
skip_broken_plugin_notification = []
loaders = ['file', '@DEFAULT']
[plugins.vtjoblock]
dir = /tmp
[gdb.paths]
gdb = /usr/bin/gdb
gdbserver = /usr/bin/gdbserver
[plugins.jobscripts]
pre = /etc/avocado/scripts/job/pre.d/
post = /etc/avocado/scripts/job/post.d/
warn_non_existing_dir = False
warn_non_zero_status = True
[avocado.selftest]
jobdata = yes
/home/medic/Work/Projekty/avocado/avocado
\ No newline at end of file
['yes', 'no']
\ No newline at end of file
2017-06-22 18:27:22,725 sysinfo L0424 INFO | System log file not found (looked for ['/var/log/messages', '/var/log/syslog', '/var/log/system.log'])
2017-06-22 18:27:22,725 job L0364 INFO | Command line: /usr/local/bin/avocado run --external-runner /bin/echo -m examples/mux-0.yaml -- yes no
2017-06-22 18:27:22,725 job L0365 INFO |
[datadir.paths]
base_dir = /usr/share/avocado
test_dir = /usr/share/avocado/tests
data_dir = /usr/share/avocado/data
logs_dir = ~/avocado/job-results
[sysinfo.collect]
enabled = True
installed_packages = False
profiler = False
[sysinfo.collectibles]
commands = /etc/avocado/sysinfo/commands
files = /etc/avocado/sysinfo/files
profilers = /etc/avocado/sysinfo/profilers
[runner.output]
colored = True
utf8 =
[runner.behavior]
keep_tmp_files = False
[remoter.behavior]
reject_unknown_hosts = False
disable_known_hosts = False
[job.output]
loglevel = debug
[restclient.connection]
hostname = localhost
port = 9405
username =
password =
[plugins]
skip_broken_plugin_notification = []
loaders = ['file', '@DEFAULT']
[plugins.vtjoblock]
dir = /tmp
[gdb.paths]
gdb = /usr/bin/gdb
gdbserver = /usr/bin/gdbserver
[plugins.jobscripts]
pre = /etc/avocado/scripts/job/pre.d/
post = /etc/avocado/scripts/job/post.d/
warn_non_existing_dir = False
warn_non_zero_status = True
[avocado.selftest]
jobdata = yes
/home/medic/Work/Projekty/avocado/avocado
\ No newline at end of file
['yes', 'no']
\ No newline at end of file
2017-06-22 18:27:22,725 sysinfo L0424 INFO | System log file not found (looked for ['/var/log/messages', '/var/log/syslog', '/var/log/system.log'])
2017-06-22 18:27:22,725 job L0364 INFO | Command line: /usr/local/bin/avocado run --external-runner /bin/echo -m examples/mux-0.yaml -- yes no
2017-06-22 18:27:22,725 job L0365 INFO |
[datadir.paths]
base_dir = /usr/share/avocado
test_dir = /usr/share/avocado/tests
data_dir = /usr/share/avocado/data
logs_dir = ~/avocado/job-results
[sysinfo.collect]
enabled = True
installed_packages = False
profiler = False
[sysinfo.collectibles]
commands = /etc/avocado/sysinfo/commands
files = /etc/avocado/sysinfo/files
profilers = /etc/avocado/sysinfo/profilers
[runner.output]
colored = True
utf8 =
[runner.behavior]
keep_tmp_files = False
[remoter.behavior]
reject_unknown_hosts = False
disable_known_hosts = False
[job.output]
loglevel = debug
[restclient.connection]
hostname = localhost
port = 9405
username =
password =
[plugins]
skip_broken_plugin_notification = []
loaders = ['file', '@DEFAULT']
[plugins.vtjoblock]
dir = /tmp
[gdb.paths]
gdb = /usr/bin/gdb
gdbserver = /usr/bin/gdbserver
[plugins.jobscripts]
pre = /etc/avocado/scripts/job/pre.d/
post = /etc/avocado/scripts/job/post.d/
warn_non_existing_dir = False
warn_non_zero_status = True
[avocado.selftest]
jobdata = yes
/home/medic/Work/Projekty/avocado/avocado
\ No newline at end of file
['yes', 'no']
\ No newline at end of file
2017-06-22 18:27:22,725 sysinfo L0424 INFO | System log file not found (looked for ['/var/log/messages', '/var/log/syslog', '/var/log/system.log'])
2017-06-22 18:27:22,725 job L0364 INFO | Command line: /usr/local/bin/avocado run --external-runner /bin/echo -m examples/mux-0.yaml -- yes no
2017-06-22 18:27:22,725 job L0365 INFO |
[datadir.paths]
base_dir = /usr/share/avocado
test_dir = /usr/share/avocado/tests
data_dir = /usr/share/avocado/data
logs_dir = ~/avocado/job-results
[sysinfo.collect]
enabled = True
installed_packages = False
profiler = False
[sysinfo.collectibles]
commands = /etc/avocado/sysinfo/commands
files = /etc/avocado/sysinfo/files
profilers = /etc/avocado/sysinfo/profilers
[runner.output]
colored = True
utf8 =
[runner.behavior]
keep_tmp_files = False
[remoter.behavior]
reject_unknown_hosts = False
disable_known_hosts = False
[job.output]
loglevel = debug
[restclient.connection]
hostname = localhost
port = 9405
username =
password =
[plugins]
skip_broken_plugin_notification = []
loaders = ['file', '@DEFAULT']
[plugins.vtjoblock]
dir = /tmp
[gdb.paths]
gdb = /usr/bin/gdb
gdbserver = /usr/bin/gdbserver
[plugins.jobscripts]
pre = /etc/avocado/scripts/job/pre.d/
post = /etc/avocado/scripts/job/post.d/
warn_non_existing_dir = False
warn_non_zero_status = True
[avocado.selftest]
jobdata = yes
/home/medic/Work/Projekty/avocado/avocado
\ No newline at end of file
['yes', 'no']
\ No newline at end of file
2017-06-22 18:27:22,725 sysinfo L0424 INFO | System log file not found (looked for ['/var/log/messages', '/var/log/syslog', '/var/log/system.log'])
2017-06-22 18:27:22,725 job L0364 INFO | Command line: /usr/local/bin/avocado run --external-runner /bin/echo -m examples/mux-0.yaml -- yes no
2017-06-22 18:27:22,725 job L0365 INFO |
[datadir.paths]
base_dir = /usr/share/avocado
test_dir = /usr/share/avocado/tests
data_dir = /usr/share/avocado/data
logs_dir = ~/avocado/job-results
[sysinfo.collect]
enabled = True
installed_packages = False
profiler = False
[sysinfo.collectibles]
commands = /etc/avocado/sysinfo/commands
files = /etc/avocado/sysinfo/files
profilers = /etc/avocado/sysinfo/profilers
[runner.output]
colored = True
utf8 =
[runner.behavior]
keep_tmp_files = False
[remoter.behavior]
reject_unknown_hosts = False
disable_known_hosts = False
[job.output]
loglevel = debug
[restclient.connection]
hostname = localhost
port = 9405
username =
password =
[plugins]
skip_broken_plugin_notification = []
loaders = ['file', '@DEFAULT']
[plugins.vtjoblock]
dir = /tmp
[gdb.paths]
gdb = /usr/bin/gdb
gdbserver = /usr/bin/gdbserver
[plugins.jobscripts]
pre = /etc/avocado/scripts/job/pre.d/
post = /etc/avocado/scripts/job/post.d/
warn_non_existing_dir = False
warn_non_zero_status = True
[avocado.selftest]
jobdata = yes
/home/medic/Work/Projekty/avocado/avocado
\ No newline at end of file
['yes', 'no']
\ No newline at end of file
[datadir.paths]
base_dir = /usr/share/avocado
test_dir = /usr/share/avocado/tests
data_dir = /usr/share/avocado/data
logs_dir = ~/avocado/job-results
[sysinfo.collect]
enabled = True
installed_packages = False
profiler = False
[sysinfo.collectibles]
commands = /etc/avocado/sysinfo/commands
files = /etc/avocado/sysinfo/files
profilers = /etc/avocado/sysinfo/profilers
[runner.output]
colored = True
utf8 =
[runner.behavior]
keep_tmp_files = False
[remoter.behavior]
reject_unknown_hosts = False
disable_known_hosts = False
[job.output]
loglevel = debug
[restclient.connection]
hostname = localhost
port = 9405
username =
password =
[plugins]
skip_broken_plugin_notification = []
loaders = ['file', '@DEFAULT']
[plugins.vtjoblock]
dir = /tmp
[gdb.paths]
gdb = /usr/bin/gdb
gdbserver = /usr/bin/gdbserver
[plugins.jobscripts]
pre = /etc/avocado/scripts/job/pre.d/
post = /etc/avocado/scripts/job/post.d/
warn_non_existing_dir = False
warn_non_zero_status = True
[avocado.selftest]
jobdata = yes
/home/medic/Work/Projekty/avocado/avocado
\ No newline at end of file
['yes', 'no']
\ No newline at end of file
['/usr/local/bin/avocado', 'run', '--external-runner', '/bin/echo', '-m', 'examples/mux-0.yaml', '--', 'yes', 'no']
\ No newline at end of file
[datadir.paths]
base_dir = /usr/share/avocado
test_dir = /usr/share/avocado/tests
data_dir = /usr/share/avocado/data
logs_dir = ~/avocado/job-results
[sysinfo.collect]
enabled = True
installed_packages = False
profiler = False
locale = C
[sysinfo.collectibles]
commands = /etc/avocado/sysinfo/commands
files = /etc/avocado/sysinfo/files
profilers = /etc/avocado/sysinfo/profilers
[runner.output]
colored = True
utf8 =
[runner.behavior]
keep_tmp_files = False
[remoter.behavior]
reject_unknown_hosts = False
disable_known_hosts = False
[job.output]
loglevel = debug
[restclient.connection]
hostname = localhost
port = 9405
username =
password =
[plugins]
skip_broken_plugin_notification = []
loaders = ['file', '@DEFAULT']
[plugins.vtjoblock]
dir = /tmp
[gdb.paths]
gdb = /usr/bin/gdb
gdbserver = /usr/bin/gdbserver
[plugins.jobscripts]
pre = /etc/avocado/scripts/job/pre.d/
post = /etc/avocado/scripts/job/post.d/
warn_non_existing_dir = False
warn_non_zero_status = True
[avocado.selftest]
jobdata = yes
/home/medic/Work/Projekty/avocado/avocado
\ No newline at end of file
['yes', 'no']
\ No newline at end of file
{"replay_teststatus": null, "external_runner_chdir": null, "unique_job_id": null, "show": ["app", "debug"], "filter_out": [], "vm_username": "medic", "docker_cmd": "docker", "execution_order": "variants-per-test", "remote_password": null, "mux_filter_only": [], "html_job_result": "on", "html_output": null, "tap": null, "replay_ignore": [], "archive": false, "xunit_output": null, "show_job_log": false, "external_runner_testdir": null, "output_check": "on", "replay_jobid": null, "remote_username": "medic", "remote_port": 22, "filter_only": [], "sysinfo": "on", "remote_key_file": null, "remote_hostname": null, "wrapper": [], "loaders": ["external:/bin/echo"], "job_timeout": 0, "mux_inject": [], "logdir": null, "gdb_prerun_commands": [], "vm_domain": null, "store_logging_stream": [], "external_runner": "/bin/echo", "vm_hostname": null, "vm_key_file": null, "config": null, "journal": false, "json_job_result": "on", "vm_password": null, "gdb_coredump": "off", "vm_timeout": 120, "remote_timeout": 60, "xunit_job_result": "on", "subcommand": "run", "mux_filter_out": [], "keep_tmp": "off", "docker_no_cleanup": false, "mux_path": null, "avocado_variants": null, "open_browser": false, "json_output": null, "vm_port": 22, "docker_options": "", "reference": ["yes", "no"], "tap_job_result": "on", "resultsdb_logs": null, "env_keep": null, "resultsdb_api": null, "dry_run": false, "vm_cleanup": false, "mux_yaml": ["examples/mux-0.yaml"], "vm_hypervisor_uri": "qemu:///system", "replay_resume": false, "output_check_record": "none", "filter_by_tags": null, "multiplex": null, "filter_by_tags_include_empty": false, "ignore_missing_references": null, "default_avocado_params": null, "docker": null, "failfast": null, "gdb_run_bin": []}
\ No newline at end of file
['/usr/local/bin/avocado', 'run', '--external-runner', '/bin/echo', '-m', 'examples/mux-0.yaml', '--', 'yes', 'no']
\ No newline at end of file
/home/medic/Work/Projekty/avocado/avocado
\ No newline at end of file
test_references
\ No newline at end of file
[{"mux_path": ["/run/*"], "variant": [["/run/variant1", [["/run/variant1", "foo", "bar"]]]], "variant_id": "variant1-6ec4"}, {"mux_path": ["/run/*"], "variant": [["/run/variant2", [["/run/variant2", "foo", "baz"]]]], "variant_id": "variant2-a6fe"}]
\ No newline at end of file
{"replay_teststatus": null, "external_runner_chdir": null, "unique_job_id": null, "show": ["app"], "filter_out": [], "vm_username": "cleber", "docker_cmd": "docker", "execution_order": null, "remote_password": null, "mux_filter_only": [], "html_job_result": "on", "html_output": null, "tap": null, "replay_ignore": [], "archive": false, "xunit_output": null, "show_job_log": false, "external_runner_testdir": null, "output_check": "on", "replay_jobid": null, "remote_username": "cleber", "remote_port": 22, "filter_only": [], "sysinfo": "on", "remote_key_file": null, "remote_hostname": null, "wrapper": [], "loaders": ["external:/bin/echo"], "job_timeout": 0, "mux_inject": [], "logdir": null, "gdb_prerun_commands": [], "vm_domain": null, "store_logging_stream": [], "external_runner": "/bin/echo", "vm_hostname": null, "vm_key_file": null, "config": null, "journal": false, "json_job_result": "on", "vm_password": null, "gdb_coredump": "off", "vm_timeout": 120, "remote_timeout": 60, "xunit_job_result": "on", "subcommand": "run", "mux_filter_out": [], "keep_tmp": "off", "docker_no_cleanup": false, "mux_path": null, "avocado_variants": null, "open_browser": false, "json_output": null, "vm_port": 22, "docker_options": "", "reference": ["yes", "no"], "tap_job_result": "on", "resultsdb_logs": null, "env_keep": null, "resultsdb_api": null, "dry_run": false, "vm_cleanup": false, "mux_yaml": ["examples/yaml_to_mux/simple_vars.yaml"], "vm_hypervisor_uri": "qemu:///system", "replay_resume": false, "output_check_record": "none", "filter_by_tags": null, "multiplex": null, "filter_by_tags_include_empty": false, "ignore_missing_references": null, "default_avocado_params": null, "docker": null, "failfast": null, "gdb_run_bin": []}
['/usr/local/bin/avocado', 'run', '--external-runner', '/bin/echo', '-m', 'examples/mux-0.yaml', '--', 'yes', 'no']
\ No newline at end of file
['/usr/local/bin/avocado', 'run', '--external-runner', '/bin/echo', '-m', 'examples/yaml_to_mux/simple_vars.yaml', '--', 'yes', 'no']
/home/user/avocado
\ No newline at end of file
[{"mux_path": ["/run/*"], "variant": [["/run/first", [["/run/first", "variable_one", 1]]]], "variant_id": "first-febe"}, {"mux_path": ["/run/*"], "variant": [["/run/second", [["/run/second", "variable_two", 2]]]], "variant_id": "second-bafe"}]
\ No newline at end of file
......@@ -185,18 +185,6 @@ class ReplayTests(unittest.TestCase):
"test references given on the command line.")
self.assertIn(msg, result.stderr)
def test_run_replay_fallbackdir(self):
"""
Runs a replay job with the fallback job data directory name.
"""
shutil.move(os.path.join(self.jobdir, 'jobdata'),
os.path.join(self.jobdir, 'replay'))
cmd_line = ('%s run --replay %s '
'--job-results-dir %s --sysinfo=off'
% (AVOCADO, self.jobid, self.tmpdir))
expected_rc = exit_codes.AVOCADO_ALL_OK
self.run_and_check(cmd_line, expected_rc)
def test_run_replay_and_mux(self):
"""
Runs a replay job and specifies multiplex file (which should be
......
......@@ -17,7 +17,7 @@ class JobdataTest(unittest.TestCase):
# pwd
self.assertEqual(jobdata.retrieve_pwd(pth),
"/home/medic/Work/Projekty/avocado/avocado",
"/home/user/avocado",
"pwd mismatch")
# references
......@@ -31,10 +31,10 @@ class JobdataTest(unittest.TestCase):
self.fail("variants: Unable to retrieve: %s" % details)
act = variants.to_str(0, 99)
self.assertTrue(act)
exp = ("\nVariant variant1-6ec4: /run/variant1\n"
" /run/variant1:foo => bar\n\n"
"Variant variant2-a6fe: /run/variant2\n"
" /run/variant2:foo => baz")
exp = ("\nVariant first-febe: /run/first\n"
" /run/first:variable_one => 1\n\n"
"Variant second-bafe: /run/second\n"
" /run/second:variable_two => 2")
self.assertIn(exp, act, "variants mismatch")
# args
......@@ -70,7 +70,8 @@ class JobdataTest(unittest.TestCase):
# cmdline
act = jobdata.retrieve_cmdline(pth)
exp = ['/usr/local/bin/avocado', 'run', '--external-runner',
'/bin/echo', '-m', 'examples/mux-0.yaml', '--', 'yes', 'no']
'/bin/echo', '-m', 'examples/yaml_to_mux/simple_vars.yaml',
'--', 'yes', 'no']
self.assertEqual(exp, act,
"cmdline: Invalid cmdline '%s' (%s)" % (act, exp))
......@@ -78,29 +79,8 @@ class JobdataTest(unittest.TestCase):
def setUp(self):
os.chdir(BASEDIR)
def test_36_0_lts(self):
self._check_results("results-36.0lts")
def test_36_4(self):
self._check_results("results-36.4")
def test_37_0(self):
self._check_results("results-37.0")
def test_38_0(self):
self._check_results("results-38.0")
def test_39_0(self):
self._check_results("results-39.0")
def test_40_0(self):
self._check_results("results-40.0")
def test_41_0(self):
self._check_results("results-41.0")
def test_51_0(self):
self._check_results("results-51.0")
def test_52_0(self):
self._check_results("results-52.0")
if __name__ == "__main__":
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册