Skip to content

Added grub.py that will help to automate grub test cases. #884

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Krishan-Saraswat
Copy link

Added measure_boot_time function that will measure boot timing from reboot to grub menu and from grub menu to kernel loading.

output snippet of running this test:-

2025-05-20 15:47:11,332:op-test.testcases.grub:runTest:INFO:Boot Time Results:
2025-05-20 15:47:11,332:op-test.testcases.grub:runTest:INFO:-----------------
2025-05-20 15:47:11,333:op-test.testcases.grub:runTest:INFO:Reboot to GRUB menu: 14.84 seconds
2025-05-20 15:47:11,333:op-test.testcases.grub:runTest:INFO:GRUB menu to kernel loading: 8.92 seconds
2025-05-20 15:47:11,333:op-test.testcases.grub:runTest:INFO:Total boot time: 23.76 seconds

Added measure_boot_time function that will measure boot timing
from reboot to grub menu and from grub menu to kernel loading.

Signed-off-by: Krishan Gopal Saraswat <krishang@linux.ibm.com>
'''
log.info("Starting boot time measurement test")
boot_times = self.measure_boot_time()
# Print results
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you please remove this comment, even wherever possible, if required, push as a logger, or method doc string

except pexpect.TIMEOUT:
log.error("Timeout waiting for boot sequence")
log.error("Last console output: %s" % self.console.pty.before)
raise OpTestError("Boot sequence timeout")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of Error out, can we able to recover the system using test ? or it kept manual

raise OpTestError("Boot sequence timeout")
except Exception as e:
log.error("Unexpected error during boot sequence: %s" % str(e))
raise
Copy link
Collaborator

Choose a reason for hiding this comment

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

raising any error?


class Grub(unittest.TestCase):
'''
Test case to measure boot timing
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we reword like

Test case to measure system boot timing


def measure_boot_time(self):
'''
Measure boot timing from reboot to grub menu and from grub menu to kernel loading
Copy link
Collaborator

Choose a reason for hiding this comment

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

here as well

@abdhaleegit abdhaleegit self-assigned this Jul 1, 2025
#!/usr/bin/env python3
# OpenPOWER Automated Test Project
#
# Contributors Listed Below - COPYRIGHT 2017
Copy link
Contributor

Choose a reason for hiding this comment

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

2025

self.cv_HOST = self.conf.host()
self.console = self.cv_SYSTEM.console

def measure_boot_time(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we pick another name to convey the exact use case? boot_time is very generic.

@abdhaleegit
Copy link
Collaborator

@Krishan-Saraswat Please have a look at the review comments

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