Author: gnichols Date: 2010-08-23 20:57:57 +0000 (Mon, 23 Aug 2010) New Revision: 657
Modified: trunk/tests/reboot/reboot.py Log: 626524 - reboot test counts time waiting at prompt in reboot time
Modified: trunk/tests/reboot/reboot.py =================================================================== --- trunk/tests/reboot/reboot.py 2010-08-23 20:55:32 UTC (rev 656) +++ trunk/tests/reboot/reboot.py 2010-08-23 20:57:57 UTC (rev 657) @@ -83,7 +83,13 @@
def reboot(self): - print "The system must be restarted for this test" + usePanic = self.verifyKDump() + + if usePanic: + print "The test will now cause a kernel panic to exercise kdump" + else: + print "The system must be restarted for this test" + if self.getMode() != Constants.auto: if not self.promptConfirm("Ready to restart?"): return False @@ -91,10 +97,16 @@ # we need a delay here to give v7 time to finish writing results.xml sys.stdout.flush() self.waitForLull() + + # set up restart, and log start time + self.continuation.setInitConfig(marker=self.Name())
- rebootCommand = Command("shutdown -r 0") try: - rebootCommand.echo() + if usePanic: + Command("echo 1 > /proc/sys/kernel/sysrq").echo() + Command("echo "c" > /proc/sysrq-trigger").echo() + else: + Command("shutdown -r 0").echo() except Exception, e: print "Error: reboot failed" print e @@ -102,34 +114,14 @@
# wait here for reboot waitTime = 60 #sec - print "Waiting for shutdown..." + if usePanic: + mode = "kernel panic" + else: + mode = "shutdown" + print "Waiting for %s..." % mode time.sleep(waitTime) - print "Error: Shutdown took too long" + print "Error: %s took too long" % mode return False - - def causePanic(self): - print "The test will now cause a kernel panic to exercise kdump" - if self.getMode() != Constants.auto: - if not self.promptConfirm("Ready to restart?"): - return False - # we need a delay here to give v7 time to finish writing results.xml - sys.stdout.flush() - self.waitForLull() - - try: - Command("echo 1 > /proc/sys/kernel/sysrq").echo() - Command("echo "c" > /proc/sysrq-trigger").echo() - except V7CommandException, e: - print "Error: could not cause kernel panic" - print e - return False - - # wait here for panic - shouldn't ever get here - waitTime = 60 #sec - print "Waiting for panic..." - time.sleep(waitTime) - print "Error: panic did not occur?" - return False
def run(self): PASSED = 0 @@ -139,12 +131,8 @@ result = self.continuation.verify(marker=self.Name()) self.continuation.removeInitConfig() else: - self.continuation.setInitConfig(marker=self.Name()) - if self.verifyKDump(): - result = self.causePanic() - else: - result = self.reboot() - + result = self.reboot() + if result: return PASSED
# otherwise
v7-commits@lists.stg.fedorahosted.org