Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

guest_os_booting: add new case for backed nvram source #5164

Merged
merged 1 commit into from
Nov 9, 2023

Conversation

meinaLi
Copy link
Contributor

@meinaLi meinaLi commented Sep 8, 2023

This case is to verify the ovmf different backed nvram source. Now it only cover the file type.

@meinaLi
Copy link
Contributor Author

meinaLi commented Sep 8, 2023

# avocado run --vt-type libvirt --test-runner=runner --vt-machine-type q35 guest_os_booting.ovmf_backed_nvram
JOB ID     : e818c6b1d41ffe98e5c93ef0ce57e123f06ea4d3
JOB LOG    : /var/lib/avocado/job-results/job-2023-09-07T23.14-e818c6b/job.log
 (1/3) type_specific.io-github-autotest-libvirt.guest_os_booting.ovmf_backed_nvram.file_source.default: PASS (35.70 s)
 (2/3) type_specific.io-github-autotest-libvirt.guest_os_booting.ovmf_backed_nvram.file_source.with_selinux_seclabel: PASS (35.19 s)
 (3/3) type_specific.io-github-autotest-libvirt.guest_os_booting.ovmf_backed_nvram.file_source.with_dac_seclabel: PASS (47.22 s)
RESULTS    : PASS 3 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB HTML   : /var/lib/avocado/job-results/job-2023-09-07T23.14-e818c6b/results.html
JOB TIME   : 118.84 s

@meinaLi
Copy link
Contributor Author

meinaLi commented Sep 8, 2023

Depend on avocado-framework/avocado-vt#3764.

Copy link
Contributor

@cliping cliping left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Others LGTM


def run(test, params, env):
"""
This case is to verify the ovmf backed nvram.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has extra spaces between 'ovmf' and 'backed'.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

Copy link
Contributor

@Yingshun Yingshun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Others LGTM

2) Start and boot the guest.
3) Check the dumpxml and the label if necessary.
"""
def compare_guest_xml():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to pass 'vmxml' and 'os_attrs' as arguments of this function to make them as local variables, I think it's easy for others to understand it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the arguments to the function compare_guest_xml(vmxml, os_attrs).

test.fail("Configured os xml value {} doesn't match the"
" entry {} in guest xml".format(os_attrs[key], current_os_attrs[key]))
else:
test.fail("Configured os attributes {} aren't existed in guest.".format(key))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:%s/aren't/don't

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

if seclabel_label in label_result:
test.log.info("Get expected nvram file label: {}".format(label_result))
else:
test.fail("The nvram file label %{} is not expected".format(label_result))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove %?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

- with_selinux_seclabel:
seclabel_model = "selinux"
seclabel_label = "system_u:object_r:nvram_image_t:s0"
nvram_dict = {'nvram_source': {'seclabels': [{'label': '${seclabel_label}', 'model': '${seclabel_model}', 'relabel': 'yes'}], 'attrs': {'file': '%s'}}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These ones(nvram_attrs and nvram_dict) are a bit similar, how about replacing 'nvram_dict' with 'nvram_source'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, a little similar. So changed to nvram_source.

@meinaLi
Copy link
Contributor Author

meinaLi commented Nov 6, 2023

Split the manual case to two cases: test the ovmf file backed nvram and test the ovmf nvram seclable. So update the script here.

# avocado run --vt-type libvirt --test-runner=runner --vt-machine-type q35 guest_os_booting.ovmf_backed_nvram
JOB ID     : a507e5b2eeb0bdafd96ef488dbf7757b1be1988e
JOB LOG    : /var/lib/avocado/job-results/job-2023-11-06T01.32-a507e5b/job.log
 (1/1) type_specific.io-github-autotest-libvirt.guest_os_booting.ovmf_backed_nvram.file: PASS (33.94 s)
RESULTS    : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB HTML   : /var/lib/avocado/job-results/job-2023-11-06T01.32-a507e5b/results.html
JOB TIME   : 34.73 s

@meinaLi meinaLi marked this pull request as ready for review November 6, 2023 06:36
This case is to verify the ovmf different backed nvram source. Now it only cover the file type.

Signed-off-by: Meina Li <[email protected]>
@Yingshun Yingshun merged commit 24875f3 into autotest:master Nov 9, 2023
5 checks passed
@meinaLi meinaLi deleted the backed_nvram branch November 10, 2023 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants