提交 74aeccfa 编写于 作者: Q Qinghua Cheng

Add nested verify CPU models test case

Signed-off-by: NQinghua Cheng <qcheng@redhat.com>
上级 bfc04828
......@@ -11,6 +11,7 @@
bs_options: "{{bootstrap_options}}"
host_log_dir: "{{host_log_files_dir}}"
cmd_line: "{{command_line}}"
acc_cancel: "{{accept_cancel}}"
tasks:
......@@ -44,35 +45,30 @@
path: '{{kar_local}}'
register: kar_folder
- name: Clone kar
git:
repo: '{{kar_repo}}'
dest: '{{kar_local}}'
when: not kar_folder.stat.exists
- name: Run bootstrap script
command: ./Bootstrap.sh {{bs_options}}
args:
chdir: '{{kar_local}}'
when: not kar_folder.stat.exists
register: bootstrap_result
ignore_errors: True
- name: Remove kar folder when bootstrap failed
file:
path: '{{kar_local}}'
state: absent
when: bootstrap_result is failed
- name: Clean env when bootstrap failed
pip:
name: aexpect, avocado-framework, avocado-framework-plugin-vt, avocado-framework-plugin-result-html
state: absent
when: bootstrap_result is failed
- fail:
msg: "bootstrap script failed"
when: bootstrap_result is failed
- block:
- name: Clone kar
git:
repo: '{{kar_repo}}'
dest: '{{kar_local}}'
when: not kar_folder.stat.exists
- name: Run Bootstrap script
command: ./Bootstrap.sh {{bs_options}}
args:
chdir: '{{kar_local}}'
when: not kar_folder.stat.exists
register: bootstrap_result
rescue:
- name: Remove kar folder when bootstrap failed
file:
path: '{{kar_local}}'
state: absent
- name: Clean env when bootstrap failed
pip:
name: aexpect, avocado-framework, avocado-framework-plugin-vt, avocado-framework-plugin-result-html
state: absent
- fail:
msg: "bootstrap script failed"
- name: Run case
shell:
......@@ -91,6 +87,14 @@
msg: "Log dir is created"
when: guest_log_dir.stdout != ""
- name: Get results.json file from guest vm
slurp:
src: '{{ guest_log_dir.stdout}}/latest/results.json'
register: results_json
- set_fact:
results_json: "{{ results_json.content|b64decode|from_json }}"
- name: Compress log directory to log.bz2
archive:
path: '{{guest_log_dir.stdout}}/latest/'
......@@ -110,3 +114,12 @@
shell:
echo "Run test case failed"
failed_when: run_case_result is failed
- debug:
var: results_json.cancel
- name: Handle cancelled test cases
fail:
msg: "Test failed! There are unexpected cancelled test cases."
when:
- results_json.cancel != 0 and not acc_cancel|bool
......@@ -2,17 +2,19 @@
kar_repo = <kar_repo_url>
cert_url = <cert_ca_url>
nested_bs_options = ""
accept_cancel = no
l2_kar_options = ""
auto_cpu_model = yes
cpu_model_flags = ",+vmx"
no Host_RHEL.m7
Host_RHEL.m8.u0, Host_RHEL.m8.u1:
auto_cpu_model = no
cpu_model = host
only RHEL.8
type = nested_test
test_type = testcase
install_node = no
test_timeout = 3600
variants:
variants nested_test:
- boot_l2:
case_name = boot
install_node = yes
- check_cpu_model_l2:
case_name = x86_cpu_model
......@@ -8,6 +8,7 @@ from avocado.utils import software_manager
from virttest import error_context
from virttest import data_dir as virttest_data_dir
from virttest import cpu as virttest_cpu
@error_context.context_aware
......@@ -62,13 +63,21 @@ def run(test, params, env):
guest_password = params.get("password")
bootstrap_options = params.get("nested_bs_options")
accept_cancel = params.get_boolean("accept_cancel")
kar_cmd = "python3 ./ConfigTest.py "
test_type = params.get("test_type")
if test_type:
case_name = params.get("case_name")
if case_name:
kar_cmd += " --%s=%s " % (test_type, case_name)
variant_name = params.get("nested_test")
case_name = params.get("case_name", "")
if variant_name == "check_cpu_model_l2":
host_cpu_models = virttest_cpu.get_host_cpu_models()
case_name = ','.join(["%s.%s" % (case_name, i)
for i in host_cpu_models])
kar_cmd += " --%s=%s " % (test_type, case_name)
l2_guest_name = params.get("l2_guest_name")
if l2_guest_name:
kar_cmd += " --guestname=%s" % l2_guest_name
......@@ -92,6 +101,7 @@ def run(test, params, env):
data = {"guest_password": guest_password,
"bootstrap_options": bootstrap_options,
"accept_cancel": accept_cancel,
"command_line": kar_cmd,
"setup_br_sh": setup_bridge_sh,
"host_log_files_dir": results_dir,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册