@@ -59,11 +59,14 @@ def setUp(self):
59
59
self .cv_HOST = conf .host ()
60
60
self .cv_IPMI = conf .ipmi ()
61
61
self .cv_SYSTEM = conf .system ()
62
+ self .timeout = 30
62
63
63
64
def number_reboots_to_do (self ):
64
65
return 2
65
66
66
67
def boot_to_os (self ):
68
+ self .timeout = 15
69
+ self .target = OpSystemState .IPLing
67
70
return False
68
71
69
72
def get_fast_reset_count (self , c ):
@@ -91,8 +94,10 @@ def runTest(self):
91
94
getting executed in both petitboot and host OS
92
95
'''
93
96
if self .boot_to_os ():
97
+ self .cv_SYSTEM .sys_set_bootdev_no_override ()
94
98
self .cv_SYSTEM .goto_state (OpSystemState .OS )
95
99
else :
100
+ self .cv_SYSTEM .sys_set_bootdev_setup ()
96
101
self .cv_SYSTEM .goto_state (OpSystemState .PETITBOOT_SHELL )
97
102
98
103
c = self .cv_SYSTEM .console
@@ -114,7 +119,7 @@ def runTest(self):
114
119
"grep '^cpu' /proc/cpuinfo|uniq|sed -e 's/^.*: //;s/[,]* .*//;'" ))
115
120
log .debug (repr (cpu ))
116
121
if cpu not in ["POWER9" , "POWER8" , "POWER8E" ]:
117
- self .skipTest ("Fast Reboot not supported on %s" % cpu )
122
+ self .skipTest ("Fast Reboot not supported on {}" . format ( cpu ) )
118
123
119
124
if not self .cv_SYSTEM .has_mtd_pnor_access ():
120
125
self .skipTest ("OpTestSystem does not have MTD PNOR access,"
@@ -128,34 +133,49 @@ def runTest(self):
128
133
self .assertIn ("feeling-lucky" , res ,
129
134
"Failed to set the fast-reset mode" )
130
135
initialResetCount = self .get_fast_reset_count (c )
131
- log .debug ("INITIAL reset count: %d" % initialResetCount )
136
+ log .debug ("FASTREBOOT initialResetCount={}" . format ( initialResetCount ) )
132
137
for i in range (0 , self .number_reboots_to_do ()):
133
138
loopResetCount = self .get_fast_reset_count (c )
134
139
# We do some funny things with the raw pty here, as
135
140
# 'reboot' isn't meant to return
136
141
self .pty = self .cv_SYSTEM .console .get_console ()
142
+ log .debug ("FASTREBOOT Expect Buffer ID={}" .format (hex (id (self .pty ))))
137
143
self .pty .sendline ("reboot" )
138
- self .cv_SYSTEM .set_state (OpSystemState .IPLing )
144
+ self .cv_SYSTEM .set_state (self .target )
145
+ self .cv_SYSTEM .util .clear_state (self .cv_SYSTEM )
139
146
# We're looking for a skiboot log message, that it's doing fast
140
147
# reboot. We *may* not get this, as on some systems (notably IBM
141
148
# FSP based systems) the skiboot log is *not* printed to IPMI
142
149
# console
143
150
if self .cv_SYSTEM .skiboot_log_on_console ():
151
+ log .debug ("FASTREBOOT looking for RESET: Initiating fast reboot" )
152
+ # timeout is only long enough, if we wait too long the expect
153
+ # buffer will not get the data to keep things moving
144
154
rc = self .pty .expect ([" RESET: Initiating fast reboot" ,
145
155
pexpect .TIMEOUT , pexpect .EOF ],
146
- timeout = 100 )
156
+ timeout = self .timeout )
157
+ log .debug ("FASTREBOOT rc={} (0=We found RESET 1=TIMEOUT 2=EOF)" .format (rc ))
158
+ log .debug ("FASTREBOOT before={}" .format (self .pty .before ))
159
+ log .debug ("FASTREBOOT after={}" .format (self .pty .after ))
147
160
if rc in [1 , 2 ]:
161
+ log .debug ("FASTREBOOT CLOSE Expect Buffer ID={}" .format (hex (id (self .pty ))))
148
162
c .close () # close the console obj
149
163
if self .boot_to_os ():
164
+ log .debug ("FASTREBOOT marker, we're now going to boot to OS" )
165
+ self .cv_SYSTEM .sys_set_bootdev_no_override ()
150
166
self .cv_SYSTEM .goto_state (OpSystemState .OS )
151
167
else :
168
+ log .debug ("FASTREBOOT marker, we're now going to boot to PS" )
169
+ self .cv_SYSTEM .sys_set_bootdev_setup ()
152
170
self .cv_SYSTEM .goto_state (OpSystemState .PETITBOOT_SHELL )
153
171
newResetCount = self .get_fast_reset_count (c )
154
172
self .assertTrue (loopResetCount < newResetCount ,
155
- "Did not do fast reboot" )
173
+ "FASTREBOOT encountered a problem, loopResetCount {} >= newResetCount {}, check the debug logs"
174
+ .format (loopResetCount , newResetCount ))
156
175
self .assertTrue (initialResetCount < newResetCount ,
157
- "Did not do fast reboot" )
158
- log .debug ("Completed Fast reboot cycle %d" % i )
176
+ "FASTREBOOT encountered a problem, initialResetCount {} >= newResetCount {}, check the debug logs"
177
+ .format (initialResetCount , newResetCount ))
178
+ log .debug ("FASTREBOOT completed cycle i={}" .format (i ))
159
179
160
180
c .run_command (BMC_CONST .NVRAM_DISABLE_FAST_RESET_MODE )
161
181
try :
@@ -170,11 +190,13 @@ def runTest(self):
170
190
171
191
class FastRebootHost (OpTestFastReboot ):
172
192
def boot_to_os (self ):
193
+ self .target = OpSystemState .BOOTING
173
194
return True
174
195
175
196
176
197
class FastRebootHostTorture (FastRebootHost ):
177
198
def boot_to_os (self ):
199
+ self .target = OpSystemState .BOOTING
178
200
return True
179
201
180
202
def number_reboots_to_do (self ):
0 commit comments