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

Test boot aggregate #2749

Conversation

Krishan-Saraswat
Copy link
Contributor

localhost:# avocado run --max-parallel-tasks=1 grub-extend-pcr.py
JOB ID : 1dfd2c3459f708c42271d21a32e6251d5706d9d4
JOB LOG : /root/avocado-fvt-wrapper/results/job-2024-01-16T00.36-1dfd2c3/job.log
(1/4) grub-extend-pcr.py:GrubExtendPCR.test_tsspcrread_8: STARTED
(1/4) grub-extend-pcr.py:GrubExtendPCR.test_tsspcrread_8: PASS (0.04 s)
(2/4) grub-extend-pcr.py:GrubExtendPCR.test_tsspcrread_9: STARTED
(2/4) grub-extend-pcr.py:GrubExtendPCR.test_tsspcrread_9: PASS (0.04 s)
(3/4) grub-extend-pcr.py:GrubExtendPCR.test_tsseventextend: STARTED
(3/4) grub-extend-pcr.py:GrubExtendPCR.test_tsseventextend: PASS (0.04 s)
(4/4) grub-extend-pcr.py:GrubExtendPCR.test_boot_aggregate: STARTED
(4/4) grub-extend-pcr.py:GrubExtendPCR.test_boot_aggregate: PASS (0.04 s)
RESULTS : PASS 4 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
JOB HTML : /root/avocado-fvt-wrapper/results/job-2024-01-16T00.36-1dfd2c3/results.html
JOB TIME : 30.53 s

#
# See LICENSE for more details.
#
# Copyright: 2022 IBM
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please change this to 2024

# See LICENSE for more details.
#
# Copyright: 2022 IBM
# Author: Disha Goel <[email protected]>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Author name also


def test_workload(self):
# Get ebizzy workload and build
url = 'https://sourceforge.net/projects/ebizzy/files/ebizzy/0.3/ebizzy-0.3.tar.gz'
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this possible to get it from yaml?

process.run("./ebizzy -S1 -s1024 -t10", shell=True)

def capture_top_output(self):
process.getoutput("perf top -a > %s " % self.temp_file, timeout=10)
Copy link
Collaborator

Choose a reason for hiding this comment

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

use "process.run"

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 the file with latest changes

@Naresh-ibm
Copy link
Collaborator

@Krishan-Saraswat the files you have pushed are different.
can you check and confirm

@Krishan-Saraswat
Copy link
Contributor Author

@Krishan-Saraswat the files you have pushed are different. can you check and confirm

@Naresh-ibm I have fixed the commits that happened because I didn't move the branch to master and two different commits got combined.

self.fail("files doesn't exist")
if not os.path.exists("/sys/kernel/security/tpm0/binary_bios_measurements"):
self.fail("file doesn't exist")
cmd1 = "head -n1 /sys/kernel/security/ima/ascii_runtime_measurements"
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use the variable name for the filename(s). You used the filename more than once.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved

if not os.path.exists("/sys/kernel/security/tpm0/binary_bios_measurements"):
self.fail("file doesn't exist")
cmd1 = "head -n1 /sys/kernel/security/ima/ascii_runtime_measurements"
cmd2 = "tsseventextend -if /sys/kernel/security/tpm0/binary_bios_measurements -sim -pcrmax 9"
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use the variable name for the filename(s). You used the filename more than once.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved

ascii_runtime_measurements and binary_bios_measurements
'''
if not os.path.exists("/sys/kernel/security/ima/ascii_runtime_measurements"):
self.fail("files doesn't exist")
Copy link
Contributor

Choose a reason for hiding this comment

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

Please mention what file is not there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved

if not os.path.exists("/sys/kernel/security/ima/ascii_runtime_measurements"):
self.fail("files doesn't exist")
if not os.path.exists("/sys/kernel/security/tpm0/binary_bios_measurements"):
self.fail("file doesn't exist")
Copy link
Contributor

Choose a reason for hiding this comment

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

Please mention what file is not there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved

tssevent_output = process.system_output(cmd2, ignore_status=True).decode().splitlines()[-1]
tssevent_value = tssevent_output.split(":")[1].strip().replace(" ", "")
if arm_value != tssevent_value:
self.fail("Boot aggregate output doesn't match")
Copy link
Contributor

Choose a reason for hiding this comment

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

Improve this message - 'Boot aggregate output not matched from ascii and binary measurements'.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved.

Added testcase to validate the output for boot aggregate
from two different files ascii_runtime_measurements and
binary_bios_measurements.

Signed-off-by: Krishan Gopal Saraswat <[email protected]>
Copy link
Collaborator

@Naresh-ibm Naresh-ibm left a comment

Choose a reason for hiding this comment

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

@Krishan-Saraswat Thanks for PR
@PraveenPenguin @nasastry Thanks for review
LGTM

@Naresh-ibm Naresh-ibm merged commit 8491445 into avocado-framework-tests:master Mar 14, 2024
2 checks passed
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.

4 participants